Restarting work on ANTLR's Ada95 Target
Well, I've begun to look at the ANTLR source and the source I started writing for the Ada95 language target and I'm getting to the point where I'm seeing problems with the Java implementation again. This is just the basic stuff like the token definitions and the generation of the tokens in the string template group (STG) for the language. Ideally, I'd like the token types to be an enumeration so that we can have Ada coverage testing but other classes in the runtime use Token.EOF which in turn is actually the same thing as CharStream.EOF.
Also, the STG dumps out a constant called "Tokens" which is basically a count of all the tokens defined. When using this for Ada it's not quite right. This can be massaged to give the correct value, but in Ada it's unnecessary, as you can use 'Last attribute for any correctly defined type. I'm not sure if I can get rid of this for the target yet.
The channel numbers also seems odd, the default channel is given a number of 0 and the hidden channel is 99, why not 0 and 1? You'd think that channel 99 is the upper bound allowed, but no, any positive integer will do, this just seems like it's been plucked out of thin air without thinking about it. For example, say you have a whole bunch of channels and want to use a counter to step through them, you'd have to keep checking for 99 before you can skip over it, why not just set it to 1 or 0, at least then there is no checking needed!
Write a comment
- Required fields are marked with *.

