[antlr-interest] Quick ANTLR/ST question

Bill Andersen bill.andersen at mac.com
Fri Aug 26 11:15:45 PDT 2011


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?

Using ANTLR 3.3 / ST 3...

Thanks

	.bill




More information about the antlr-interest mailing list