OMeta Can Make Symbol Transformers
OMeta2 subclass: OMeta2Calculator () start = addExpr:e spaces [e]. addExpr = addExpr:x ("+" | "-"):op mulExpr:y [{op. x. y}] | mulExpr. mulExpr = mulExpr:x ("*" | "/"):op primExpr:y [{op. x. y}] | primExpr. primExpr = "(" addExpr:x ")" [x] | number | identifier. number = spaces <digit+>. identifier = spaces <letter (letter | digit)*>.
1 + 2 / 3 - 5
(a / b + 35) * (6 + m) / a * P
Do It
Alex Warth
OMeta Can Make Symbol Transformers