[antlr-interest] Comments / White-Space and All The Rest

Terence Parr parrt at cs.usfca.edu
Fri Nov 24 12:05:55 PST 2006


On Nov 24, 2006, at 11:44 AM, Randall R Schulz wrote:
> What "i" values do I use? The comment doesn't specify how that  
> parameter
> is interpreted.

Token index.  See myToken.getTokenIndex().

>> Looking at the generated code and looking at the source code for the
>> run time is very important.
>
> May I respectfully disagree? I should not have to understand a tool's
> internals to use it, should I?

Yes, when you have no documentation and you are trying to use a  
library.  Further, you can substitute knowledge of grammars with  
knowledge of Java code by looking at grammar to Java code  
translation. This will always be of help to you.

>>> I also notice that rules that return a single value (which is all
>>> but two of the rules in my grammar) don't trigger the generation of
>>> return types that descend from ParserRuleReturnScope. In those
>>> cases, how do I
>>> get at the start and stop tokens?
>>
>> Ask and ye shall receive. ANTLR senses it and turns on multiple
>> return values to return start and stop for you.  Just try it and see
>> what happens. that is the name of the game.
>
> Trial and error makes for very slow going, which is how it's been for
> me.

I feel that only people with experience should use the beta because  
there is no documentation. You must rely on experience and looking at  
source code.

> Are you sure you won't share some documentation?

You will see a beta book up in a couple of weeks at the pragmatic  
programmer's website. :)

Ter


More information about the antlr-interest mailing list