Created
June 27, 2012 13:30
-
-
Save fjolnir/3004079 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sum = a:Product { PushStack(a); } | |
( - "+" - b:Product { ReplaceStackTop([TQNodeOperator nodeWithType:kTQOperatorAdd left:StackTop right:b]); } | |
| - "-" - b:Product { ReplaceStackTop([TQNodeOperator nodeWithType:kTQOperatorSubtract left:StackTop right:b]); } | |
)* { $$ = PopStack(); } | |
Product = a:Variable { PushStack(a); } | |
( - "*" - b:Product { ReplaceStackTop([TQNodeOperator nodeWithType:kTQOperatorMultiply left:StackTop right:b]); } | |
| - "/" - b:Product { ReplaceStackTop([TQNodeOperator nodeWithType:kTQOperatorDivide left:StackTop right:b]); } | |
)* { $$ = PopStack(); } | |
Equation = a:Sum { PushStack(a); } | |
( - "<" - b:Equation { ReplaceStackTop([TQNodeOperator nodeWithType:kTQOperatorLesser left:StackTop right:b]); } | |
| - ">" - b:Equation { ReplaceStackTop([TQNodeOperator nodeWithType:kTQOperatorGreater left:StackTop right:b]); } | |
| - "<=" - b:Equation { ReplaceStackTop([TQNodeOperator nodeWithType:kTQOperatorLesserOrEqual left:StackTop right:b]); } | |
| - "=>" - b:Equation { ReplaceStackTop([TQNodeOperator nodeWithType:kTQOperatorGreaterOrEqual left:StackTop right:b]); } | |
| - "==" - b:Equation { ReplaceStackTop([TQNodeOperator nodeWithType:kTQOperatorEqual left:StackTop right:b]); } | |
| - "!=" - b:Equation { ReplaceStackTop([TQNodeOperator nodeWithType:kTQOperatorInequal left:StackTop right:b]); } | |
)* { $$ = PopStack(); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment