[antlr-interest] Transforming trees: modify input tree

Monty Zukowski monty at codetransform.com
Wed Apr 21 11:48:41 PDT 2004


Well, do you mind #line directives?  If not you could have all your 
newly created or moved nodes set to a new filename, which would give 
you another range of line numbers.

The TNode stuff has all the hooks for double linking, but you have to 
maintain the links yourself.  So if you move a node around in a tree 
you have to fix up the back links manually.  ANTLR's tree manipulation 
stuff currently has no hooks for maintaining backwards links.

Monty

On Apr 21, 2004, at 10:53 AM, Adrian Tineo wrote:

> Thanks for your answer Monty.
>
> I'd prefer to keep the proper line number with the nodes rather than 
> modifying
> the new line behaviour of the emitter, I think it is more organized 
> and that
> it could grow better.
>
> Nevertheless, I have been thinking about ways of handling the tree. I 
> am
> currently trying to write a transform-treeparser in a by-hand fashion 
> because
> I need to move freely in the tree and not only with the subtrees 
> resulting
> from rules.
>
> My approach is to get certain kinds of nodes with findAllPartial and 
> exchange
> nodes as needed. This way I also get freedom to update line numbers as 
> I go.
>
> I am going to need the double-linked facility of the TNode class 
> provided to
> go back and forth from certain nodes, but from what I read is 
> "currently
> incomplete". What do I need to add/change to implement it?
>
> Thanks for your support, and great work with the parsing and tree
> generation ;=)



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list