ANTLR expressions rewrite intermediate tree
- by user313856
For expressions like 3+4 I would like to use the value 7 in an intermediate representation tree.
I cannot work out how to get the returns value into a rewrite rule.
expression returns [int v]:
etc.
How do I get expression.v into WR? At the moment I get (+ 3 4), I want (7)
|^( WRITE c=expression) - ^(WRINT ^(INTC ^($c))
the next step is to emit 7 in an assembler.