[antlr-interest] advice for grammar modification

José María García Rodríguez darthia at gmail.com
Thu Aug 11 12:27:03 PDT 2005


> > > rulename : { boolean doit = false; }
> > >          ( rules {doit=true;} )*
> > >          { if(doit) {actions;} }
>
> > 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.
>

That's weird, because I didn't receive this answer in my mail. Is
there any problem with the list, or it's my fault? Anyway, you're
welcome, Daniel :)

> Readability is subjective, certainly, but it seems that the ANTLR-only
> version is clearer because it's using ANTLR to control flow, rather
> than requiring action blocks to do something that is built into the
> ANTLR language - something that you must already know if using
> ANTLR....
>
> But that's just me :-)
>

Sure, readability is subjective. But you're using actions anyway, and
I find the ()* construction more readable than the (()+)? one. That's
why I choose the former. Maybe using only ANTLR language it's more
elegant. But, again, each to his own ;)

Regards
--
José María García Rodríguez


More information about the antlr-interest mailing list