antelope 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c791a71ff3ecc84f17a84ccb5955122154b61361
4
- data.tar.gz: ef9c05b620950ffe04782135adc6a71005528976
3
+ metadata.gz: 3063af6acee6ef27ff96efdec1aeaf8c51cda510
4
+ data.tar.gz: cc405e6635d9a2192f246687cf7ee55df8026753
5
5
  SHA512:
6
- metadata.gz: 7be5f67f4f2198bc767b78664ba1764194e9d5f34037f5fa3327cd7de748e36a6af30f7fee0fad62d6d0776fc7fe988f4d0073786df3d5a19a3bad23171809d8
7
- data.tar.gz: 64a61b82594d2dc2b78b36f392365842794a41c04aeca5569d15887e39ccd78bc1f02a817ac54f151c61ec9ec560bc4612924e8a135ddcccf16a14bb9d974e58
6
+ metadata.gz: 9f52610cdd27dd8946772314fe5afe57af9e982983d51abb51a627e488d64bfcb1eed894a66a6f653b85829315d73bb840bc094aa687938ada70df989ce18eb8
7
+ data.tar.gz: a0b91029a688a6312a592dae9f6ae8a2b95d7c8b0fc597df3bf6a5a3667dd575c7342a34a1c61c06541cba2fe84fc80b024ed07d463c2a2ac5f20377fda56a86
@@ -1,21 +1,10 @@
1
1
  Productions:
2
- 0 $start(0) s(0:1) $
3
- 1 s(0:1) e(0:2)
4
- 2 e(0:2) → t(0:3) ";"
5
- 3 e(0:2) t(0:3) "+" e(8:10)
6
- 4 t(0:3)NUMBER
7
- 5 t(0:3) "(" e(5:9) ")"
8
- 2 e(5:9) → t(5:3) ";"
9
- 3 e(5:9) → t(5:3) "+" e(8:10)
10
- 4 t(5:3) → NUMBER
11
- 5 t(5:3) → "(" e(5:9) ")"
12
- 2 e(8:10) → t(8:3) ";"
13
- 3 e(8:10) → t(8:3) "+" e(8:10)
14
- 4 t(8:3) → NUMBER
15
- 5 t(8:3) → "(" e(5:9) ")"
16
-
17
- Nontemrinals:
18
- ["$start(0)", "s(0:1)", "e(0:2)", "t(0:3)", "e(5:9)", "t(5:3)", "e(8:10)", "t(8:3)"]
2
+ se
3
+ et ";"
4
+ e → t "+" e
5
+ tNUMBER
6
+ t → "(" e ")"
7
+ $starts $
19
8
 
20
9
  Precedence:
21
10
  --- highest
@@ -27,116 +16,116 @@ Precedence:
27
16
 
28
17
  State 0:
29
18
  0/n0: $start → • s $
30
- {} ($start)
19
+ {}
31
20
  1/n1: s → • e
32
- {} (s)
21
+ {}
33
22
  2/n1: e → • t ";"
34
- {} (e)
23
+ {}
35
24
  3/n1: e → • t "+" e
36
- {} (e)
25
+ {}
37
26
  4/n1: t → • NUMBER
38
- {} (t)
27
+ {}
39
28
  5/n1: t → • "(" e ")"
40
- {} (t)
29
+ {}
41
30
  transitions:
42
31
  s: State 1
43
32
  e: State 2
44
33
  t: State 3
45
34
  NUMBER: State 4
46
- LPAREN: State 5
35
+ "(": State 5
47
36
 
48
37
  State 1:
49
38
  6/n0: $start → s • $
50
- {} ($start)
39
+ {}
51
40
  transitions:
52
41
  $: State 6
53
42
 
54
43
  State 2:
55
44
  7/n1: s → e •
56
- {$} (s)
45
+ {$}
57
46
  reductions:
58
47
  $: Rule 1
59
48
 
60
49
  State 3:
61
50
  8/n1: e → t • ";"
62
- {} (e)
51
+ {}
63
52
  9/n1: e → t • "+" e
64
- {} (e)
53
+ {}
65
54
  transitions:
66
- SEMICOLON: State 7
67
- ADD: State 8
55
+ ";": State 7
56
+ "+": State 8
68
57
 
69
58
  State 4:
70
59
  10/n1: t → NUMBER •
71
- {";", "+"} (t)
60
+ {";", "+"}
72
61
  reductions:
