-
Notifications
You must be signed in to change notification settings - Fork 1
/
count5.eag
28 lines (22 loc) · 761 Bytes
/
count5.eag
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Same as count4.eag but without EBNF operators
N = | '1' N.
Z* = | Z '0' | Z '1' | Z '2' | Z '3' | Z '4' | Z '5' | Z '6' | Z '7' | Z '8' | Z '9'.
S <+ Z: Z>: A <N, N, Z>.
// This is the original rule from count4.eag
// A: { <+ '1' N: N, - '1' N1: N, + Z2: Z> 'a' INC<Z1, Z2> <N, N1, Z1> } <+ : N, - : N, + '0': Z>.
A <+ '1' N: N, - '1' N1: N, + Z2: Z>:
'a' INC <Z1, Z2> A<N, N1, Z1>.
A <+ : N, - : N, + '0': Z>:
.
INC:
<- : Z, + '1': Z>
| <- Z '0': Z, + Z '1': Z>
| <- Z '1': Z, + Z '2': Z>
| <- Z '2': Z, + Z '3': Z>
| <- Z '3': Z, + Z '4': Z>
| <- Z '4': Z, + Z '5': Z>
| <- Z '5': Z, + Z '6': Z>
| <- Z '6': Z, + Z '7': Z>
| <- Z '7': Z, + Z '8': Z>
| <- Z '8': Z, + Z '9': Z>
| <- Z '9': Z, + Z1 '0': Z> INC <Z, Z1>.