[antlr-interest] advice for grammar modification
Daniel Zuberbuehler
dzubi at users.sourceforge.net
Thu Aug 11 11:03:57 PDT 2005
On Thursday 11 August 2005 17:41, José María García Rodríguez wrote:
> > ---------------------------------------
> > < rulename : ( rules... )*
> > < { actions; }
> > < ;
> >
> > > rulename : ( ( rules... )+
> > > { actions; } )?
> > > ;
>
> This is correct, but to me the next approach sounds better:
> > rulename : { boolean doit = false; }
> > ( rules {doit=true;} )*
> > { if(doit) {actions;} }
>
> It's like the last rule you show, and I find it clearer.
>
> Regards
Thanks for your answer!
You're right, the readability is better in the variant with the boolean.
I'll take that in account for my future work.
Cheers, Daniel
More information about the antlr-interest
mailing list