-
Notifications
You must be signed in to change notification settings - Fork 1
/
ebnf.eag
46 lines (37 loc) · 810 Bytes
/
ebnf.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
36
37
38
39
40
41
42
43
44
45
46
// This EAG shows the notation for group, option, and repetition
// without EBNF expressions.
// This lowering defines the meaning of the related example/ebnf.eag.
S = L | S ',' S.
S <+ L1 ',' L2 ',' L3: S>:
Group <L1> ',' Option <L2> ',' Repetition <L3>.
S <+ L1 ',' L2 ',' L3: S>:
GroupSubrule <L1> ',' OptionSubrule <L2> ',' RepetitionSubrule <L3>.
L = | 'a' L | 'b' L.
Group <+ 'a': L>:
'a'.
Group <+ 'b': L>:
'b'.
Option <+ 'a': L>:
'a'.
Option <+ 'b': L>:
'b'.
Option <+ : L>:
.
Repetition <+ 'a' L: L>:
'a' Repetition <L>.
Repetition <+ 'b' L: L>:
'b' Repetition <L>.
Repetition <+ : L>:
.
GroupSubrule <+ L>:
'"'
Group <L>
'"'.
OptionSubrule <+ L>:
'"'
Option <L>
'"'.
RepetitionSubrule <+L>:
'"'
Repetition <L>
'"'.