equal
deleted
inserted
replaced
|
1 define expr = { |
|
2 number:n1 "+" expr:n2 -> n1 + n2; |
|
3 }; |
|
4 |
|
5 define number = { |
|
6 spaces digit+:digits -> digits |listToString |stringToNumber; |
|
7 }; |
|
8 |
|
9 define token xs -> { |
|
10 spaces <{xs}>; |
|
11 }; |
|
12 |
|
13 define digit = { |
|
14 c -> (charNumeric c) { .true -> c; .false -> error("expected", "charNumeric", c); }; |
|
15 }; |
|
16 |
|
17 spaces = { |
|
18 (c -> (charWhitespace c) { .true -> c; .false -> error("expected", "charWhitespace", c) };)+ |
|
19 spaces; |
|
20 |
|
21 $- $- ... |
|
22 |
|
23 -> #t; |
|
24 }; |
|
25 |
|
26 |
|
27 expr 1 + 2 + 3; |