forked from linkrope/gamma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathident-list.eag
35 lines (25 loc) · 951 Bytes
/
ident-list.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
29
30
31
32
33
34
35
S <+ IdentList>: IdentList < , IdentList>.
letter = 'a' | 'b'.
letter: <+ 'a': letter> 'a' | <+ 'b': letter> 'b' .
digit = '0' | '1'.
digit: <+ '0': digit> '0' | <+ '1': digit> '1' .
ident* = letter | ident letter | ident digit.
ident* <+ ident>:
letter <letter>
<letter, ident>
{ <- ident, + ident1>
letter <letter> <ident letter, ident1>
| <- ident, + ident1>
digit <digit> <ident digit, ident1>
} <- ident, + ident>.
IdentList = | IdentList ident.
IdentList:
{ <- IdentList, + IdentList1>
ident <ident> FindObject <IdentList, ident, 'NIL'> <IdentList ident, IdentList1>
} <- IdentList, + IdentList>.
IdentNil = ident | 'NIL'.
FindObject:
<- : IdentList, - ident, + 'NIL': IdentNil>
| <- IdentList ident: IdentList, - ident, + ident: IdentNil>
| <- IdentList !ident: IdentList, - ident, + IdentNil: IdentNil>
FindObject <IdentList, ident, IdentNil>.