|JJTree in JavaCC generates Parse Tree, not AST ?? email@example.com (John Davis) (2002-11-06)|
|Re: JJTree in JavaCC generates Parse Tree, not AST ?? firstname.lastname@example.org (Arnaud Clère) (2002-11-12)|
|From:||"Arnaud Clère" <email@example.com>|
|Date:||12 Nov 2002 14:13:43 -0500|
|Organization:||Guest of ProXad - France|
|Posted-Date:||12 Nov 2002 14:13:43 EST|
I am not sure to understand the difference between Parse Tree and AST in
your terminology. I just wanted to say that JJTree will produce by default a
tree which matches exactly the productions in your grammar (looks like the
Parse Tree you mentioned), but that you can easily modify the generated tree
by decorating your grammar with JJTree directives like #void (do not
generate a Node for this production), #NodeType (unconditionaly generate a
NodeType node corresponding to the current production or clause scope),
#ConditionalNode(2) (generate a ConditionalNode whenever there are 2
children available), etc...
That will certainly enable you to produce what you're calling your AST. You
can find a lot of details and examples into JJTree documentation embedded
with the product.
"John Davis" <firstname.lastname@example.org> wrote in message
| I want to confirm if JJTree in JavaCC generates Parse Tree (Concrete
| Syntax Tree), not AST (Abstract Syntax Tree)???
| But the 84 classes for each non-terminal node (ASTXXX.java) represents
| the AST node then??
| I am not sure how to change the grammar in order to produce an AST,
| not Parse Tree.
Return to the
Search the comp.compilers archives again.