[antlr-interest] C# parser grammar problem

Terence Parr parrt at cs.usfca.edu
Thu Mar 8 09:02:33 PST 2007

Hi gang.

tokens/token rules all start with an uppercase letter.  nothing else  

On Mar 8, 2007, at 3:47 AM, Gavin Lambert wrote:

> At 00:04 9/03/2007, Johannes Luber wrote:
> >Besides, if naming would be the only way to distinguish between
> >parser and lexer rules, how could ANTLR know when one uses the
> >wrong naming convention? I suppose that one could write a parser
> >with doing the work of the lexer so there would be no need to
> >codify that convention in that case. A simple "Best Practice"
> >would be then sufficient.
> I'm not quite sure what you mean by this.  Lexer and parser rules  
> act on different input as well (lexer rules act only on characters,  
> and parser rules act only on tokens), so they're fairly different.   
> The capitalisation of the rule gives the hint to ANTLR about how to  
> interpret the contents of the rule (eg. how it should treat string/ 
> character constants), so if you get it wrong then you'll usually  
> (but not always) get an error, though it's not a particularly easy  
> to understand one.  Especially since the capitalisation convention  
> wasn't documented.

More information about the antlr-interest mailing list