[antlr-interest] Re: ANTLR meta-syntax question

jsrs701 jsrs701 at yahoo.com
Tue May 14 00:03:37 PDT 2002

--- In antlr-interest at y..., mzukowski at y... wrote:
> ANTLR requires the parenthesis.  It makes it easier to associate 
> with the proper construct, e.g. inside or outside of the ()+ 

Hi Brian,

Since you're new to ANTLR, that might not make much sense without an 
example, though it's a very good answer.

A: ( B )+ ;

That seems redundant, sure.  But what about when you add the actions 
that Monty mentioned?

A: ( B { /* do something with this particular B */ } )+
   { /* do something with the group of matched B's */ }

How would you do that without the parentheses?

ANTLR just requires them, whether or not the actions are there.  Such 
is life.  But I've found that I end up using the parentheses a lot 
more than I first expect once I start assigning actions.



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

More information about the antlr-interest mailing list