[antlr-interest] tree parsers and stacks
Terence Parr
parrt at cs.usfca.edu
Wed Nov 17 09:36:46 PST 2004
On Nov 15, 2004, at 12:24 PM, John Allen Green wrote:
> I haven't looked into the source, but is there an option in the tree
> parser generator so that the resulting parser keeps a stack of the head
> nodes, as the tree is descended? That would allow you to climb up the
> tree at any point within the tree parser, to find the enclosing
> expression, statement, function, etc. It might save you from some of
> the effort of writing actions in the grammar manually, for keeping
> stacks for scopes and whatnot.
>
> I'm using the tree parser for analysis, but not transforms, so I just
> use an AST with additional "back" and "up" links. So... I don't really
> need it, I'm just curious. :)
Hi John,
You could add the UP pointer yourself in a subclass and then change the
ast factory to set the up pointer maybe.
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