[antlr-interest] How to modify parent of currently parsed subtree?

Jörg Rathlev joerg at jrsoftware.de
Mon May 29 03:10:05 PDT 2006


Hi,

> your example will not work because the parent AST is constructed 
> AFTER all of its child nodes! So there cannot be any method to access
> the parent AST within a child node ...

ahh, now I realize my mistake. I actually pushed the source AST onto the
stack, not the generated one. Of course that couldn't work.

> Try it the other way round: Just push the declaration of the 
> temporary variable to the stack, and include it explicitly while
> generating the parent AST. That worked for me.

Yes, that should work. Thanks a lot for your help!


Regards,
Joerg



More information about the antlr-interest mailing list