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

mzukowski at yci.com mzukowski at yci.com
Tue Mar 11 11:33:32 PST 2003

There's not quite enough information there to see what the problem is.  Be
sure to inspect the generated code to see what antlr is "thinking".  This
can often help you decide where a syntactic predicate is needed.

Sometimes there are true ambiguities, such as the classic if/else ambiguity.
Antlr warns about that but handles it properly too.  There should be
something about that in the docs about ambiguites.


-----Original Message-----
From: Gunnar Wagenknecht [mailto:kreismeister at yahoo.de]
Sent: Tuesday, March 11, 2003 11:26 AM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] syn pred / lookahaed doesn't work


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

identName : IDENTIFIER;


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

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

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

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 

What can I do to resolve the warning?

Thanks, Gunnar


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