[antlr-interest] very simple doubt about EXPR grammar

Kevin J. Cummings cummings at kjchome.homeip.net
Wed Oct 13 11:14:20 PDT 2010


On 10/13/2010 01:29 PM, Leonardo K. Shikida wrote:
> Hi
> 
> This is something stupid, I guess. I have a grammar like this below
> and I would like to know why
> 
> "1+1-1" works
> 
> and
> 
> "1-1+1" does not work (NoViableAltException)

NoViableAltException is thrown in your stat rule when it can't predict
an INT, ID, (, or NEWLINE in the lookahead.  Does your test case end in
a NEWLINE?

> Thanks
> 
> Leo K.

-- 
Kevin J. Cummings
kjchome at rcn.com
cummings at kjchome.homeip.net
cummings at kjc386.framingham.ma.us
Registered Linux User #1232 (http://counter.li.org)


More information about the antlr-interest mailing list