[antlr-interest] AST Tree generation question
Roberto Attias
Roberto.Attias at arc.com
Wed Dec 12 00:26:55 PST 2007
In an expression grammar derived from one of the examples I have the
following rule:
additive_expression
: (multiplicative_expression) ('+^' multiplicative_expression | '-'^
multiplicative_expression)*
;
When parsing a+b", this generates a tree as expected. Now ,I want to
have OP_ADD or OP_SUB as radix of the tree when evaluating a+b or a-b.
I'm not entirely sure how to do that. Is there a way to indicate that a
different token should be used in the inlined syntax? If not, how to do
this with rewrite rules?
I've tried different combinations, but can't get this to work...
Thanks,
Roberto
Unless otherwise expressly stated, this message does not create or vary any contractual relationship between you and ARC International. The contents of this e-mail may be confidential and if you have received it in error, please delete it from your system, destroy any hard copies and telephone the above number. Incoming emails to ARC may be subject to monitoring other than by the addressee. SJ
More information about the antlr-interest
mailing list