smalltalk-tng
view etng-r2/calc.tng @ 321:c4a0718c2d3c
Sketch of dependencies
| author | Tony Garnock-Jones <tonygarnockjones@gmail.com> |
|---|---|
| date | Sat Oct 08 15:36:03 2011 -0400 (7 months ago) |
| parents | |
| children |
line source
1 define expr = {
2 number:n1 "+" expr:n2 -> n1 + n2;
3 };
5 define number = {
6 spaces digit+:digits -> digits |listToString |stringToNumber;
7 };
9 define token xs -> {
10 spaces <{xs}>;
11 };
13 define digit = {
14 c -> (charNumeric c) { .true -> c; .false -> error("expected", "charNumeric", c); };
15 };
17 spaces = {
18 (c -> (charWhitespace c) { .true -> c; .false -> error("expected", "charWhitespace", c) };)+
19 spaces;
21 $- $- ...
23 -> #t;
24 };
27 expr 1 + 2 + 3;
