[antlr-interest] Recursive statement in parser causes non-determinism error...

Terence Parr parrt at cs.usfca.edu
Wed Jan 21 12:07:43 PST 2004


On Wednesday, January 21, 2004, at 07:10 AM, Anthony Youngman wrote:

> Help! I'm sure there must be a simple option for this ...
>
> statement_line : (statement ( SEMI! statement)* ) ;
> statement : ( ifst ) ;
> ifst : ( "IF"^ expr THEN statement_line );
>
> So, statement_line can itself contain a statement_line, and antlr is
> objecting that when it hits the SEMI, it's non-deterministic, and
> presumably it doesn't know which statement_line the next statement
> belongs to. How do I tell the parser that the lowest-level
> statement_line is to be greedy and consume all statements until it hits
> something (such as an EOL) that doesn't parse as part of the
> statement_line.

Try using the greedy=true option and it will make antlr shut up :)

Ter
--
Professor Comp. Sci., University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Co-founder, http://www.jguru.com
Co-founder, http://www.knowspam.net enjoy email again!
Co-founder, http://www.peerscope.com pure link sharing




 

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