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

John B. Brodie jbb at acm.org
Fri Oct 7 12:47:22 PDT 2011


Sorry for replying to my own reply. But I forgot to say the below
advice....

On Fri, 2011-10-07 at 15:38 -0400, John B. Brodie wrote:
> 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.

also avoid reserved words in your parser's target language as rule
names. the generated parser code won't compile...

> 
> 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
> 
> 
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address





More information about the antlr-interest mailing list