In your partial class file that accompanies your grammar, you should add the
following function override:
partial class MyTreeParser {
public override IAstRuleReturnScope Bottomup() { return bottomup(); }
}
Sam
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of DJB MASTER
Sent: Tuesday, July 12, 2011 10:38 PM
To: [email protected]
Subject: [antlr-interest] Tree pattern won't rewrite AST C#
Hey, I'm trying to apply simple tree patterns that can remove redundancy in
multiplication expressions, such as x*0 -> 0. However I can't get it to
rewrite my AST I feed in.
I'm using again >>>
http://media.pragprog.com/titles/tpdsl/code/IR/Vec/VecMathAST.g
and I'm using this as my simplifier >>
http://media.pragprog.com/titles/tpdsl/code/walking/patterns/Simplify.g.
I'm getting a correct AST because it's identical to what Terrance gets in
the LP book.
I'm using this code to call my simplifier...
CommonTree AST = (CommonTree)parser.statlist().Tree;
CommonTreeNodeStream nodes = new CommonTreeNodeStream(AST);
nodes.TokenStream = tokens;
Simplifier simplifier = new Simplifier(nodes); CommonTree AST =
(CommonTree)simplifier.Downup(AST, true);
But it seems to do nothing.
--
View this message in context:
http://antlr.1301665.n2.nabble.com/Tree-pattern-won-t-rewrite-AST-C-tp657761
4p6577614.html
Sent from the ANTLR mailing list archive at Nabble.com.
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
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.