73
- SEMICOLON: Rule 4
74
- ADD: Rule 4
62
+ ";": Rule 4
63
+ "+": Rule 4
75
64
 
76
65
  State 5:
77
66
  11/n1: t → "(" • e ")"
78
- {} (t)
67
+ {}
79
68
  12/n1: e → • t ";"
80
- {} (e)
69
+ {}
81
70
  13/n1: e → • t "+" e
82
- {} (e)
71
+ {}
83
72
  14/n1: t → • NUMBER
84
- {} (t)
73
+ {}
85
74
  15/n1: t → • "(" e ")"
86
- {} (t)
75
+ {}
87
76
  transitions:
88
77
  e: State 9
89
78
  t: State 3
90
79
  NUMBER: State 4
91
- LPAREN: State 5
80
+ "(": State 5
92
81
 
93
82
  State 6:
94
83
  16/n0: $start → s $ •
95
- {} ($start)
84
+ {}
96
85
  accepting:
97
86
  $: Rule 0
98
87
 
99
88
  State 7:
100
89
  17/n1: e → t ";" •
101
- {$, ")"} (e)
90
+ {$, ")"}
102
91
  reductions:
103
92
  $: Rule 2
104
- RPAREN: Rule 2
93
+ ")": Rule 2
105
94
 
106
95
  State 8:
107
96
  18/n1: e → t "+" • e
108
- {} (e)
97
+ {}
109
98
  19/n1: e → • t ";"
110
- {} (e)
99
+ {}
111
100
  20/n1: e → • t "+" e
112
- {} (e)
101
+ {}
113
102
  21/n1: t → • NUMBER
114
- {} (t)
103
+ {}
115
104
  22/n1: t → • "(" e ")"
116
- {} (t)
105
+ {}
117
106
  transitions:
118
107
  e: State 10
119
108
  t: State 3
120
109
  NUMBER: State 4
121
- LPAREN: State 5
110
+ "(": State 5
122
111
 
123
112
  State 9:
124
113
  23/n1: t → "(" e • ")"
125
- {} (t)
114
+ {}
126
115
  transitions:
127
- RPAREN: State 11
116
+ ")": State 11
128
117
 
129
118
  State 10:
130
119
  24/n1: e → t "+" e •
131
- {$, ")"} (e)
120
+ {$, ")"}
132
121
  reductions:
133
122
  $: Rule 3
134
- RPAREN: Rule 3
123
+ ")": Rule 3
135
124
 
136
125
  State 11:
137
126
  25/n1: t → "(" e ")" •
138
- {";", "+"} (t)
127
+ {";", "+"}
139
128
  reductions:
140
- SEMICOLON: Rule 5
141
- ADD: Rule 5
129
+ ";": Rule 5
130
+ "+": Rule 5
142
131
 
@@ -1,50 +1,12 @@
1
1
  Productions:
