[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 15:41:07 PDT 2009


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

--Loring



>
>From: Nikolay Ognyanov <nikolay.ognyanov at travelstoremaker.com>
>To: Jim Idle <jimi at temporal-wave.com>
>Cc: antlr-interest at antlr.org
>Sent: Wednesday, August 12, 2009 3:28:16 PM
>Subject: Re: [antlr-interest] Why and how exactly does ANTLR manage to fail on non recursive grammar for finite language? 
>By definition a grammar is ambiguous if there is more than 1 way to
>derive at least one statement.
>>This is not the case here. There is only 1 way to derive the offending
>statement
>
>>PREFIX_1 PREFIX_2 SUFFIX SUFFIX
>
>>And it would take the procedure for expr2 just about 3 tokens lookahead
>to figure out what is the 
>>right thing to do. The question is why ANTLR does not do this?
>
>>Regards
>>Nikolay
>
>
> 


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090812/218b5027/attachment.html 


More information about the antlr-interest mailing list