following: [antlr-interest] learning pitfall....

Lloyd Dupont lloyd at galador.net
Wed Apr 3 14:02:20 PST 2002


ok, thanks, I am surprised that ANTLR make such a mistake, thanks.


>
> As the error says it's the importDefinition rule antlr is worried about.
>
> identifierStar
> : IDENT
> ( DOT^ IDENT )*
> ( DOT^ STAR  )?
> ;
>
> The appearance of 'statement' (which may start with IDENT) as an alt in
the
> 'script' rule puts IDENT into the k=2 lookahead set for the (DOT IDENT)
> alternative.  It now thinks it sees non-determinism between another go at
> (DOT IDENT) and moving on (even though it isn't actually any!).  This is
the
> limitation of linear approximate LL(k) rather than the real thing (I'm
sure
> there's lots more on this in the FAQ).
>
> Now that you know the non-det warning is false alarm (the grammer does
> actually match statements and imports as you expected) you can disable the
> warning for the identifierStar rule, and all is well.
>
> John
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list