hello list,
i am having trouble constructing my ASTs. i learned how to construct a parse
tree from the book Language Implementation Patterns. in pseudo code, it
looks like this:
func rule:
node = RuleNode('rule_name')
if root is null: root = node
else: current_node.add_child(node)
save = current_node
current_node = r # descend
# now rule code
# goes here
current_node = save # restore
(TokenNodes are created in the match function of the parser) the previous
works fine for constructing a parse tree. but i'm having trouble with an
AST. consider for example the AddNode with the prototype:
AddNode(right_expr, plus, left_expr)
i can't really follow the template above here. the contructor requires
right_expr and the left_expr, which i only get after parsing. i was
wondering how it is usually done in this case.
thanks a lot in advance :)
--
victor
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.