android13/external/antlr/runtime/CSharp3/Sources/Antlr3.Runtime.Test/Composition/Simplify.g3

21 lines
363 B
Plaintext

tree grammar Simplify;
options {
tokenVocab=VecMath;
ASTLabelType=CommonTree;
output=AST;
language=CSharp3;
filter=true;
//rewrite=true;
}
@namespace{Antlr3.Runtime.Test.Composition}
topdown
: ^( MULT INT ^(VEC (e+=.)+) ) -> ^(VEC ^(MULT INT $e)+)
;
bottomup
: ^(MULT a=. b=INT {$b.int==0}?) -> $b // x*0 -> 0
;