2
- 0 $start(0) expression(0:1) $
3
- 1 expression(0:1)NUMBER { |a| a[1] }
4
- 2 expression(0:1) → expression(0:1) "+" expression(5:11) { |a, _, b| a + b }
5
- 3 expression(0:1) → expression(0:1) "-" expression(6:12) { |a, _, b| a - b }
6
- 4 expression(0:1) → expression(0:1) "*" expression(7:13) { |a, _, b| a * b }
7
- 5 expression(0:1)expression(0:1) "/" expression(8:14) { |a, _, b| a / b }
8
- 6 expression(0:1) → "(" expression(3:9) ")" { |_, a, _| a }
9
- 7 expression(0:1) "(" $error ")"
10
- 1 expression(3:9) → NUMBER { |a| a[1] }
11
- 2 expression(3:9) → expression(3:9) "+" expression(5:11) { |a, _, b| a + b }
12
- 3 expression(3:9) → expression(3:9) "-" expression(6:12) { |a, _, b| a - b }
13
- 4 expression(3:9) → expression(3:9) "*" expression(7:13) { |a, _, b| a * b }
14
- 5 expression(3:9) → expression(3:9) "/" expression(8:14) { |a, _, b| a / b }
15
- 6 expression(3:9) → "(" expression(3:9) ")" { |_, a, _| a }
16
- 7 expression(3:9) → "(" $error ")"
17
- 1 expression(5:11) → NUMBER { |a| a[1] }
18
- 2 expression(5:11) → expression(5:11) "+" expression(5:11) { |a, _, b| a + b }
19
- 3 expression(5:11) → expression(5:11) "-" expression(6:12) { |a, _, b| a - b }
20
- 4 expression(5:11) → expression(5:11) "*" expression(7:13) { |a, _, b| a * b }
21
- 5 expression(5:11) → expression(5:11) "/" expression(8:14) { |a, _, b| a / b }
22
- 6 expression(5:11) → "(" expression(3:9) ")" { |_, a, _| a }
23
- 7 expression(5:11) → "(" $error ")"
24
- 1 expression(6:12) → NUMBER { |a| a[1] }
25
- 2 expression(6:12) → expression(6:12) "+" expression(5:11) { |a, _, b| a + b }
26
- 3 expression(6:12) → expression(6:12) "-" expression(6:12) { |a, _, b| a - b }
27
- 4 expression(6:12) → expression(6:12) "*" expression(7:13) { |a, _, b| a * b }
28
- 5 expression(6:12) → expression(6:12) "/" expression(8:14) { |a, _, b| a / b }
29
- 6 expression(6:12) → "(" expression(3:9) ")" { |_, a, _| a }
30
- 7 expression(6:12) → "(" $error ")"
31
- 1 expression(7:13) → NUMBER { |a| a[1] }
32
- 2 expression(7:13) → expression(7:13) "+" expression(5:11) { |a, _, b| a + b }
33
- 3 expression(7:13) → expression(7:13) "-" expression(6:12) { |a, _, b| a - b }
34
- 4 expression(7:13) → expression(7:13) "*" expression(7:13) { |a, _, b| a * b }
35
- 5 expression(7:13) → expression(7:13) "/" expression(8:14) { |a, _, b| a / b }
36
- 6 expression(7:13) → "(" expression(3:9) ")" { |_, a, _| a }
37
- 7 expression(7:13) → "(" $error ")"
38
- 1 expression(8:14) → NUMBER { |a| a[1] }
39
- 2 expression(8:14) → expression(8:14) "+" expression(5:11) { |a, _, b| a + b }
40
- 3 expression(8:14) → expression(8:14) "-" expression(6:12) { |a, _, b| a - b }
41
- 4 expression(8:14) → expression(8:14) "*" expression(7:13) { |a, _, b| a * b }
42
- 5 expression(8:14) → expression(8:14) "/" expression(8:14) { |a, _, b| a / b }
43
- 6 expression(8:14) → "(" expression(3:9) ")" { |_, a, _| a }
44
- 7 expression(8:14) → "(" $error ")"
45
-
46
- Nontemrinals:
47
- ["$start(0)", "expression(0:1)", "expression(3:9)", "expression(5:11)", "expression(6:12)", "expression(7:13)", "expression(8:14)"]
2
+ expressionNUMBER { |a| a[1] }
3
+ expression → expression "+" expression { |a, _, b| a + b }
4
+ expression → expression "-" expression { |a, _, b| a - b }
5
+ expression → expression "*" expression { |a, _, b| a * b }
6
+ expression → expression "/" expression { |a, _, b| a / b }
7
+ expression → "(" expression ")" { |_, a, _| a }
8
+ expression → "(" $error ")"
9
+ $startexpression $
48
10
 
49
11
  Precedence:
50
12
  --- highest
@@ -62,295 +24,295 @@ Precedence:
62
24
 
63
25
  State 0:
64
26
  0/n0: $start → • expression $
65
- {} ($start)
27
+ {}
66
28
  1/n1: expression → • NUMBER
67
- {} (expression)
29
+ {}
68
30
  2/l2: expression → • expression "+" expression
69
- {} (expression)
31
+ {}
70
32
  3/l2: expression → • expression "-" expression
71
- {} (expression)
33
+ {}
72
34
  4/l3: expression → • expression "*" expression
73
- {} (expression)
35
+ {}
74
36
  5/l3: expression → • expression "/" expression
75
- {} (expression)
37
+ {}
76
38
  6/n4: expression → • "(" expression ")"
77
- {} (expression)
39
+ {}
78
40
  7/n4: expression → • "(" $error ")"
79
- {} (expression)
41
+ {}
80
42
  transitions:
81
43
  expression: State 1
82
44
  NUMBER: State 2
83
- LPAREN: State 3
45
+ "(": State 3
84
46
 
