[antlr-interest] Simple Tree Rewrite help

Tim Williams williamstw at gmail.com
Wed Jul 29 08:38:47 PDT 2009


Answering my own question, kinda.  Here's what works[1], still
noodling through exactly *why* it works:)

query: LPAREN (expr->expr) ((OR_TOK e=expr) -> ^(OR $query $e))+ RPAREN


--tim

[1] - p174, TDAR

On Wed, Jul 29, 2009 at 11:25 AM, Tim Williams<williamstw at gmail.com> wrote:
> I'm trying to get a tree rewrite version of something like this:
>
> query:  LPAREN! expr (OR_TOK^ expr)+ RPAREN!;
>
> This seems to do what I want, but I need a tree rewrite version so
> that I can send something other than OR_TOK as the root, namely an
> normalized "OR" token.  I've tried:
>
> -> ^(OR expr expr)+;
>
> with no luck.
>
> Any help appreciated,
>
> Thanks,
> --tim
>


More information about the antlr-interest mailing list