[antlr-interest] Rewriting trees
Terence Parr
parrt at cs.usfca.edu
Fri Nov 26 08:52:24 PST 2004
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...
Howdy. First rule of using antlr: what does the generated parser look
like? Second, do you have builtAST on in the tree grammar?
:)
Ter
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!
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