[antlr-interest] Rewrite rule for multiple alternatives

Jan Obdrzalek obdrzalek at gmail.com
Thu Aug 2 05:46:18 PDT 2007


Hi,

what is the correct way to write this rewrite rule?

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

I.e. I want to have a tree with the root COMPOUND and with the children
given by the rules a,b,c in the original order. ANTLRv3 does not like my
intuitive notation :( And I do not want to change the grammar much. The
examples in the book are all a little bit different (unless I missed some).

Thanks for all suggestions,
    Jan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070802/db8938a5/attachment.html 


More information about the antlr-interest mailing list