[antlr-interest] Re: unexpected nondeterminism...

Mark markl at glyphic.com
Sat Mar 27 12:55:49 PST 2004


--- In antlr-interest at yahoogroups.com, Terence Parr <parrt at c...> wrote:
> Hi.  I think this is a limitation of the linear approximate lookahead 
> not your understanding.  

> My suggestion is to just leave it and add "options { 
> greedy=true; } :" to the subrule (OP)? so that you can inform ANTLR you 
> intended to do this.  It will obediently shut up and do the right 
> thing. :)

Actually, I had to add it to the (OP term)* rule:

expression: term ( options{greedy=true;}: OP term )* ;
statement:  expression ( assignment )? ;
assignment: ( OP )? AOP expression ;

This works and does the right thing, based on reading the code of the generated parser.

Actually, you were right, w/o the greedy=true, the generated parser does exactly the same 
thing, so the option just quells the warning.... Which I like, since I'm one of the those 
"must-compile-without-a-single-warning" kinda programmers!

> Sorry for the hassle.
Not at all!  Antlr is saving so much time on my project (Wheat), I can hardly complain 
about the occasional quirkyness.  Thank you for the wonderful tool.

- Mark
Mark Lentczner
markl at wheatfarm.org
http://www.wheatfarm.org/



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

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



More information about the antlr-interest mailing list