antelope 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +25 -25
- data/.rspec +3 -3
- data/.travis.yml +10 -10
- data/.yardopts +7 -7
- data/CONTRIBUTING.md +50 -38
- data/GENERATORS.md +180 -124
- data/Gemfile +7 -7
- data/LICENSE.txt +22 -22
- data/README.md +240 -104
- data/Rakefile +2 -2
- data/TODO.md +58 -58
- data/antelope.gemspec +29 -28
- data/bin/antelope +7 -7
- data/examples/deterministic.ace +35 -35
- data/examples/example.ace +52 -51
- data/examples/example.ace.err +192 -192
- data/examples/example.ace.inf +432 -432
- data/examples/example.ate +70 -70
- data/examples/example.ate.err +192 -192
- data/examples/example.ate.inf +432 -432
- data/examples/liquidscript.ace +233 -233
- data/examples/simple.ace +22 -22
- data/lib/antelope/ace/compiler.rb +334 -334
- data/lib/antelope/ace/errors.rb +30 -30
- data/lib/antelope/ace/scanner/argument.rb +57 -57
- data/lib/antelope/ace/scanner/first.rb +89 -89
- data/lib/antelope/ace/scanner/second.rb +178 -178
- data/lib/antelope/ace/scanner/third.rb +27 -27
- data/lib/antelope/ace/scanner.rb +144 -144
- data/lib/antelope/ace.rb +47 -47
- data/lib/antelope/cli.rb +60 -60
- data/lib/antelope/errors.rb +25 -25
- data/lib/antelope/generation/constructor/first.rb +86 -86
- data/lib/antelope/generation/constructor/follow.rb +105 -105
- data/lib/antelope/generation/constructor/nullable.rb +64 -64
- data/lib/antelope/generation/constructor.rb +127 -127
- data/lib/antelope/generation/errors.rb +17 -17
- data/lib/antelope/generation/null.rb +13 -13
- data/lib/antelope/generation/recognizer/rule.rb +216 -216
- data/lib/antelope/generation/recognizer/state.rb +129 -129
- data/lib/antelope/generation/recognizer.rb +177 -177
- data/lib/antelope/generation/tableizer.rb +176 -176
- data/lib/antelope/generation.rb +15 -15
- data/lib/antelope/generator/base/coerce.rb +115 -0
- data/lib/antelope/generator/base/extra.rb +50 -0
- data/lib/antelope/generator/base.rb +134 -264
- data/lib/antelope/generator/c.rb +11 -11
- data/lib/antelope/generator/c_header.rb +105 -105
- data/lib/antelope/generator/c_source.rb +39 -39
- data/lib/antelope/generator/error.rb +34 -34
- data/lib/antelope/generator/group.rb +60 -57
- data/lib/antelope/generator/html.rb +51 -51
- data/lib/antelope/generator/info.rb +47 -47
- data/lib/antelope/generator/null.rb +18 -18
- data/lib/antelope/generator/output.rb +17 -17
- data/lib/antelope/generator/ruby.rb +112 -79
- data/lib/antelope/generator/templates/c_header.ant +36 -36
- data/lib/antelope/generator/templates/c_source.ant +202 -202
- data/lib/antelope/generator/templates/error.erb +40 -0
- data/lib/antelope/generator/templates/html/antelope.css +53 -1
- data/lib/antelope/generator/templates/html/antelope.html +82 -1
- data/lib/antelope/generator/templates/html/antelope.js +9 -1
- data/lib/antelope/generator/templates/html/css.ant +53 -53
- data/lib/antelope/generator/templates/html/html.ant +82 -82
- data/lib/antelope/generator/templates/html/js.ant +9 -9
- data/lib/antelope/generator/templates/info.erb +61 -0
- data/lib/antelope/generator/templates/{ruby.ant → ruby.erb} +171 -178
- data/lib/antelope/generator.rb +62 -66
- data/lib/antelope/grammar/generation.rb +76 -76
- data/lib/antelope/grammar/loading.rb +84 -84
- data/lib/antelope/grammar/precedence.rb +59 -59
- data/lib/antelope/grammar/precedences.rb +64 -64
- data/lib/antelope/grammar/production.rb +56 -56
- data/lib/antelope/grammar/productions.rb +154 -154
- data/lib/antelope/grammar/symbols.rb +64 -64
- data/lib/antelope/grammar/token/epsilon.rb +23 -23
- data/lib/antelope/grammar/token/error.rb +24 -24
- data/lib/antelope/grammar/token/nonterminal.rb +15 -15
- data/lib/antelope/grammar/token/terminal.rb +15 -15
- data/lib/antelope/grammar/token.rb +231 -231
- data/lib/antelope/grammar.rb +68 -68
- data/lib/antelope/version.rb +6 -6
- data/lib/antelope.rb +18 -19
- data/optimizations.txt +42 -42
- data/spec/antelope/ace/compiler_spec.rb +60 -60
- data/spec/antelope/ace/scanner_spec.rb +27 -27
- data/spec/antelope/generation/constructor_spec.rb +131 -131
- data/spec/fixtures/simple.ace +22 -22
- data/spec/spec_helper.rb +39 -39
- data/spec/support/benchmark_helper.rb +5 -5
- data/spec/support/grammar_helper.rb +14 -14
- data/subl/Ace (Ruby).JSON-tmLanguage +94 -94
- data/subl/Ace (Ruby).tmLanguage +153 -153
- metadata +22 -11
- data/lib/antelope/generator/templates/error.ant +0 -34
- data/lib/antelope/generator/templates/info.ant +0 -53
- data/lib/antelope/template/compiler.rb +0 -78
- data/lib/antelope/template/errors.rb +0 -9
- data/lib/antelope/template/scanner.rb +0 -109
- data/lib/antelope/template.rb +0 -64
- data/spec/antelope/template_spec.rb +0 -50
data/examples/example.ace.inf
CHANGED
@@ -1,432 +1,432 @@
|
|
1
|
-
Productions:
|
2
|
-
15/n1: expression → NUMBER {
|
3
|
-
26/n0: $start → expression $end
|
4
|
-
79/r4: expression → expression "^" expression {
|
5
|
-
85/l2: expression → expression "+" expression {
|
6
|
-
91/l2: expression → expression "-" expression {
|
7
|
-
97/l3: expression → expression "*" expression {
|
8
|
-
103/l3: expression → expression "/" expression {
|
9
|
-
109/n1: expression → "(" expression ")" {
|
10
|
-
110/n1: expression → "(" $error ")" {
|
11
|
-
|
12
|
-
|
13
|
-
Precedence:
|
14
|
-
--- highest
|
15
|
-
right 4:
|
16
|
-
{EXPONENTIATE}
|
17
|
-
left 3:
|
18
|
-
{MULTIPLY, DIVIDE}
|
19
|
-
left 2:
|
20
|
-
{ADD, SUBTRACT}
|
21
|
-
nonassoc 1:
|
22
|
-
{_}
|
23
|
-
nonassoc 0:
|
24
|
-
{$end}
|
25
|
-
--- lowest
|
26
|
-
|
27
|
-
State 0:
|
28
|
-
0/n0: $start → • expression $end
|
29
|
-
{}
|
30
|
-
1/n1: expression → • NUMBER
|
31
|
-
{}
|
32
|
-
2/r4: expression → • expression "^" expression
|
33
|
-
{}
|
34
|
-
3/l2: expression → • expression "+" expression
|
35
|
-
{}
|
36
|
-
4/l2: expression → • expression "-" expression
|
37
|
-
{}
|
38
|
-
5/l3: expression → • expression "*" expression
|
39
|
-
{}
|
40
|
-
6/l3: expression → • expression "/" expression
|
41
|
-
{}
|
42
|
-
7/n1: expression → • "(" expression ")"
|
43
|
-
{}
|
44
|
-
8/n1: expression → • "(" $error ")"
|
45
|
-
{}
|
46
|
-
9/n0: $start → expression • $end
|
47
|
-
{}
|
48
|
-
10/r4: expression → expression • "^" expression
|
49
|
-
{}
|
50
|
-
11/l2: expression → expression • "+" expression
|
51
|
-
{}
|
52
|
-
12/l2: expression → expression • "-" expression
|
53
|
-
{}
|
54
|
-
13/l3: expression → expression • "*" expression
|
55
|
-
{}
|
56
|
-
14/l3: expression → expression • "/" expression
|
57
|
-
{}
|
58
|
-
15/n1: expression → NUMBER •
|
59
|
-
{$end, "^", "+", "-", "*", "/", ")"}
|
60
|
-
16/n1: expression → "(" • expression ")"
|
61
|
-
{}
|
62
|
-
17/n1: expression → "(" • $error ")"
|
63
|
-
{}
|
64
|
-
26/n0: $start → expression $end •
|
65
|
-
{}
|
66
|
-
27/r4: expression → expression "^" • expression
|
67
|
-
{}
|
68
|
-
36/l2: expression → expression "+" • expression
|
69
|
-
{}
|
70
|
-
45/l2: expression → expression "-" • expression
|
71
|
-
{}
|
72
|
-
54/l3: expression → expression "*" • expression
|
73
|
-
{}
|
74
|
-
63/l3: expression → expression "/" • expression
|
75
|
-
{}
|
76
|
-
72/n1: expression → "(" expression • ")"
|
77
|
-
{}
|
78
|
-
78/n1: expression → "(" $error • ")"
|
79
|
-
{}
|
80
|
-
79/r4: expression → expression "^" expression •
|
81
|
-
{$end, "^", "+", "-", "*", "/", ")"}
|
82
|
-
85/l2: expression → expression "+" expression •
|
83
|
-
{$end, "^", "+", "-", "*", "/", ")"}
|
84
|
-
91/l2: expression → expression "-" expression •
|
85
|
-
{$end, "^", "+", "-", "*", "/", ")"}
|
86
|
-
97/l3: expression → expression "*" expression •
|
87
|
-
{$end, "^", "+", "-", "*", "/", ")"}
|
88
|
-
103/l3: expression → expression "/" expression •
|
89
|
-
{$end, "^", "+", "-", "*", "/", ")"}
|
90
|
-
109/n1: expression → "(" expression ")" •
|
91
|
-
{$end, "^", "+", "-", "*", "/", ")"}
|
92
|
-
110/n1: expression → "(" $error ")" •
|
93
|
-
{$end, "^", "+", "-", "*", "/", ")"}
|
94
|
-
transitions:
|
95
|
-
expression: State 1
|
96
|
-
NUMBER: State 2
|
97
|
-
"(": State 3
|
98
|
-
|
99
|
-
State 1:
|
100
|
-
9/n0: $start → expression • $end
|
101
|
-
{}
|
102
|
-
10/r4: expression → expression • "^" expression
|
103
|
-
{}
|
104
|
-
11/l2: expression → expression • "+" expression
|
105
|
-
{}
|
106
|
-
12/l2: expression → expression • "-" expression
|
107
|
-
{}
|
108
|
-
13/l3: expression → expression • "*" expression
|
109
|
-
{}
|
110
|
-
14/l3: expression → expression • "/" expression
|
111
|
-
{}
|
112
|
-
transitions:
|
113
|
-
$end: State 4
|
114
|
-
"^": State 5
|
115
|
-
"+": State 6
|
116
|
-
"-": State 7
|
117
|
-
"*": State 8
|
118
|
-
"/": State 9
|
119
|
-
|
120
|
-
State 2:
|
121
|
-
15/n1: expression → NUMBER •
|
122
|
-
{$end, "^", "+", "-", "*", "/", ")"}
|
123
|
-
reductions:
|
124
|
-
$default: Rule 1
|
125
|
-
|
126
|
-
State 3:
|
127
|
-
16/n1: expression → "(" • expression ")"
|
128
|
-
{}
|
129
|
-
17/n1: expression → "(" • $error ")"
|
130
|
-
{}
|
131
|
-
18/n1: expression → • NUMBER
|
132
|
-
{}
|
133
|
-
19/r4: expression → • expression "^" expression
|
134
|
-
{}
|
135
|
-
20/l2: expression → • expression "+" expression
|
136
|
-
{}
|
137
|
-
21/l2: expression → • expression "-" expression
|
138
|
-
{}
|
139
|
-
22/l3: expression → • expression "*" expression
|
140
|
-
{}
|
141
|
-
23/l3: expression → • expression "/" expression
|
142
|
-
{}
|
143
|
-
24/n1: expression → • "(" expression ")"
|
144
|
-
{}
|
145
|
-
25/n1: expression → • "(" $error ")"
|
146
|
-
{}
|
147
|
-
transitions:
|
148
|
-
expression: State 10
|
149
|
-
$error: State 11
|
150
|
-
NUMBER: State 2
|
151
|
-
"(": State 3
|
152
|
-
|
153
|
-
State 4:
|
154
|
-
26/n0: $start → expression $end •
|
155
|
-
{}
|
156
|
-
accepting:
|
157
|
-
$end: Rule 0
|
158
|
-
|
159
|
-
State 5:
|
160
|
-
27/r4: expression → expression "^" • expression
|
161
|
-
{}
|
162
|
-
28/n1: expression → • NUMBER
|
163
|
-
{}
|
164
|
-
29/r4: expression → • expression "^" expression
|
165
|
-
{}
|
166
|
-
30/l2: expression → • expression "+" expression
|
167
|
-
{}
|
168
|
-
31/l2: expression → • expression "-" expression
|
169
|
-
{}
|
170
|
-
32/l3: expression → • expression "*" expression
|
171
|
-
{}
|
172
|
-
33/l3: expression → • expression "/" expression
|
173
|
-
{}
|
174
|
-
34/n1: expression → • "(" expression ")"
|
175
|
-
{}
|
176
|
-
35/n1: expression → • "(" $error ")"
|
177
|
-
{}
|
178
|
-
transitions:
|
179
|
-
expression: State 12
|
180
|
-
NUMBER: State 2
|
181
|
-
"(": State 3
|
182
|
-
|
183
|
-
State 6:
|
184
|
-
36/l2: expression → expression "+" • expression
|
185
|
-
{}
|
186
|
-
37/n1: expression → • NUMBER
|
187
|
-
{}
|
188
|
-
38/r4: expression → • expression "^" expression
|
189
|
-
{}
|
190
|
-
39/l2: expression → • expression "+" expression
|
191
|
-
{}
|
192
|
-
40/l2: expression → • expression "-" expression
|
193
|
-
{}
|
194
|
-
41/l3: expression → • expression "*" expression
|
195
|
-
{}
|
196
|
-
42/l3: expression → • expression "/" expression
|
197
|
-
{}
|
198
|
-
43/n1: expression → • "(" expression ")"
|
199
|
-
{}
|
200
|
-
44/n1: expression → • "(" $error ")"
|
201
|
-
{}
|
202
|
-
transitions:
|
203
|
-
expression: State 13
|
204
|
-
NUMBER: State 2
|
205
|
-
"(": State 3
|
206
|
-
|
207
|
-
State 7:
|
208
|
-
45/l2: expression → expression "-" • expression
|
209
|
-
{}
|
210
|
-
46/n1: expression → • NUMBER
|
211
|
-
{}
|
212
|
-
47/r4: expression → • expression "^" expression
|
213
|
-
{}
|
214
|
-
48/l2: expression → • expression "+" expression
|
215
|
-
{}
|
216
|
-
49/l2: expression → • expression "-" expression
|
217
|
-
{}
|
218
|
-
50/l3: expression → • expression "*" expression
|
219
|
-
{}
|
220
|
-
51/l3: expression → • expression "/" expression
|
221
|
-
{}
|
222
|
-
52/n1: expression → • "(" expression ")"
|
223
|
-
{}
|
224
|
-
53/n1: expression → • "(" $error ")"
|
225
|
-
{}
|
226
|
-
transitions:
|
227
|
-
expression: State 14
|
228
|
-
NUMBER: State 2
|
229
|
-
"(": State 3
|
230
|
-
|
231
|
-
State 8:
|
232
|
-
54/l3: expression → expression "*" • expression
|
233
|
-
{}
|
234
|
-
55/n1: expression → • NUMBER
|
235
|
-
{}
|
236
|
-
56/r4: expression → • expression "^" expression
|
237
|
-
{}
|
238
|
-
57/l2: expression → • expression "+" expression
|
239
|
-
{}
|
240
|
-
58/l2: expression → • expression "-" expression
|
241
|
-
{}
|
242
|
-
59/l3: expression → • expression "*" expression
|
243
|
-
{}
|
244
|
-
60/l3: expression → • expression "/" expression
|
245
|
-
{}
|
246
|
-
61/n1: expression → • "(" expression ")"
|
247
|
-
{}
|
248
|
-
62/n1: expression → • "(" $error ")"
|
249
|
-
{}
|
250
|
-
transitions:
|
251
|
-
expression: State 15
|
252
|
-
NUMBER: State 2
|
253
|
-
"(": State 3
|
254
|
-
|
255
|
-
State 9:
|
256
|
-
63/l3: expression → expression "/" • expression
|
257
|
-
{}
|
258
|
-
64/n1: expression → • NUMBER
|
259
|
-
{}
|
260
|
-
65/r4: expression → • expression "^" expression
|
261
|
-
{}
|
262
|
-
66/l2: expression → • expression "+" expression
|
263
|
-
{}
|
264
|
-
67/l2: expression → • expression "-" expression
|
265
|
-
{}
|
266
|
-
68/l3: expression → • expression "*" expression
|
267
|
-
{}
|
268
|
-
69/l3: expression → • expression "/" expression
|
269
|
-
{}
|
270
|
-
70/n1: expression → • "(" expression ")"
|
271
|
-
{}
|
272
|
-
71/n1: expression → • "(" $error ")"
|
273
|
-
{}
|
274
|
-
transitions:
|
275
|
-
expression: State 16
|
276
|
-
NUMBER: State 2
|
277
|
-
"(": State 3
|
278
|
-
|
279
|
-
State 10:
|
280
|
-
72/n1: expression → "(" expression • ")"
|
281
|
-
{}
|
282
|
-
73/r4: expression → expression • "^" expression
|
283
|
-
{}
|
284
|
-
74/l2: expression → expression • "+" expression
|
285
|
-
{}
|
286
|
-
75/l2: expression → expression • "-" expression
|
287
|
-
{}
|
288
|
-
76/l3: expression → expression • "*" expression
|
289
|
-
{}
|
290
|
-
77/l3: expression → expression • "/" expression
|
291
|
-
{}
|
292
|
-
transitions:
|
293
|
-
")": State 17
|
294
|
-
"^": State 5
|
295
|
-
"+": State 6
|
296
|
-
"-": State 7
|
297
|
-
"*": State 8
|
298
|
-
"/": State 9
|
299
|
-
|
300
|
-
State 11:
|
301
|
-
78/n1: expression → "(" $error • ")"
|
302
|
-
{}
|
303
|
-
transitions:
|
304
|
-
")": State 18
|
305
|
-
|
306
|
-
State 12:
|
307
|
-
79/r4: expression → expression "^" expression •
|
308
|
-
{$end, "^", "+", "-", "*", "/", ")"}
|
309
|
-
80/r4: expression → expression • "^" expression
|
310
|
-
{}
|
311
|
-
81/l2: expression → expression • "+" expression
|
312
|
-
{}
|
313
|
-
82/l2: expression → expression • "-" expression
|
314
|
-
{}
|
315
|
-
83/l3: expression → expression • "*" expression
|
316
|
-
{}
|
317
|
-
84/l3: expression → expression • "/" expression
|
318
|
-
{}
|
319
|
-
transitions:
|
320
|
-
"^": State 5
|
321
|
-
reductions:
|
322
|
-
"+": Rule 2
|
323
|
-
"-": Rule 2
|
324
|
-
"*": Rule 2
|
325
|
-
"/": Rule 2
|
326
|
-
$end: Rule 2
|
327
|
-
")": Rule 2
|
328
|
-
|
329
|
-
State 13:
|
330
|
-
85/l2: expression → expression "+" expression •
|
331
|
-
{$end, "^", "+", "-", "*", "/", ")"}
|
332
|
-
86/r4: expression → expression • "^" expression
|
333
|
-
{}
|
334
|
-
87/l2: expression → expression • "+" expression
|
335
|
-
{}
|
336
|
-
88/l2: expression → expression • "-" expression
|
337
|
-
{}
|
338
|
-
89/l3: expression → expression • "*" expression
|
339
|
-
{}
|
340
|
-
90/l3: expression → expression • "/" expression
|
341
|
-
{}
|
342
|
-
transitions:
|
343
|
-
"^": State 5
|
344
|
-
"*": State 8
|
345
|
-
"/": State 9
|
346
|
-
reductions:
|
347
|
-
"+": Rule 3
|
348
|
-
"-": Rule 3
|
349
|
-
$end: Rule 3
|
350
|
-
")": Rule 3
|
351
|
-
|
352
|
-
State 14:
|
353
|
-
91/l2: expression → expression "-" expression •
|
354
|
-
{$end, "^", "+", "-", "*", "/", ")"}
|
355
|
-
92/r4: expression → expression • "^" expression
|
356
|
-
{}
|
357
|
-
93/l2: expression → expression • "+" expression
|
358
|
-
{}
|
359
|
-
94/l2: expression → expression • "-" expression
|
360
|
-
{}
|
361
|
-
95/l3: expression → expression • "*" expression
|
362
|
-
{}
|
363
|
-
96/l3: expression → expression • "/" expression
|
364
|
-
{}
|
365
|
-
transitions:
|
366
|
-
"^": State 5
|
367
|
-
"*": State 8
|
368
|
-
"/": State 9
|
369
|
-
reductions:
|
370
|
-
"+": Rule 4
|
371
|
-
"-": Rule 4
|
372
|
-
$end: Rule 4
|
373
|
-
")": Rule 4
|
374
|
-
|
375
|
-
State 15:
|
376
|
-
97/l3: expression → expression "*" expression •
|
377
|
-
{$end, "^", "+", "-", "*", "/", ")"}
|
378
|
-
98/r4: expression → expression • "^" expression
|
379
|
-
{}
|
380
|
-
99/l2: expression → expression • "+" expression
|
381
|
-
{}
|
382
|
-
100/l2: expression → expression • "-" expression
|
383
|
-
{}
|
384
|
-
101/l3: expression → expression • "*" expression
|
385
|
-
{}
|
386
|
-
102/l3: expression → expression • "/" expression
|
387
|
-
{}
|
388
|
-
transitions:
|
389
|
-
"^": State 5
|
390
|
-
reductions:
|
391
|
-
"+": Rule 5
|
392
|
-
"-": Rule 5
|
393
|
-
"*": Rule 5
|
394
|
-
"/": Rule 5
|
395
|
-
$end: Rule 5
|
396
|
-
")": Rule 5
|
397
|
-
|
398
|
-
State 16:
|
399
|
-
103/l3: expression → expression "/" expression •
|
400
|
-
{$end, "^", "+", "-", "*", "/", ")"}
|
401
|
-
104/r4: expression → expression • "^" expression
|
402
|
-
{}
|
403
|
-
105/l2: expression → expression • "+" expression
|
404
|
-
{}
|
405
|
-
106/l2: expression → expression • "-" expression
|
406
|
-
{}
|
407
|
-
107/l3: expression → expression • "*" expression
|
408
|
-
{}
|
409
|
-
108/l3: expression → expression • "/" expression
|
410
|
-
{}
|
411
|
-
transitions:
|
412
|
-
"^": State 5
|
413
|
-
reductions:
|
414
|
-
"+": Rule 6
|
415
|
-
"-": Rule 6
|
416
|
-
"*": Rule 6
|
417
|
-
"/": Rule 6
|
418
|
-
$end: Rule 6
|
419
|
-
")": Rule 6
|
420
|
-
|
421
|
-
State 17:
|
422
|
-
109/n1: expression → "(" expression ")" •
|
423
|
-
{$end, "^", "+", "-", "*", "/", ")"}
|
424
|
-
reductions:
|
425
|
-
$default: Rule 7
|
426
|
-
|
427
|
-
State 18:
|
428
|
-
110/n1: expression → "(" $error ")" •
|
429
|
-
{$end, "^", "+", "-", "*", "/", ")"}
|
430
|
-
reductions:
|
431
|
-
$default: Rule 8
|
432
|
-
|
1
|
+
Productions:
|
2
|
+
15/n1: expression → NUMBER { match[0][1] }
|
3
|
+
26/n0: $start → expression $end
|
4
|
+
79/r4: expression → expression "^" expression { match[0]** match[2] }
|
5
|
+
85/l2: expression → expression "+" expression { match[0] + match[2] }
|
6
|
+
91/l2: expression → expression "-" expression { match[0] - match[2] }
|
7
|
+
97/l3: expression → expression "*" expression { match[0] * match[2] }
|
8
|
+
103/l3: expression → expression "/" expression { match[0] / match[2] }
|
9
|
+
109/n1: expression → "(" expression ")" { match[1] }
|
10
|
+
110/n1: expression → "(" $error ")" { match[1] }
|
11
|
+
|
12
|
+
|
13
|
+
Precedence:
|
14
|
+
--- highest
|
15
|
+
right 4:
|
16
|
+
{EXPONENTIATE}
|
17
|
+
left 3:
|
18
|
+
{MULTIPLY, DIVIDE}
|
19
|
+
left 2:
|
20
|
+
{ADD, SUBTRACT}
|
21
|
+
nonassoc 1:
|
22
|
+
{_}
|
23
|
+
nonassoc 0:
|
24
|
+
{$end}
|
25
|
+
--- lowest
|
26
|
+
|
27
|
+
State 0:
|
28
|
+
0/n0: $start → • expression $end
|
29
|
+
{}
|
30
|
+
1/n1: expression → • NUMBER
|
31
|
+
{}
|
32
|
+
2/r4: expression → • expression "^" expression
|
33
|
+
{}
|
34
|
+
3/l2: expression → • expression "+" expression
|
35
|
+
{}
|
36
|
+
4/l2: expression → • expression "-" expression
|
37
|
+
{}
|
38
|
+
5/l3: expression → • expression "*" expression
|
39
|
+
{}
|
40
|
+
6/l3: expression → • expression "/" expression
|
41
|
+
{}
|
42
|
+
7/n1: expression → • "(" expression ")"
|
43
|
+
{}
|
44
|
+
8/n1: expression → • "(" $error ")"
|
45
|
+
{}
|
46
|
+
9/n0: $start → expression • $end
|
47
|
+
{}
|
48
|
+
10/r4: expression → expression • "^" expression
|
49
|
+
{}
|
50
|
+
11/l2: expression → expression • "+" expression
|
51
|
+
{}
|
52
|
+
12/l2: expression → expression • "-" expression
|
53
|
+
{}
|
54
|
+
13/l3: expression → expression • "*" expression
|
55
|
+
{}
|
56
|
+
14/l3: expression → expression • "/" expression
|
57
|
+
{}
|
58
|
+
15/n1: expression → NUMBER •
|
59
|
+
{$end, "^", "+", "-", "*", "/", ")"}
|
60
|
+
16/n1: expression → "(" • expression ")"
|
61
|
+
{}
|
62
|
+
17/n1: expression → "(" • $error ")"
|
63
|
+
{}
|
64
|
+
26/n0: $start → expression $end •
|
65
|
+
{}
|
66
|
+
27/r4: expression → expression "^" • expression
|
67
|
+
{}
|
68
|
+
36/l2: expression → expression "+" • expression
|
69
|
+
{}
|
70
|
+
45/l2: expression → expression "-" • expression
|
71
|
+
{}
|
72
|
+
54/l3: expression → expression "*" • expression
|
73
|
+
{}
|
74
|
+
63/l3: expression → expression "/" • expression
|
75
|
+
{}
|
76
|
+
72/n1: expression → "(" expression • ")"
|
77
|
+
{}
|
78
|
+
78/n1: expression → "(" $error • ")"
|
79
|
+
{}
|
80
|
+
79/r4: expression → expression "^" expression •
|
81
|
+
{$end, "^", "+", "-", "*", "/", ")"}
|
82
|
+
85/l2: expression → expression "+" expression •
|
83
|
+
{$end, "^", "+", "-", "*", "/", ")"}
|
84
|
+
91/l2: expression → expression "-" expression •
|
85
|
+
{$end, "^", "+", "-", "*", "/", ")"}
|
86
|
+
97/l3: expression → expression "*" expression •
|
87
|
+
{$end, "^", "+", "-", "*", "/", ")"}
|
88
|
+
103/l3: expression → expression "/" expression •
|
89
|
+
{$end, "^", "+", "-", "*", "/", ")"}
|
90
|
+
109/n1: expression → "(" expression ")" •
|
91
|
+
{$end, "^", "+", "-", "*", "/", ")"}
|
92
|
+
110/n1: expression → "(" $error ")" •
|
93
|
+
{$end, "^", "+", "-", "*", "/", ")"}
|
94
|
+
transitions:
|
95
|
+
expression: State 1
|
96
|
+
NUMBER: State 2
|
97
|
+
"(": State 3
|
98
|
+
|
99
|
+
State 1:
|
100
|
+
9/n0: $start → expression • $end
|
101
|
+
{}
|
102
|
+
10/r4: expression → expression • "^" expression
|
103
|
+
{}
|
104
|
+
11/l2: expression → expression • "+" expression
|
105
|
+
{}
|
106
|
+
12/l2: expression → expression • "-" expression
|
107
|
+
{}
|
108
|
+
13/l3: expression → expression • "*" expression
|
109
|
+
{}
|
110
|
+
14/l3: expression → expression • "/" expression
|
111
|
+
{}
|
112
|
+
transitions:
|
113
|
+
$end: State 4
|
114
|
+
"^": State 5
|
115
|
+
"+": State 6
|
116
|
+
"-": State 7
|
117
|
+
"*": State 8
|
118
|
+
"/": State 9
|
119
|
+
|
120
|
+
State 2:
|
121
|
+
15/n1: expression → NUMBER •
|
122
|
+
{$end, "^", "+", "-", "*", "/", ")"}
|
123
|
+
reductions:
|
124
|
+
$default: Rule 1
|
125
|
+
|
126
|
+
State 3:
|
127
|
+
16/n1: expression → "(" • expression ")"
|
128
|
+
{}
|
129
|
+
17/n1: expression → "(" • $error ")"
|
130
|
+
{}
|
131
|
+
18/n1: expression → • NUMBER
|
132
|
+
{}
|
133
|
+
19/r4: expression → • expression "^" expression
|
134
|
+
{}
|
135
|
+
20/l2: expression → • expression "+" expression
|
136
|
+
{}
|
137
|
+
21/l2: expression → • expression "-" expression
|
138
|
+
{}
|
139
|
+
22/l3: expression → • expression "*" expression
|
140
|
+
{}
|
141
|
+
23/l3: expression → • expression "/" expression
|
142
|
+
{}
|
143
|
+
24/n1: expression → • "(" expression ")"
|
144
|
+
{}
|
145
|
+
25/n1: expression → • "(" $error ")"
|
146
|
+
{}
|
147
|
+
transitions:
|
148
|
+
expression: State 10
|
149
|
+
$error: State 11
|
150
|
+
NUMBER: State 2
|
151
|
+
"(": State 3
|
152
|
+
|
153
|
+
State 4:
|
154
|
+
26/n0: $start → expression $end •
|
155
|
+
{}
|
156
|
+
accepting:
|
157
|
+
$end: Rule 0
|
158
|
+
|
159
|
+
State 5:
|
160
|
+
27/r4: expression → expression "^" • expression
|
161
|
+
{}
|
162
|
+
28/n1: expression → • NUMBER
|
163
|
+
{}
|
164
|
+
29/r4: expression → • expression "^" expression
|
165
|
+
{}
|
166
|
+
30/l2: expression → • expression "+" expression
|
167
|
+
{}
|
168
|
+
31/l2: expression → • expression "-" expression
|
169
|
+
{}
|
170
|
+
32/l3: expression → • expression "*" expression
|
171
|
+
{}
|
172
|
+
33/l3: expression → • expression "/" expression
|
173
|
+
{}
|
174
|
+
34/n1: expression → • "(" expression ")"
|
175
|
+
{}
|
176
|
+
35/n1: expression → • "(" $error ")"
|
177
|
+
{}
|
178
|
+
transitions:
|
179
|
+
expression: State 12
|
180
|
+
NUMBER: State 2
|
181
|
+
"(": State 3
|
182
|
+
|
183
|
+
State 6:
|
184
|
+
36/l2: expression → expression "+" • expression
|
185
|
+
{}
|
186
|
+
37/n1: expression → • NUMBER
|
187
|
+
{}
|
188
|
+
38/r4: expression → • expression "^" expression
|
189
|
+
{}
|
190
|
+
39/l2: expression → • expression "+" expression
|
191
|
+
{}
|
192
|
+
40/l2: expression → • expression "-" expression
|
193
|
+
{}
|
194
|
+
41/l3: expression → • expression "*" expression
|
195
|
+
{}
|
196
|
+
42/l3: expression → • expression "/" expression
|
197
|
+
{}
|
198
|
+
43/n1: expression → • "(" expression ")"
|
199
|
+
{}
|
200
|
+
44/n1: expression → • "(" $error ")"
|
201
|
+
{}
|
202
|
+
transitions:
|
203
|
+
expression: State 13
|
204
|
+
NUMBER: State 2
|
205
|
+
"(": State 3
|
206
|
+
|
207
|
+
State 7:
|
208
|
+
45/l2: expression → expression "-" • expression
|
209
|
+
{}
|
210
|
+
46/n1: expression → • NUMBER
|
211
|
+
{}
|
212
|
+
47/r4: expression → • expression "^" expression
|
213
|
+
{}
|
214
|
+
48/l2: expression → • expression "+" expression
|
215
|
+
{}
|
216
|
+
49/l2: expression → • expression "-" expression
|
217
|
+
{}
|
218
|
+
50/l3: expression → • expression "*" expression
|
219
|
+
{}
|
220
|
+
51/l3: expression → • expression "/" expression
|
221
|
+
{}
|
222
|
+
52/n1: expression → • "(" expression ")"
|
223
|
+
{}
|
224
|
+
53/n1: expression → • "(" $error ")"
|
225
|
+
{}
|
226
|
+
transitions:
|
227
|
+
expression: State 14
|
228
|
+
NUMBER: State 2
|
229
|
+
"(": State 3
|
230
|
+
|
231
|
+
State 8:
|
232
|
+
54/l3: expression → expression "*" • expression
|
233
|
+
{}
|
234
|
+
55/n1: expression → • NUMBER
|
235
|
+
{}
|
236
|
+
56/r4: expression → • expression "^" expression
|
237
|
+
{}
|
238
|
+
57/l2: expression → • expression "+" expression
|
239
|
+
{}
|
240
|
+
58/l2: expression → • expression "-" expression
|
241
|
+
{}
|
242
|
+
59/l3: expression → • expression "*" expression
|
243
|
+
{}
|
244
|
+
60/l3: expression → • expression "/" expression
|
245
|
+
{}
|
246
|
+
61/n1: expression → • "(" expression ")"
|
247
|
+
{}
|
248
|
+
62/n1: expression → • "(" $error ")"
|
249
|
+
{}
|
250
|
+
transitions:
|
251
|
+
expression: State 15
|
252
|
+
NUMBER: State 2
|
253
|
+
"(": State 3
|
254
|
+
|
255
|
+
State 9:
|
256
|
+
63/l3: expression → expression "/" • expression
|
257
|
+
{}
|
258
|
+
64/n1: expression → • NUMBER
|
259
|
+
{}
|
260
|
+
65/r4: expression → • expression "^" expression
|
261
|
+
{}
|
262
|
+
66/l2: expression → • expression "+" expression
|
263
|
+
{}
|
264
|
+
67/l2: expression → • expression "-" expression
|
265
|
+
{}
|
266
|
+
68/l3: expression → • expression "*" expression
|
267
|
+
{}
|
268
|
+
69/l3: expression → • expression "/" expression
|
269
|
+
{}
|
270
|
+
70/n1: expression → • "(" expression ")"
|
271
|
+
{}
|
272
|
+
71/n1: expression → • "(" $error ")"
|
273
|
+
{}
|
274
|
+
transitions:
|
275
|
+
expression: State 16
|
276
|
+
NUMBER: State 2
|
277
|
+
"(": State 3
|
278
|
+
|
279
|
+
State 10:
|
280
|
+
72/n1: expression → "(" expression • ")"
|
281
|
+
{}
|
282
|
+
73/r4: expression → expression • "^" expression
|
283
|
+
{}
|
284
|
+
74/l2: expression → expression • "+" expression
|
285
|
+
{}
|
286
|
+
75/l2: expression → expression • "-" expression
|
287
|
+
{}
|
288
|
+
76/l3: expression → expression • "*" expression
|
289
|
+
{}
|
290
|
+
77/l3: expression → expression • "/" expression
|
291
|
+
{}
|
292
|
+
transitions:
|
293
|
+
")": State 17
|
294
|
+
"^": State 5
|
295
|
+
"+": State 6
|
296
|
+
"-": State 7
|
297
|
+
"*": State 8
|
298
|
+
"/": State 9
|
299
|
+
|
300
|
+
State 11:
|
301
|
+
78/n1: expression → "(" $error • ")"
|
302
|
+
{}
|
303
|
+
transitions:
|
304
|
+
")": State 18
|
305
|
+
|
306
|
+
State 12:
|
307
|
+
79/r4: expression → expression "^" expression •
|
308
|
+
{$end, "^", "+", "-", "*", "/", ")"}
|
309
|
+
80/r4: expression → expression • "^" expression
|
310
|
+
{}
|
311
|
+
81/l2: expression → expression • "+" expression
|
312
|
+
{}
|
313
|
+
82/l2: expression → expression • "-" expression
|
314
|
+
{}
|
315
|
+
83/l3: expression → expression • "*" expression
|
316
|
+
{}
|
317
|
+
84/l3: expression → expression • "/" expression
|
318
|
+
{}
|
319
|
+
transitions:
|
320
|
+
"^": State 5
|
321
|
+
reductions:
|
322
|
+
"+": Rule 2
|
323
|
+
"-": Rule 2
|
324
|
+
"*": Rule 2
|
325
|
+
"/": Rule 2
|
326
|
+
$end: Rule 2
|
327
|
+
")": Rule 2
|
328
|
+
|
329
|
+
State 13:
|
330
|
+
85/l2: expression → expression "+" expression •
|
331
|
+
{$end, "^", "+", "-", "*", "/", ")"}
|
332
|
+
86/r4: expression → expression • "^" expression
|
333
|
+
{}
|
334
|
+
87/l2: expression → expression • "+" expression
|
335
|
+
{}
|
336
|
+
88/l2: expression → expression • "-" expression
|
337
|
+
{}
|
338
|
+
89/l3: expression → expression • "*" expression
|
339
|
+
{}
|
340
|
+
90/l3: expression → expression • "/" expression
|
341
|
+
{}
|
342
|
+
transitions:
|
343
|
+
"^": State 5
|
344
|
+
"*": State 8
|
345
|
+
"/": State 9
|
346
|
+
reductions:
|
347
|
+
"+": Rule 3
|
348
|
+
"-": Rule 3
|
349
|
+
$end: Rule 3
|
350
|
+
")": Rule 3
|
351
|
+
|
352
|
+
State 14:
|
353
|
+
91/l2: expression → expression "-" expression •
|
354
|
+
{$end, "^", "+", "-", "*", "/", ")"}
|
355
|
+
92/r4: expression → expression • "^" expression
|
356
|
+
{}
|
357
|
+
93/l2: expression → expression • "+" expression
|
358
|
+
{}
|
359
|
+
94/l2: expression → expression • "-" expression
|
360
|
+
{}
|
361
|
+
95/l3: expression → expression • "*" expression
|
362
|
+
{}
|
363
|
+
96/l3: expression → expression • "/" expression
|
364
|
+
{}
|
365
|
+
transitions:
|
366
|
+
"^": State 5
|
367
|
+
"*": State 8
|
368
|
+
"/": State 9
|
369
|
+
reductions:
|
370
|
+
"+": Rule 4
|
371
|
+
"-": Rule 4
|
372
|
+
$end: Rule 4
|
373
|
+
")": Rule 4
|
374
|
+
|
375
|
+
State 15:
|
376
|
+
97/l3: expression → expression "*" expression •
|
377
|
+
{$end, "^", "+", "-", "*", "/", ")"}
|
378
|
+
98/r4: expression → expression • "^" expression
|
379
|
+
{}
|
380
|
+
99/l2: expression → expression • "+" expression
|
381
|
+
{}
|
382
|
+
100/l2: expression → expression • "-" expression
|
383
|
+
{}
|
384
|
+
101/l3: expression → expression • "*" expression
|
385
|
+
{}
|
386
|
+
102/l3: expression → expression • "/" expression
|
387
|
+
{}
|
388
|
+
transitions:
|
389
|
+
"^": State 5
|
390
|
+
reductions:
|
391
|
+
"+": Rule 5
|
392
|
+
"-": Rule 5
|
393
|
+
"*": Rule 5
|
394
|
+
"/": Rule 5
|
395
|
+
$end: Rule 5
|
396
|
+
")": Rule 5
|
397
|
+
|
398
|
+
State 16:
|
399
|
+
103/l3: expression → expression "/" expression •
|
400
|
+
{$end, "^", "+", "-", "*", "/", ")"}
|
401
|
+
104/r4: expression → expression • "^" expression
|
402
|
+
{}
|
403
|
+
105/l2: expression → expression • "+" expression
|
404
|
+
{}
|
405
|
+
106/l2: expression → expression • "-" expression
|
406
|
+
{}
|
407
|
+
107/l3: expression → expression • "*" expression
|
408
|
+
{}
|
409
|
+
108/l3: expression → expression • "/" expression
|
410
|
+
{}
|
411
|
+
transitions:
|
412
|
+
"^": State 5
|
413
|
+
reductions:
|
414
|
+
"+": Rule 6
|
415
|
+
"-": Rule 6
|
416
|
+
"*": Rule 6
|
417
|
+
"/": Rule 6
|
418
|
+
$end: Rule 6
|
419
|
+
")": Rule 6
|
420
|
+
|
421
|
+
State 17:
|
422
|
+
109/n1: expression → "(" expression ")" •
|
423
|
+
{$end, "^", "+", "-", "*", "/", ")"}
|
424
|
+
reductions:
|
425
|
+
$default: Rule 7
|
426
|
+
|
427
|
+
State 18:
|
428
|
+
110/n1: expression → "(" $error ")" •
|
429
|
+
{$end, "^", "+", "-", "*", "/", ")"}
|
430
|
+
reductions:
|
431
|
+
$default: Rule 8
|
432
|
+
|