[antlr-interest] C# parser grammar problem

Gavin Lambert antlr at mirality.co.nz
Wed Mar 7 23:49:16 PST 2007


At 02:39 8/03/2007, Johannes Luber wrote:
 >Furthermore I've read through the relevant pages 85 and 86, but
 >there is no explicit sentence, which discriminates between lexer 

 >and parser rules. After I repaired my grammar I realized that
 >the difference is simple. "If a rule doesn't include references
 >to other rules, it is a lexer rule, otherwise a parser rule."
 >It would have helped to lessen my learning curve.

Actually no, that's not how it works :)  The difference is even 
simpler: lexer rules start with a capital letter and parser rules 
start with a lowercase letter.

That one tripped me up for quite a while when I first started 
using ANTLR3, since I couldn't find anywhere on the website that 
mentioned the distinction.  (I haven't read the PDF, but it didn't 
exist at that point anyway.)



More information about the antlr-interest mailing list