1
0
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
393 B

tree grammar PolyPrinter;
options {
tokenVocab=Poly;
language=ObjC;
ASTLabelType=CommonTree;
output=template;
}
poly: ^('+' a=poly b=poly) -> template(a={$a.st} b:b={$b.st}) "<a>+<b>"
| ^(MULT a=poly b=poly) -> template(a={$a.st} b:b={$b.st}) "<a><b>"
| ^('^' a=poly b=poly) -> template(a={$a.st} b:b={$b.st}) "<a>^<b>"
| INT -> {%{$INT.text}}
| ID -> {%{$ID.text}}
;