[antlr-interest] Parse-trees (not ASTs)
Paul J. Lucas
dude at darkfigure.org
Wed Sep 8 20:07:04 PDT 2004
I want to be able to construct parse trees and not ASTs. For
example, if I have:
letExpr
: LET varRef ASSIGN expr ;
varRef
: DOLLAR IDENT ;
expr
: /* yadda, yadda */ ;
I want a tree like:
letExpr
|
+-- LET -- varRef -- ASSIGN ------ expr
| |
+-- DOLLAR -- IDENT +-- ...
That is: letExpr has LET, varRef, ASSIGN, and expr as children;
varRef is the root of a subtree that has DOLLAR and IDENT as
children; and so on.
Another example:
factor
: expr STAR^ expr ;
I want the tree:
factor
|
+-- expr -- STAR -- expr
| |
+-- ... +-- ...
and not the one that ANTLR would create for an AST where STAR is
the root of the subtree.
Is there a way to get what I want?
- Paul
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