-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgrammar.js
48 lines (40 loc) · 832 Bytes
/
grammar.js
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
47
48
module.exports = {
simple: `
A -> y w B
B -> k w
`,
simpleTwo: `
A -> Y B
Y -> | x
B -> w
`,
recursive: `
CK -> CK id | bla | | id CK
`,
recursiveTwo: `
CK -> CK id | bla | ε | id CK | S CK | CK S
S -> a B ; B -> w
`,
mutuallyRecursive: `
S -> B a
B -> S c | ε
`,
mutuallyRecursiveTwo: `
E → T E'
E' → + T E' |
T → F T'
T' → * F T' |
F → ( E ) | id
`,
mutuallyRecursiveThree: `
S → A ( S ) B ∣ ϵ
A → S ∣ S B ∣ x ∣ ϵ
B → S B ∣ y
`,
mutuallyRecursiveFour: `
S -> A c | B b | S C a b ;
A -> a | b B | C
B -> A C | d ;
C -> a S | C d B d | A B | ;
`,
};