[antlr-interest] Re: nondeterminism question

Klaas Hofstra antlr at klaashofstra.com
Mon Sep 5 11:01:46 PDT 2005


Hi all,

Just to let you all know, Bill pointed out the solution to my problem. By 
adding "options {greedy=true;}" to my typeDef rule as shown below, all was 
well again in parser land.

typeDef
     : "signed"
     | "unsigned"
     | "float"
     | ("integer" ( options {greedy=true;} : LPAREN! INT DOTDOT! INT 
RPAREN! )? )     
     ;

These nondeterminism problems can be quite baffling for the novice antlr user. 
Wouldn't the wiki be a great place to educate users about the peculiarities 
of "linear approximate" lookahead? 

Cheers,

Klaas


More information about the antlr-interest mailing list