Hello,

I'm working on a tree grammar that needs to perform some tree rewriting 
for a further tree parsing phase.

My question is, is it possible to do something like this (semi pseudo-code):

r : ^(SOME_NODE x y)
      -> ^(SOME_NODE x y
                 { // action
                 // for loop iterates over a data structure getting info 
and inserting it into a new subtree
                 for(every item in data structure) {
                     add new subtree ^(MY_NEW_SUBTREE item)
                 }
                 }
             ) // tree rewrite ends here
     ;

where the rewritten tree will have a new subtree created from each 
iteration of the loop. I suppose what I want is to dynamically build new 
subtrees of the resulting rewritten tree for the rule.

The above is invalid ANTLR syntax but I'm wondering whether this is 
possible somehow. I would rather use ANTLR's friendly tree building 
syntax as above (i.e. ^(MY_NEW_SUBTREE item) ); I don't want to have to 
'manually' build the tree inside the action (using ANTLR's tree building 
API) if I can help it. There might even be a simpler method of doing 
this that I've missed...

Thanks,
Stephen

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to