[antlr-interest] Rewriting trees

Monty Zukowski monty at codetransform.com
Fri Nov 26 07:51:18 PST 2004


Terence Parr wrote:
> 
> On Nov 26, 2004, at 2:33 AM, Maassen, H.A.M. wrote:
> 
> 
>>Ok I'm stumped.. I've looked through the manual, the FAQ, but I can't 
>>figure out how to reorder trees using a treeparser.. why won't this 
>>work:
>>
>>rule: "if" // ignore subtrees for now
>>      { ## = #([VIRT,"IF STATEMENT"], ##); }
>>    ;
>>
>>How do I tell the treewalker to just copy subtrees without having to 
>>describe their exact structure?
>>
>>rule: #("if" (.)*)  // this doesn't work :(
>>    ;
>>
>>Am I missing anything? Is it right under my nose? I know it can't be 
>>this difficult...
>>Are there any tree-reordering examples out there? The ones I 
>>downloaded from ANTLR.org don't rewrite but rather generate code or 
>>calculate expressions or something else unrelated...
> 

Note that the tree parser builds trees as it parses.  If it doesn't 
parse -- like when you use "." -- then it will not build that tree.

Monty


 
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