[antlr-interest] Why and how exactly does ANTLR manage to fail on non recursive grammar for finite language?
Nikolay Ognyanov
nikolay.ognyanov at travelstoremaker.com
Wed Aug 12 15:57:25 PDT 2009
Well, there is nothing else that the extra SUFFIX can belong to
according to the
grammar so this is not derivation/parsing of the statement per the grammar.
Regards
Nikolay
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
>
> --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
>
>
>
--
*Nikolay Ognyanov, PhD*
Chief Technology Officer
*TravelStoreMaker.com Inc.* <http://www.travelstoremaker.com/>
Phone: +359 2 933 3832
Fax: +359 2 983 6475
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090813/eccec001/attachment.html
More information about the antlr-interest
mailing list