[antlr-interest] Re: lexical nondeterminism warning

shmuel siegel antlr at shmuelhome.mine.nu
Thu Jan 5 14:49:20 PST 2006


Xue Yong Zhi wrote:
> Well, now you meet antlr's "linear approximate lookahead":)
> ............
> You may find my blog usefully as well:
> http://seclib.blogspot.com/2005/11/linear-approximate-lookahead.html
>
> Note: antlr may generate correct code even if it gives warnings, but 
> you have to read the generated code to be sure.
The example on your blog
RULE1: "ab" | "ba";

RULE2: "ac" | "ca" ;

illustrates a more annoying aspect of "linear approximate lookahead". 
Not only do you get "incorrect" ambiguity warnings, you also get 
incorrect code. The parser will think that RULE1 should match "aa" and 
when it doesn't, the parser throws a recognition exception. This happens 
even when there is a third rule that would match "aa".



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.13/221 - Release Date: 1/4/2006



More information about the antlr-interest mailing list