85
47
  State 1:
86
48
  8/n0: $start → expression • $
87
- {} ($start)
49
+ {}
88
50
  9/l2: expression → expression • "+" expression
89
- {} (expression)
51
+ {}
90
52
  10/l2: expression → expression • "-" expression
91
- {} (expression)
53
+ {}
92
54
  11/l3: expression → expression • "*" expression
93
- {} (expression)
55
+ {}
94
56
  12/l3: expression → expression • "/" expression
95
- {} (expression)
57
+ {}
96
58
  transitions:
97
59
  $: State 4
98
- ADD: State 5
99
- SUBTRACT: State 6
100
- MULTIPLY: State 7
101
- DIVIDE: State 8
60
+ "+": State 5
61
+ "-": State 6
62
+ "*": State 7
63
+ "/": State 8
102
64
 
103
65
  State 2:
104
66
  13/n1: expression → NUMBER •
105
- {$, "+", "-", "*", "/", ")"} (expression)
67
+ {$, "+", "-", "*", "/", ")"}
106
68
  reductions:
107
69
  $: Rule 1
108
- ADD: Rule 1
109
- SUBTRACT: Rule 1
110
- MULTIPLY: Rule 1
111
- DIVIDE: Rule 1
112
- RPAREN: Rule 1
70
+ "+": Rule 1
71
+ "-": Rule 1
72
+ "*": Rule 1
73
+ "/": Rule 1
74
+ ")": Rule 1
113
75
 
114
76
  State 3:
115
77
  14/n4: expression → "(" • expression ")"
116
- {} (expression)
78
+ {}
117
79
  15/n1: expression → • NUMBER
118
- {} (expression)
80
+ {}
119
81
  16/l2: expression → • expression "+" expression
120
- {} (expression)
82
+ {}
121
83
  17/l2: expression → • expression "-" expression
122
- {} (expression)
84
+ {}
123
85
  18/l3: expression → • expression "*" expression
124
- {} (expression)
86
+ {}
125
87
  19/l3: expression → • expression "/" expression
126
- {} (expression)
88
+ {}
127
89
  20/n4: expression → • "(" expression ")"
128
- {} (expression)
90
+ {}
129
91
  21/n4: expression → • "(" $error ")"
130
- {} (expression)
92
+ {}
131
93
  22/n4: expression → "(" • $error ")"
132
- {} (expression)
94
+ {}
133
95
  transitions:
134
96
  expression: State 9
135
97
  NUMBER: State 2
136
- LPAREN: State 3
98
+ "(": State 3
137
99
  $error: State 10
138
100
 
139
101
  State 4:
140
102
  23/n0: $start → expression $ •
141
- {} ($start)
103
+ {}
142
104
  accepting:
143
105
  $: Rule 0
144
106
 
145
107
  State 5:
146
108
  24/l2: expression → expression "+" • expression
147
- {} (expression)
109
+ {}
148
110
  25/n1: expression → • NUMBER
149
- {} (expression)
111
+ {}
150
112
  26/l2: expression → • expression "+" expression
151
- {} (expression)
113
+ {}
152
114
  27/l2: expression → • expression "-" expression
153
- {} (expression)
115
+ {}
154
116
  28/l3: expression → • expression "*" expression
155
- {} (expression)
117
+ {}
156
118
  29/l3: expression → • expression "/" expression
157
- {} (expression)
119
+ {}
158
120
  30/n4: expression → • "(" expression ")"
159
- {} (expression)
121
+ {}
160
122
  31/n4: expression → • "(" $error ")"
161
- {} (expression)
123
+ {}
162
124
  transitions:
163
125
  expression: State 11
164
126
  NUMBER: State 2
165
- LPAREN: State 3
127
+ "(": State 3
166
128
 
167
129
  State 6:
168
130
  32/l2: expression → expression "-" • expression
169
- {} (expression)
131
+ {}
170
132
  33/n1: expression → • NUMBER
171
- {} (expression)
133
+ {}
172
134
  34/l2: expression → • expression "+" expression
173
- {} (expression)
135
+ {}
174
136
  35/l2: expression → • expression "-" expression
175
- {} (expression)
137
+ {}
176
138
  36/l3: expression → • expression "*" expression
177
- {} (expression)
139
+ {}
178
140
  37/l3: expression → • expression "/" expression
