[antlr-interest] Simple nondeterminism help

Arnar Birgisson arnarb at oddi.is
Sun Oct 19 10:47:18 PDT 2003


Perhaps have CAPITALLETTER and LOWERCASELETTER as parser rules and add

protected letter: CAPITALLETTER | LOWERCASELETTER;

as a parser rule. Does that solve your problem?

The task of lexical analyzing should be as decoupled from parsing as
possible, and only in the parsing stage do you have enough information
and context to know if you are expecting an upper-case letter or just
any letter.

Arnar

> -----Original Message-----
> From: Nico [mailto:nico123 at adinet.com.uy] 
> Sent: 18. október 2003 21:55
> To: antlr-interest at yahoogroups.com
> Subject: Re: [antlr-interest] Simple nondeterminism help
> 
> 
> If I add protected keyword to CAPITALLETTER the 
> nondeterminism is gone.
> But, I want to call CAPITALLETTER also from a parser rule. If I add
> protectect
> keyword it cannot be seen by the parser right?
> 
> ----- Original Message ----- 
> From: "Terence Parr" <parrt at cs.usfca.edu>
> To: <antlr-interest at yahoogroups.com>
> Sent: Saturday, October 18, 2003 12:08 AM
> Subject: Re: [antlr-interest] Simple nondeterminism help
> 
> 
> 
> On Friday, October 17, 2003, at 06:34  PM, Nico wrote:
> 
> > Hi, I need some help in this undeterminism.
> >
> >
> > LETTER: CAPITALLETTER | ('a'..'z');
> > CAPITALLETTER: ('A'..'Z');
> >
> > How do I solve this?
> 
> Add "protected" keyword in front of second rule.
> 
> Terence
> 
> >
> >
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
> --
> 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 link sharing, pure-n-simple
> 
> 
> 
> 
> 
> 
> 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/ 
> 
> 


 

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




More information about the antlr-interest mailing list