[antlr-interest] saving, duplicating and substituting tree nodes in the C API
David Minor
dahvid.minor at gmail.com
Sun Sep 6 03:57:00 PDT 2009
I'm working on a language that allows assignment of functions to variables.
Something like this.
fun = execute(params);
Later in the same scope if I want to do.
another_fun = fun
The most natural way to do this seems to me to save the tree from the first
execute(params) in a symbol table
and then, while generating the AST, when I see that "fun" is defined, to
substitute a duplicate of it's tree for the assignment to another_fun.
The trouble is the symbol table is in C world not Antlr. It looks like I
could just duplicate the node save
the pointer and then re-use it, but I don't see any examples of how to do
this.
Does anyone have an idea? Even a Java example would be helpful.
Regards,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090906/0bad1cf6/attachment.html
More information about the antlr-interest
mailing list