James
| number term prod prim start |
number := #digit asParser plus flatten ==> [ :str | str asNumber ].
term := PPDelegateParser new.
prod := PPDelegateParser new.
prim := PPDelegateParser new.
term setParser: (term memoized , $+ asParser trim , prod ==> [ :nodes | nodes first + nodes last ]) / prod.
prod setParser: (prim , $* asParser trim , prod ==> [ :nodes | nodes first * nodes last ]) / prim.
prim setParser: ($( asParser trim , term , $) asParser trim ==> [ :nodes | nodes second ]) / number.
start := term end.
start parse: '1 + 2'