[antlr-interest] advice for grammar modification

José María García Rodríguez darthia at gmail.com
Thu Aug 11 08:41:49 PDT 2005


> ---------------------------------------
> < 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
-- 
José María García Rodríguez


More information about the antlr-interest mailing list