179
- {} (expression)
141
+ {}
180
142
  38/n4: expression → • "(" expression ")"
181
- {} (expression)
143
+ {}
182
144
  39/n4: expression → • "(" $error ")"
183
- {} (expression)
145
+ {}
184
146
  transitions:
185
147
  expression: State 12
186
148
  NUMBER: State 2
187
- LPAREN: State 3
149
+ "(": State 3
188
150
 
189
151
  State 7:
190
152
  40/l3: expression → expression "*" • expression
191
- {} (expression)
153
+ {}
192
154
  41/n1: expression → • NUMBER
193
- {} (expression)
155
+ {}
194
156
  42/l2: expression → • expression "+" expression
195
- {} (expression)
157
+ {}
196
158
  43/l2: expression → • expression "-" expression
197
- {} (expression)
159
+ {}
198
160
  44/l3: expression → • expression "*" expression
199
- {} (expression)
161
+ {}
200
162
  45/l3: expression → • expression "/" expression
201
- {} (expression)
163
+ {}
202
164
  46/n4: expression → • "(" expression ")"
203
- {} (expression)
165
+ {}
204
166
  47/n4: expression → • "(" $error ")"
205
- {} (expression)
167
+ {}
206
168
  transitions:
207
169
  expression: State 13
208
170
  NUMBER: State 2
209
- LPAREN: State 3
171
+ "(": State 3
210
172
 
211
173
  State 8:
212
174
  48/l3: expression → expression "/" • expression
213
- {} (expression)
175
+ {}
214
176
  49/n1: expression → • NUMBER
215
- {} (expression)
177
+ {}
216
178
  50/l2: expression → • expression "+" expression
217
- {} (expression)
179
+ {}
218
180
  51/l2: expression → • expression "-" expression
219
- {} (expression)
181
+ {}
220
182
  52/l3: expression → • expression "*" expression
221
- {} (expression)
183
+ {}
222
184
  53/l3: expression → • expression "/" expression
223
- {} (expression)
185
+ {}
224
186
  54/n4: expression → • "(" expression ")"
225
- {} (expression)
187
+ {}
226
188
  55/n4: expression → • "(" $error ")"
227
- {} (expression)
189
+ {}
228
190
  transitions:
229
191
  expression: State 14
230
192
  NUMBER: State 2
231
- LPAREN: State 3
193
+ "(": State 3
232
194
 
233
195
  State 9:
234
196
  56/n4: expression → "(" expression • ")"
235
- {} (expression)
197
+ {}
236
198
  57/l2: expression → expression • "+" expression
237
- {} (expression)
199
+ {}
238
200
  58/l2: expression → expression • "-" expression
239
- {} (expression)
201
+ {}
240
202
  59/l3: expression → expression • "*" expression
241
- {} (expression)
203
+ {}
242
204
  60/l3: expression → expression • "/" expression
243
- {} (expression)
205
+ {}
244
206
  transitions:
245
- RPAREN: State 15
246
- ADD: State 5
247
- SUBTRACT: State 6
248
- MULTIPLY: State 7
249
- DIVIDE: State 8
207
+ ")": State 15
208
+ "+": State 5
209
+ "-": State 6
210
+ "*": State 7
211
+ "/": State 8
250
212
 
251
213
  State 10:
252
214
  61/n4: expression → "(" $error • ")"
253
- {} (expression)
215
+ {}
254
216
  transitions:
255
- RPAREN: State 16
217
+ ")": State 16
256
218
 
257
219
  State 11:
258
220
  62/l2: expression → expression "+" expression •
259
- {$, "+", "-", "*", "/", ")"} (expression)
221
+ {$, "+", "-", "*", "/", ")"}
260
222
  63/l2: expression → expression • "+" expression
261
- {} (expression)
223
+ {}
262
224
  64/l2: expression → expression • "-" expression
263
- {} (expression)
225
+ {}
264
226
  65/l3: expression → expression • "*" expression
265
- {} (expression)
227
+ {}
266
228
  66/l3: expression → expression • "/" expression
267
- {} (expression)
229
+ {}
268
230
  transitions:
269
- MULTIPLY: State 7
270
- DIVIDE: State 8
231
+ "*": State 7
232
+ "/": State 8
271
233
  reductions:
272
- ADD: Rule 2
273
- SUBTRACT: Rule 2
234
+ "+": Rule 2
235
+ "-": Rule 2
274
236
  $: Rule 2
