• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1tree grammar PolyPrinter;
2options {
3	tokenVocab=Poly;
4    language=ObjC;
5	ASTLabelType=CommonTree;
6	output=template;
7}
8
9poly:	^('+'  a=poly b=poly)	-> template(a={$a.st} b:b={$b.st}) "<a>+<b>"
10	|	^(MULT a=poly b=poly)	-> template(a={$a.st} b:b={$b.st}) "<a><b>"
11	|	^('^'  a=poly b=poly)	-> template(a={$a.st} b:b={$b.st}) "<a>^<b>"
12	|	INT						-> {%{$INT.text}}
13	|	ID						-> {%{$ID.text}}
14	;
15