[antlr-interest] Operator tree construction in rewrite syntax

Thomas Brandon tbrandonau at gmail.com
Mon Apr 14 13:46:13 PDT 2008


I think you can do something like (syntax not checked):
sum: s1=something -> $s1 (Plus s2=something -> ^(Plus $sum $s2) )*;
I'm not sure if you need the first rewrite or whether it will already
have it when you use $sum (the previously constructed tree for the
rule).

Tom.
On Tue, Apr 15, 2008 at 5:08 AM, Marko Simovic <markobarko at gmail.com> wrote:
>
> Hi all,
>
> Quick question (i hope). What is the equivalent to the following using the rewrite (->) syntax:
>
> sum: something (Plus^ something);
>
> Thanks,
> Marko
>
>
>


More information about the antlr-interest mailing list