275
- RPAREN: Rule 2
237
+ ")": Rule 2
276
238
 
277
239
  State 12:
278
240
  67/l2: expression → expression "-" expression •
279
- {$, "+", "-", "*", "/", ")"} (expression)
241
+ {$, "+", "-", "*", "/", ")"}
280
242
  68/l2: expression → expression • "+" expression
281
- {} (expression)
243
+ {}
282
244
  69/l2: expression → expression • "-" expression
283
- {} (expression)
245
+ {}
284
246
  70/l3: expression → expression • "*" expression
285
- {} (expression)
247
+ {}
286
248
  71/l3: expression → expression • "/" expression
287
- {} (expression)
249
+ {}
288
250
  transitions:
289
- MULTIPLY: State 7
290
- DIVIDE: State 8
251
+ "*": State 7
252
+ "/": State 8
291
253
  reductions:
292
- ADD: Rule 3
293
- SUBTRACT: Rule 3
254
+ "+": Rule 3
255
+ "-": Rule 3
294
256
  $: Rule 3
295
- RPAREN: Rule 3
257
+ ")": Rule 3
296
258
 
297
259
  State 13:
298
260
  72/l3: expression → expression "*" expression •
299
- {$, "+", "-", "*", "/", ")"} (expression)
261
+ {$, "+", "-", "*", "/", ")"}
300
262
  73/l2: expression → expression • "+" expression
301
- {} (expression)
263
+ {}
302
264
  74/l2: expression → expression • "-" expression
303
- {} (expression)
265
+ {}
304
266
  75/l3: expression → expression • "*" expression
305
- {} (expression)
267
+ {}
306
268
  76/l3: expression → expression • "/" expression
307
- {} (expression)
269
+ {}
308
270
  reductions:
309
- ADD: Rule 4
310
- SUBTRACT: Rule 4
311
- MULTIPLY: Rule 4
312
- DIVIDE: Rule 4
271
+ "+": Rule 4
272
+ "-": Rule 4
273
+ "*": Rule 4
274
+ "/": Rule 4
313
275
  $: Rule 4
314
- RPAREN: Rule 4
276
+ ")": Rule 4
315
277
 
316
278
  State 14:
317
279
  77/l3: expression → expression "/" expression •
318
- {$, "+", "-", "*", "/", ")"} (expression)
280
+ {$, "+", "-", "*", "/", ")"}
319
281
  78/l2: expression → expression • "+" expression
320
- {} (expression)
282
+ {}
321
283
  79/l2: expression → expression • "-" expression
322
- {} (expression)
284
+ {}
323
285
  80/l3: expression → expression • "*" expression
324
- {} (expression)
286
+ {}
325
287
  81/l3: expression → expression • "/" expression
326
- {} (expression)
288
+ {}
327
289
  reductions:
328
- ADD: Rule 5
329
- SUBTRACT: Rule 5
330
- MULTIPLY: Rule 5
331
- DIVIDE: Rule 5
290
+ "+": Rule 5
291
+ "-": Rule 5
292
+ "*": Rule 5
293
+ "/": Rule 5
332
294
  $: Rule 5
333
- RPAREN: Rule 5
295
+ ")": Rule 5
334
296
 
335
297
  State 15:
336
298
  82/n4: expression → "(" expression ")" •
337
- {$, "+", "-", "*", "/", ")"} (expression)
299
+ {$, "+", "-", "*", "/", ")"}
338
300
  reductions:
339
301
  $: Rule 6
340
- ADD: Rule 6
341
- SUBTRACT: Rule 6
342
- MULTIPLY: Rule 6
343
- DIVIDE: Rule 6
344
- RPAREN: Rule 6
302
+ "+": Rule 6
303
+ "-": Rule 6
304
+ "*": Rule 6
305
+ "/": Rule 6
306
+ ")": Rule 6
345
307
 
346
308
  State 16:
347
309
  83/n4: expression → "(" $error ")" •
348
- {$, "+", "-", "*", "/", ")"} (expression)
310
+ {$, "+", "-", "*", "/", ")"}
349
311
  reductions:
350
312
  $: Rule 7
351
- ADD: Rule 7
352
- SUBTRACT: Rule 7
353
- MULTIPLY: Rule 7
354
- DIVIDE: Rule 7
355
- RPAREN: Rule 7
313
+ "+": Rule 7
314
+ "-": Rule 7
315
+ "*": Rule 7
316
+ "/": Rule 7
317
+ ")": Rule 7
356
318
 
