[antlr-interest] nondeterminism warning?
dima
dimax at gmx.de
Fri Jan 27 07:15:52 PST 2006
>
>
> To understand this warning you have to be very familiar with "linear
> approximate lookahead".
>
> In your case, antlr needs to compute exit branch to know when to leave a
> loop, and it will use linear approximate lookahead(instead of full
> LL(K)) to do that. Normally there are several exit paths for a rule, for
> example:
> "[ assembly {"
> and "[ xxx :"
>
> With linear approximate lookahead, antlr will compress them so you get
> the warning for "[ assembly :".
>
Many thanks Xue Yong Zhi!
It's 100% what you written.
My generated c_unit method has two if statements:
1. if((LA(1)==LBRACK) && (LA(2)==ASSEMBLY) && (LA(3)==COLON))
{
global_attributes();
}
....
2. if((LA(1)==CLASS || LA(1)==LBRACK))
{
class_declaration();
}
Both of them are true for "[ assembly :". Therefore I get this warning!
Nevertheless works my parser correct, because the global attributes will
be consumed on the first statement.
So, over again
Many thanks!
Dima.
More information about the antlr-interest
mailing list