[antlr-interest] Why and how exactly does ANTLR manage to fail on non recursive grammar for finite language?

Loring Craymer lgcraymer at yahoo.com
Wed Aug 12 16:04:14 PDT 2009


The EOF won't fix the ambiguity, but it will make ANTLR parse all of
PREFIX_1 PREFIX_2 SUFFIX SUFFIX
instead of just parsing
PREFIX_1 PREFIX_2 SUFFIX
(as per the "disabling" message) and then "mysteriously" dropping the second SUFFIX on the floor.

--Loring



----- Original Message ----
> From: Sam Barnett-Cormack <s.barnett-cormack at lancaster.ac.uk>
> To: Loring Craymer <lgcraymer at yahoo.com>
> Cc: Nikolay Ognyanov <nikolay.ognyanov at travelstoremaker.com>; Jim Idle <jimi at temporal-wave.com>; antlr-interest at antlr.org
> Sent: Wednesday, August 12, 2009 3:49:48 PM
> Subject: Re: [antlr-interest] Why and how exactly does ANTLR manage to fail on non recursive grammar for finite language?
> 
> Loring Craymer wrote:
> > Not true; your example can be interpreted either as
> > 
> > (expr1:  PREFIX_1 (expr2:  PREFIX_2 SUFFIX) SUFFIX )
> > 
> > or as
> > 
> > (expr1:  PREFIX_1 (expr2:  PREFIX_2) SUFFIX) SUFFIX
> > 
> > with the extra SUFFIX belonging to something else
> 
> So, hazarding a guess, would it be okay if expr was EOF-terminated?
> 
> -- Sam Barnett-Cormack


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the antlr-interest mailing list