@@ -1,19 +1,10 @@
1
1
  Productions:
2
- 0 $start(0) e(0:1) $
3
- 1 e(0:1)l(0:2) "=" r(7:10)
4
- 2 e(0:1) r(0:3)
5
- 3 l(0:2)IDENT
6
- 4 l(0:2) "*" r(5:8)
7
- 5 r(0:3) l(0:2)
8
- 5 r(5:8) → l(5:9)
9
- 3 l(5:9) → IDENT
10
- 4 l(5:9) → "*" r(5:8)
11
- 5 r(7:10) → l(7:9)
12
- 3 l(7:9) → IDENT
13
- 4 l(7:9) → "*" r(5:8)
14
-
15
- Nontemrinals:
16
- ["$start(0)", "e(0:1)", "l(0:2)", "r(0:3)", "r(5:8)", "l(5:9)", "r(7:10)", "l(7:9)"]
2
+ el "=" r
3
+ e → r
4
+ lIDENT
5
+ l → "*" r
6
+ rl
7
+ $starte $
17
8
 
18
9
  Precedence:
19
10
  --- highest
@@ -25,106 +16,106 @@ Precedence:
25
16
 
26
17
  State 0:
27
18
  0/n0: $start → • e $
28
- {} ($start)
19
+ {}
29
20
  1/n1: e → • l "=" r
30
- {} (e)
21
+ {}
31
22
  2/n1: e → • r
32
- {} (e)
23
+ {}
33
24
  3/n1: l → • IDENT
34
- {} (l)
25
+ {}
35
26
  4/n1: l → • "*" r
36
- {} (l)
27
+ {}
37
28
  5/n1: r → • l
38
- {} (r)
29
+ {}
39
30
  transitions:
40
31
  e: State 1
41
32
  l: State 2
42
33
  r: State 3
43
34
  IDENT: State 4
44
- STAR: State 5
35
+ "*": State 5
45
36
 
46
37
  State 1:
47
38
  6/n0: $start → e • $
48
- {} ($start)
39
+ {}
49
40
  transitions:
50
41
  $: State 6
51
42
 
52
43
  State 2:
53
44
  7/n1: e → l • "=" r
54
- {} (e)
45
+ {}
55
46
  8/n1: r → l •
56
- {$} (r)
47
+ {$}
57
48
  transitions:
58
- EQUALS: State 7
49
+ "=": State 7
59
50
  reductions:
60
51
  $: Rule 5
61
52
 
62
53
  State 3:
63
54
  9/n1: e → r •
64
- {$} (e)
55
+ {$}
65
56
  reductions:
66
57
  $: Rule 2
67
58
 
68
59
  State 4:
69
60
  10/n1: l → IDENT •
70
- {"=", $} (l)
61
+ {"=", $}
71
62
  reductions:
72
- EQUALS: Rule 3
63
+ "=": Rule 3
73
64
  $: Rule 3
74
65
 
75
66
  State 5:
76
67
  11/n1: l → "*" • r
77
- {} (l)
68
+ {}
78
69
  12/n1: r → • l
79
- {} (r)
70
+ {}
80
71
  13/n1: l → • IDENT
81
- {} (l)
72
+ {}
82
73
  14/n1: l → • "*" r
83
- {} (l)
74
+ {}
84
75
  transitions:
85
76
  r: State 8
86
77
  l: State 9
87
78
  IDENT: State 4
88
- STAR: State 5
79
+ "*": State 5
89
80
 
90
81
  State 6:
91
82
  15/n0: $start → e $ •
92
- {} ($start)
83
+ {}
93
84
  accepting:
94
85
  $: Rule 0
95
86
 
96
87
  State 7:
97
88
  16/n1: e → l "=" • r
98
- {} (e)
89
+ {}
99
90
  17/n1: r → • l
100
- {} (r)
91
+ {}
101
92
  18/n1: l → • IDENT
102
- {} (l)
93
+ {}
103
94
  19/n1: l → • "*" r
104
- {} (l)
95
+ {}
105
96
  transitions:
106
97
  r: State 10
107
98
  l: State 9
108
99
  IDENT: State 4
109
- STAR: State 5
100
+ "*": State 5
110
101
 
