[antlr-interest] warning(200), error(201), error(211) and error(208). Help!

John B. Brodie jbb at acm.org
Fri Oct 7 13:43:20 PDT 2011


On Fri, 2011-10-07 at 13:16 -0700, mglyons wrote:
> Thanks for the quick response John B.  
> 
> In the pdf I have that is instructing how to write this grammar it says
> this:
> 
> /The keywords of the language are the following:/
> *else if int return void while*
> /All keywrods are reserved, and must be written in lowercase./

> 
> I assumed that meant that they had to be lower case in my grammar.  Am I
> interpreting it incorrectly?

the quoted string for the keyword should be lower case as you have
correctly interpreted. but the rule name should be upper case in order
for it to be considered a rule governing Lexical Analysis rather than
Parsing by the ANTLR Tool. so instead of:

else : 'else' ;

do:

ELSE : 'else' ;

and likewise for your other keyword rules.

> 
> As for putting quote marks around the { and }, I added that.
> 
> 
> 
> Now I am getting these errors:
....remainder snipped....



More information about the antlr-interest mailing list