[antlr-interest] (newbie question) rewrite rule
David Holroyd
dave at badgers-in-foil.co.uk
Mon Jul 9 14:06:25 PDT 2007
On Mon, Jul 09, 2007 at 01:53:19PM -0700, ali azimi wrote:
> The following rewrite rule does not produces any error messages. But
> do you think it is correct? Can I use (expression?)* in the following?
>
> actualparameters
> :lc='('expression?(','(expression)?)*')'
> ->^(SLIST[$lc] (expression?)*)
> ;
Since the grammar allows for zero or more occurances of 'expression' on
the left of the rewrite, you can just use 'expression*' on the right
hand side:
actualparameters
: lc='(' expression? ( ',' expression? )* ')'
-> (SLIST[$lc] expression*)
ta,
dave
--
http://david.holroyd.me.uk/
More information about the antlr-interest
mailing list