[antlr-interest] Grammar design question

mzukowski at yci.com mzukowski at yci.com
Wed Oct 9 10:11:20 PDT 2002


No, it's not possible or if possible it's not practical.  

Recommended practice is to grammatically recognize all of them possibly
multiple times.  Then afterwards have action code which does your validation
and throws a (RecognitionException I think, or is there a
SemanticException?) if it's wrong.  If need be you can do some bookeeping
inside your closure to know, for instance, that the required ones were all
there.

Monty
www.codetransform.com

> -----Original Message-----
> From: Reid Rivenburgh [mailto:reidr at bigfoot.com]
> Sent: Wednesday, October 09, 2002 9:45 AM
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] Grammar design question
> 
> 
> Hi,
> 
> I have a question about grammar design that I haven't seen an answer
> to in my readings.  I may have just not put the pieces together
> (sorry!), or it may just not be easily doable.
> 
> I have a language where a set of 10 different tokens can occur at a
> given point.  The tricky part is that some of them can occur multiple
> times; some can occur only once; some are optional; and some are
> required.  On top of that, they can occur in any order.  Is it
> possible to represent this scenario in an ANTLR grammar?
> 
> Thanks,
> Reid
> 
>  
> 
> 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