[antlr-interest] Rewrite rule for multiple alternatives

Gavin Lambert antlr at mirality.co.nz
Thu Aug 2 05:59:26 PDT 2007


At 00:46 3/08/2007, Jan Obdrzalek wrote:
>what is the correct way to write this rewrite rule?
>
>    :    '{' (a | b | c)* '}'  -> ^(COMPOUND (a | b | c)*)

Haven't tried it, but this ought to work:

x : '{' y* '}' -> ^(COMPOUND y*);
y : a | b | c;



More information about the antlr-interest mailing list