ometa Calc { digit ::=
:c ?[c isDigit] => [c digitValue]. number ::=
:n
:d => [n * 10 + d] |
. priExpr ::=
| "("
:e ")" => [e]. mulExpr ::=
:x "*"
:y => [{'*'. x. y}] |
:x "/"
:y => [{'/'. x. y}] |
. addExpr ::=
:x "+"
:y => [{'+'. x. y}] |
:x "-"
:y => [{'-'. x. y}] |
. expr ::=
. }.
A Calculator in Tile
Drop a tile to the expression.
drop here
=
answer
Unit test
http://tinlizzie.org/svn/trunk/jstile/