Nevermind, answered my own question with some dim memories and some playing
around.
On Aug 26, 2011, at 11:15 , Bill Andersen wrote:
> Hi all...
>
> I have the following production alternative:
>
> | ^(ASTERISK e1=unary_expression e2=unary_expression)
>
> and want to use templates that look like this in my STG:
>
> app2(op,e1,e2) ::= "<op>(<e1>,<e2>)"
>
> op_ASTERISK() ::= "mult"
>
> Question is - if I want to keep the translation of ASTERISK in the STG, how
> do I express the template return in the alternative above. E.g.,
>
> | ^(ASTERISK e1=unary_expression e2=unary_expression)
> -> app2(op=???, e1={$e1.st}, e2={$e2.st})
>
> What goes in the place of ??? to cause op_ASTERISK() to be inserted into the
> resulting ST?
The answer is:
-> app2(op={%op_ASTERISK()}, e1={$e1.st}, e2={$e2.st})
Could not find this in any doc to save my life, but the generated code is
correct.
>
> Using ANTLR 3.3 / ST 3...
>
> Thanks
>
> .bill
>
>
>
> 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.