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

John B. Brodie jbb at acm.org
Fri Oct 7 12:38:28 PDT 2011


Greetings!

On Fri, 2011-10-07 at 11:45 -0700, mglyons wrote:
> I am trying to build the grammar for a small language, C-.  I am getting a
> long list of errors and am unable to resolve them with google and my
> textbook after almost a day of trying.
> 
> Here is my grammar:
> 
> 
> Here is the list of errors:
> 
the attachments did not appear (for me) on the mailing list.
but found the grammar and list of errors on the nabble link.

i did not try to run your grammar through the ANTLR Tool but by
inspection i see two issues:

a) starting with your else parser rule and continuing to the end of the
grammar, all of these rules appear to be better expressed as lexer rules
so make the first letter (at least) of each rule name be an upper case
letter.

b) your compound statement rule does not quote the { and the } so it
consists of just a semantic action that is not valid java code. 

try fixing the above and see what errors/warnings remain from the Tool.

you probably will want/need to left factor several of your rules as the
Tool suggests.

hope this helps...
   -jbb




More information about the antlr-interest mailing list