[antlr-interest] syn pred / lookahaed doesn't work

Gunnar Wagenknecht kreismeister at yahoo.de
Tue Mar 11 11:26:20 PST 2003


Hi!

I have a grammar where the syn. pred. doesn't seem to work. I can 
post the whole grammar but the following example should be ok to 
recognize the problem.

compilationUnit : statementList (function)*;

function : ("static"|"init"|"exit")? "function" identName crlf
           statementList;

identName : IDENTIFIER;

crlf : SEMICOLON | NEWLINE;

statementList: (statement)*;  // <<< here I get non-determinisme 
                              // warning upon
                              // k=1 "static"|"exit"
                              // k=2 
IDENTIFIER|"function"|NEWLINE|SEMICOLON

statement: ...
         | variableDeclaration
         | ...
         | "exit" crlf
         | ...
         ;

variableDeclaration : ("public"|"private"|"local"|"static") identName 
crlf;


I tried to reslove things with syn. pred. but whatever I do I 
couldn't remove the warning. The generated parser also doen't work 
correct.

What can I do to resolve the warning?

Thanks, Gunnar


 

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



More information about the antlr-interest mailing list