xref: /aosp_15_r20/external/antlr/runtime/ObjC/Framework/examples/polydiff/PolyPrinter.g (revision 16467b971bd3e2009fad32dd79016f2c7e421deb)
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