[antlr-interest] (newbie question) rewrite rule
Randall R Schulz
rschulz at sonic.net
Mon Jul 9 14:39:48 PDT 2007
On Monday 09 July 2007 13:53, ali azimi wrote:
> Hi,
>
> 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)?)*')'
This right-hand-side allows an arbitrary sequence of nothing but commas
following the initial expression. Is that what you want?
If not, change it to this:
actualparameters
:lc = '(' expression ? ( ',' expression ) * ')'
> ->^(SLIST[$lc] (expression?)*)
> ;
>
> ...
>
> AL
By the way, why are you so sparing with whitespace? ANTLR grammars are
hard enough to read as it is, but cramming everything together just
makes it harder.
Randall Schulz
More information about the antlr-interest
mailing list