[antlr-interest] Can't figure out the ambiguity leading to this unreachable token def
Dan
th30dan at gmail.com
Sun Apr 6 01:18:53 PDT 2008
Thanks Kamil.
But when you look at my grammar, doesn't the "expr" rule make it clear that
only the "VALUE" rule can match what's inside the single quotes?
Why do the lexer rules seem to ignore this obvious clarity provided by the
parser rule, and consider the grammar ambiguous?
-Dan
On Sun, Apr 6, 2008 at 3:06 AM, Kamil Burzynski <nopik at data.pl> wrote:
> Hello,
>
> Dan wrote:
>
> > NAME: ('a'..'z' | 'A'..'Z' | '0'..'9')+;
> >
> > VALUE: ('a'..'z' | 'A'..'Z')+;
> >
>
> If lexer will see 'hi' in the input, it should produce NAME or VALUE?
> This is the ambiguity, so ANTLR disabled second alternative (VALUE),
> leaving only NAME. I think that if you would look into generated source
> code, you would confirm that.
>
> --
> Best regards from
> Kamil Burzynski
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080406/16a7c658/attachment.html
More information about the antlr-interest
mailing list