111
102
  State 8:
112
103
  20/n1: l → "*" r •
113
- {"=", $} (l)
104
+ {"=", $}
114
105
  reductions:
115
- EQUALS: Rule 4
106
+ "=": Rule 4
116
107
  $: Rule 4
117
108
 
118
109
  State 9:
119
110
  21/n1: r → l •
120
- {"=", $} (r)
111
+ {"=", $}
121
112
  reductions:
122
- EQUALS: Rule 5
113
+ "=": Rule 5
123
114
  $: Rule 5
124
115
 
125
116
  State 10:
126
117
  22/n1: e → l "=" r •
127
- {$} (e)
118
+ {$}
128
119
  reductions:
129
120
  $: Rule 1
130
121
 
@@ -151,7 +151,7 @@ module Antelope
151
151
  require_state! :first
152
152
  name = name.intern
153
153
  case name
154
- when :terminal
154
+ when :terminal, :token
155
155
  @options[:terminals] << [args[0].intern, args[1]]
156
156
  when :require
157
157
  compare_versions(args[0])
@@ -91,19 +91,26 @@ module Antelope
91
91
 
92
92
  terminal = grammar.precedence_for(on)
93
93
 
94
- state_part = data.select { |(t, d)| t == :state }.first
95
- rule_part = data.select { |(t, d)| t == :reduce}.first
94
+ rule_part, other_part = data.sort_by { |(t, d)| t }
95
+
96
+ unless other_part[0] == :state
97
+ $stderr.puts \
98
+ "Could not determine move for #{on} in state " \
99
+ "#{state} (reduce/reduce conflict)"
100
+ next
101
+ end
96
102
 
97
103
  result = @rules[rule_part[1]].prec <=> terminal
98
104
 
99
105
  case result
100
106
  when 0
101
107
  $stderr.puts \
102
- "Could not determine move for #{on} in state #{state}"
108
+ "Could not determine move for #{on} in state " \
109
+ "#{state} (shift/reduce conflict)"
103
110
  when 1
104
111
  @table[state][on] = rule_part
105
112
  when -1
106
- @table[state][on] = state_part
113
+ @table[state][on] = other_part
107
114
  end
108
115
  end
109
116
  end
@@ -22,9 +22,9 @@ Precedence:
22
22
  <%= rule %>
23
23
  {<%= rule.lookahead.to_a.join(", ") %>}
24
24
  % end
25
- % transitions = v.each.select { |_, a| a[0] == :state }
26
- % reductions = v.each.select { |_, a| a[0] == :reduce }
27
- % accepting = v.each.select { |_, a| a[0] == :accept }
25
+ % transitions = v.each.select { |_, a| a && a[0] == :state }
26
+ % reductions = v.each.select { |_, a| a && a[0] == :reduce}
27
+ % accepting = v.each.select { |_, a| a && a[0] == :accept}
28
28
  % conflicts = v.each.select { |_, (a, b)| a.is_a?(Array) }
29
29
  % thing = [:transitions, :reductions, :accepting]
30
30
  % num_type = {transitions: "State", reductions: "Rule", accepting: "Rule"}
@@ -33,7 +33,8 @@ Precedence:
33
33
  % next unless value.any?
34
34
  <%= key %>:
35
35
  % value.each do |token, (_, name)|
36
- <%= token %>: <%= num_type[key] %> <%= name %>
36
+ % token_value = grammar.terminals.find { |_| _.name == token } || token
37
+ <%= token_value %>: <%= num_type[key] %> <%= name %>
37
38
  % end
38
39
  % end
39
40
  % if conflicts.any?
@@ -74,7 +74,9 @@ module Antelope
74
74
  src_file = self.class.source_root + source
75
75
  src = src_file.open("r")
76
76
  context = instance_eval('binding')
77
- content = ERB.new(src.read, nil, "%").result(context)
77
+ erb = ERB.new(src.read, nil, "%")
78
+ erb.filename = source
79
+ content = erb.result(context)
78
80
  content = yield content if block_given?
79
81
  dest_file = grammar.output + destination
80
82
  dest_file.open("w") do |f|
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Antelope
4
4
  # The current running version of antelope.
5
- VERSION = "0.1.5".freeze
5
+ VERSION = "0.1.6".freeze
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: antelope
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Rodi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-24 00:00:00.000000000 Z
11
+ date: 2014-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie