[antlr-interest] Grammar design question

Terence Parr parrt at jguru.com
Wed Oct 9 10:11:48 PDT 2002


On Wednesday, October 9, 2002, at 09:45  AM, Reid Rivenburgh wrote:

> 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?

I would suggest doing just a simple loop that lets any match (i.e., be 
loose).  Then use an action to determine if the semantics are right. :)

Ter
--
Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org
Lecturer in Comp. Sci., University of San Francisco


 

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



More information about the antlr-interest mailing list