[antlr-interest] Removing nondeterminism

Terence Parr parrt at jguru.com
Mon Sep 16 12:05:27 PDT 2002

On Monday, September 16, 2002, at 11:54  AM, shyamgopale wrote:

> Hi,
>   I have a grammar rule like
> exprlist: expr (COMMA expr)* (COMMA)?;
>   This rule obviously gives me a nondeterminism
> warning. Is there any way to remove this warning
> by restructuring this rule.

I suggest setting k>1 and then setting greedy=true for the (...)* loop 
to shut it up and make it always grab comma followed by start of expr.  
THis will work unless exprList can be followed by an Expr. No fuss no 
muss! :)

Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org


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

More information about the antlr-interest mailing list