[antlr-interest] Dynamic AST node
Jim Idle
jimi at temporal-wave.com
Fri Sep 4 09:38:05 PDT 2009
Pass in the type as a parameter and use conditional rewrites or use
the parameter as the node type in the rewrite.
Jim
On Sep 4, 2009, at 12:09 AM, Elnur Cabarov <elnur.j at gmail.com> wrote:
> Hi,
>
> I've got a rule that is called from multiple other rules. I want
> dynamically modify AST node for every invocation.
>
> For example:
>
> variable
> : type ID -> ^(VARIABLE type ID);
>
> I want VARIABLE node be dynamic, that is it can also be PARAMETER
> when called from somewhere else.
> My case is not as simple as this, so duplicating rules is not
> acceptable.
> Also I'd prefer use dynamic attribute scopes, because rules are
> nested into many levels and rule attributes are not desirable too :)
>
> Thanks
>
> --
> Elnur Cabarov
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
More information about the antlr-interest
mailing list