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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
|
0 $accept : list $end
1 list :
2 | list stat '\n'
3 | list error '\n'
4 stat : expr
5 | LETTER '=' expr
6 expr : '(' expr ')'
7 | expr OP_ADD expr
8 | expr OP_SUB expr
9 | expr OP_MUL expr
10 | expr OP_DIV expr
11 | expr OP_MOD expr
12 | expr OP_AND expr
13 | expr '|' expr
14 | OP_SUB expr
15 | LETTER
16 | number
17 number : DIGIT
18 | number DIGIT
state 0
$accept : . list $end (0)
list : . (1)
. reduce 1
list goto 1
state 1
$accept : list . $end (0)
list : list . stat '\n' (2)
list : list . error '\n' (3)
$end accept
error shift 2
OP_SUB shift 3
DIGIT shift 4
LETTER shift 5
'(' shift 6
. error
stat goto 7
expr goto 8
number goto 9
state 2
list : list error . '\n' (3)
'\n' shift 10
. error
state 3
expr : OP_SUB . expr (14)
OP_SUB shift 3
DIGIT shift 4
LETTER shift 11
'(' shift 6
. error
expr goto 12
number goto 9
state 4
number : DIGIT . (17)
. reduce 17
state 5
stat : LETTER . '=' expr (5)
expr : LETTER . (15)
'=' shift 13
OP_ADD reduce 15
OP_SUB reduce 15
OP_MUL reduce 15
OP_DIV reduce 15
OP_MOD reduce 15
OP_AND reduce 15
'|' reduce 15
'\n' reduce 15
state 6
expr : '(' . expr ')' (6)
OP_SUB shift 3
DIGIT shift 4
LETTER shift 11
'(' shift 6
. error
expr goto 14
number goto 9
state 7
list : list stat . '\n' (2)
'\n' shift 15
. error
state 8
stat : expr . (4)
expr : expr . OP_ADD expr (7)
expr : expr . OP_SUB expr (8)
expr : expr . OP_MUL expr (9)
expr : expr . OP_DIV expr (10)
expr : expr . OP_MOD expr (11)
expr : expr . OP_AND expr (12)
expr : expr . '|' expr (13)
OP_ADD shift 16
OP_SUB shift 17
OP_MUL shift 18
OP_DIV shift 19
OP_MOD shift 20
OP_AND shift 21
'|' shift 22
'\n' reduce 4
state 9
expr : number . (16)
number : number . DIGIT (18)
DIGIT shift 23
OP_ADD reduce 16
OP_SUB reduce 16
OP_MUL reduce 16
OP_DIV reduce 16
OP_MOD reduce 16
OP_AND reduce 16
'|' reduce 16
'\n' reduce 16
')' reduce 16
state 10
list : list error '\n' . (3)
. reduce 3
state 11
expr : LETTER . (15)
. reduce 15
12: shift/reduce conflict (shift 16, reduce 14) on OP_ADD
12: shift/reduce conflict (shift 17, reduce 14) on OP_SUB
12: shift/reduce conflict (shift 18, reduce 14) on OP_MUL
12: shift/reduce conflict (shift 19, reduce 14) on OP_DIV
12: shift/reduce conflict (shift 20, reduce 14) on OP_MOD
12: shift/reduce conflict (shift 21, reduce 14) on OP_AND
state 12
expr : expr . OP_ADD expr (7)
expr : expr . OP_SUB expr (8)
expr : expr . OP_MUL expr (9)
expr : expr . OP_DIV expr (10)
expr : expr . OP_MOD expr (11)
expr : expr . OP_AND expr (12)
expr : expr . '|' expr (13)
expr : OP_SUB expr . (14)
OP_ADD shift 16
OP_SUB shift 17
OP_MUL shift 18
OP_DIV shift 19
OP_MOD shift 20
OP_AND shift 21
'|' reduce 14
'\n' reduce 14
')' reduce 14
state 13
stat : LETTER '=' . expr (5)
OP_SUB shift 3
DIGIT shift 4
LETTER shift 11
'(' shift 6
. error
expr goto 24
number goto 9
state 14
expr : '(' expr . ')' (6)
expr : expr . OP_ADD expr (7)
expr : expr . OP_SUB expr (8)
expr : expr . OP_MUL expr (9)
expr : expr . OP_DIV expr (10)
expr : expr . OP_MOD expr (11)
expr : expr . OP_AND expr (12)
expr : expr . '|' expr (13)
OP_ADD shift 16
OP_SUB shift 17
OP_MUL shift 18
OP_DIV shift 19
OP_MOD shift 20
OP_AND shift 21
'|' shift 22
')' shift 25
. error
state 15
list : list stat '\n' . (2)
. reduce 2
state 16
expr : expr OP_ADD . expr (7)
OP_SUB shift 3
DIGIT shift 4
LETTER shift 11
'(' shift 6
. error
expr goto 26
number goto 9
state 17
expr : expr OP_SUB . expr (8)
OP_SUB shift 3
DIGIT shift 4
LETTER shift 11
'(' shift 6
. error
expr goto 27
number goto 9
state 18
expr : expr OP_MUL . expr (9)
OP_SUB shift 3
DIGIT shift 4
LETTER shift 11
'(' shift 6
. error
expr goto 28
number goto 9
state 19
expr : expr OP_DIV . expr (10)
OP_SUB shift 3
DIGIT shift 4
LETTER shift 11
'(' shift 6
. error
expr goto 29
number goto 9
state 20
expr : expr OP_MOD . expr (11)
OP_SUB shift 3
DIGIT shift 4
LETTER shift 11
'(' shift 6
. error
expr goto 30
number goto 9
state 21
expr : expr OP_AND . expr (12)
OP_SUB shift 3
DIGIT shift 4
LETTER shift 11
'(' shift 6
. error
expr goto 31
number goto 9
state 22
expr : expr '|' . expr (13)
OP_SUB shift 3
DIGIT shift 4
LETTER shift 11
'(' shift 6
. error
expr goto 32
number goto 9
state 23
number : number DIGIT . (18)
. reduce 18
state 24
stat : LETTER '=' expr . (5)
expr : expr . OP_ADD expr (7)
expr : expr . OP_SUB expr (8)
expr : expr . OP_MUL expr (9)
expr : expr . OP_DIV expr (10)
expr : expr . OP_MOD expr (11)
expr : expr . OP_AND expr (12)
expr : expr . '|' expr (13)
OP_ADD shift 16
OP_SUB shift 17
OP_MUL shift 18
OP_DIV shift 19
OP_MOD shift 20
OP_AND shift 21
'|' shift 22
'\n' reduce 5
state 25
expr : '(' expr ')' . (6)
. reduce 6
26: shift/reduce conflict (shift 16, reduce 7) on OP_ADD
26: shift/reduce conflict (shift 17, reduce 7) on OP_SUB
26: shift/reduce conflict (shift 18, reduce 7) on OP_MUL
26: shift/reduce conflict (shift 19, reduce 7) on OP_DIV
26: shift/reduce conflict (shift 20, reduce 7) on OP_MOD
26: shift/reduce conflict (shift 21, reduce 7) on OP_AND
26: shift/reduce conflict (shift 22, reduce 7) on '|'
state 26
expr : expr . OP_ADD expr (7)
expr : expr OP_ADD expr . (7)
expr : expr . OP_SUB expr (8)
expr : expr . OP_MUL expr (9)
expr : expr . OP_DIV expr (10)
expr : expr . OP_MOD expr (11)
expr : expr . OP_AND expr (12)
expr : expr . '|' expr (13)
OP_ADD shift 16
OP_SUB shift 17
OP_MUL shift 18
OP_DIV shift 19
OP_MOD shift 20
OP_AND shift 21
'|' shift 22
'\n' reduce 7
')' reduce 7
27: shift/reduce conflict (shift 16, reduce 8) on OP_ADD
27: shift/reduce conflict (shift 17, reduce 8) on OP_SUB
27: shift/reduce conflict (shift 18, reduce 8) on OP_MUL
27: shift/reduce conflict (shift 19, reduce 8) on OP_DIV
27: shift/reduce conflict (shift 20, reduce 8) on OP_MOD
27: shift/reduce conflict (shift 21, reduce 8) on OP_AND
27: shift/reduce conflict (shift 22, reduce 8) on '|'
state 27
expr : expr . OP_ADD expr (7)
expr : expr . OP_SUB expr (8)
expr : expr OP_SUB expr . (8)
expr : expr . OP_MUL expr (9)
expr : expr . OP_DIV expr (10)
expr : expr . OP_MOD expr (11)
expr : expr . OP_AND expr (12)
expr : expr . '|' expr (13)
OP_ADD shift 16
OP_SUB shift 17
OP_MUL shift 18
OP_DIV shift 19
OP_MOD shift 20
OP_AND shift 21
'|' shift 22
'\n' reduce 8
')' reduce 8
28: shift/reduce conflict (shift 16, reduce 9) on OP_ADD
28: shift/reduce conflict (shift 17, reduce 9) on OP_SUB
28: shift/reduce conflict (shift 18, reduce 9) on OP_MUL
28: shift/reduce conflict (shift 19, reduce 9) on OP_DIV
28: shift/reduce conflict (shift 20, reduce 9) on OP_MOD
28: shift/reduce conflict (shift 21, reduce 9) on OP_AND
28: shift/reduce conflict (shift 22, reduce 9) on '|'
state 28
expr : expr . OP_ADD expr (7)
expr : expr . OP_SUB expr (8)
expr : expr . OP_MUL expr (9)
expr : expr OP_MUL expr . (9)
expr : expr . OP_DIV expr (10)
expr : expr . OP_MOD expr (11)
expr : expr . OP_AND expr (12)
expr : expr . '|' expr (13)
OP_ADD shift 16
OP_SUB shift 17
OP_MUL shift 18
OP_DIV shift 19
OP_MOD shift 20
OP_AND shift 21
'|' shift 22
'\n' reduce 9
')' reduce 9
29: shift/reduce conflict (shift 16, reduce 10) on OP_ADD
29: shift/reduce conflict (shift 17, reduce 10) on OP_SUB
29: shift/reduce conflict (shift 18, reduce 10) on OP_MUL
29: shift/reduce conflict (shift 19, reduce 10) on OP_DIV
29: shift/reduce conflict (shift 20, reduce 10) on OP_MOD
29: shift/reduce conflict (shift 21, reduce 10) on OP_AND
29: shift/reduce conflict (shift 22, reduce 10) on '|'
state 29
expr : expr . OP_ADD expr (7)
expr : expr . OP_SUB expr (8)
expr : expr . OP_MUL expr (9)
expr : expr . OP_DIV expr (10)
expr : expr OP_DIV expr . (10)
expr : expr . OP_MOD expr (11)
expr : expr . OP_AND expr (12)
expr : expr . '|' expr (13)
OP_ADD shift 16
OP_SUB shift 17
OP_MUL shift 18
OP_DIV shift 19
OP_MOD shift 20
OP_AND shift 21
'|' shift 22
'\n' reduce 10
')' reduce 10
30: shift/reduce conflict (shift 16, reduce 11) on OP_ADD
30: shift/reduce conflict (shift 17, reduce 11) on OP_SUB
30: shift/reduce conflict (shift 18, reduce 11) on OP_MUL
30: shift/reduce conflict (shift 19, reduce 11) on OP_DIV
30: shift/reduce conflict (shift 20, reduce 11) on OP_MOD
30: shift/reduce conflict (shift 21, reduce 11) on OP_AND
30: shift/reduce conflict (shift 22, reduce 11) on '|'
state 30
expr : expr . OP_ADD expr (7)
expr : expr . OP_SUB expr (8)
expr : expr . OP_MUL expr (9)
expr : expr . OP_DIV expr (10)
expr : expr . OP_MOD expr (11)
expr : expr OP_MOD expr . (11)
expr : expr . OP_AND expr (12)
expr : expr . '|' expr (13)
OP_ADD shift 16
OP_SUB shift 17
OP_MUL shift 18
OP_DIV shift 19
OP_MOD shift 20
OP_AND shift 21
'|' shift 22
'\n' reduce 11
')' reduce 11
31: shift/reduce conflict (shift 16, reduce 12) on OP_ADD
31: shift/reduce conflict (shift 17, reduce 12) on OP_SUB
31: shift/reduce conflict (shift 18, reduce 12) on OP_MUL
31: shift/reduce conflict (shift 19, reduce 12) on OP_DIV
31: shift/reduce conflict (shift 20, reduce 12) on OP_MOD
31: shift/reduce conflict (shift 21, reduce 12) on OP_AND
31: shift/reduce conflict (shift 22, reduce 12) on '|'
state 31
expr : expr . OP_ADD expr (7)
expr : expr . OP_SUB expr (8)
expr : expr . OP_MUL expr (9)
expr : expr . OP_DIV expr (10)
expr : expr . OP_MOD expr (11)
expr : expr . OP_AND expr (12)
expr : expr OP_AND expr . (12)
expr : expr . '|' expr (13)
OP_ADD shift 16
OP_SUB shift 17
OP_MUL shift 18
OP_DIV shift 19
OP_MOD shift 20
OP_AND shift 21
'|' shift 22
'\n' reduce 12
')' reduce 12
32: shift/reduce conflict (shift 16, reduce 13) on OP_ADD
32: shift/reduce conflict (shift 17, reduce 13) on OP_SUB
32: shift/reduce conflict (shift 18, reduce 13) on OP_MUL
32: shift/reduce conflict (shift 19, reduce 13) on OP_DIV
32: shift/reduce conflict (shift 20, reduce 13) on OP_MOD
32: shift/reduce conflict (shift 21, reduce 13) on OP_AND
state 32
expr : expr . OP_ADD expr (7)
expr : expr . OP_SUB expr (8)
expr : expr . OP_MUL expr (9)
expr : expr . OP_DIV expr (10)
expr : expr . OP_MOD expr (11)
expr : expr . OP_AND expr (12)
expr : expr . '|' expr (13)
expr : expr '|' expr . (13)
OP_ADD shift 16
OP_SUB shift 17
OP_MUL shift 18
OP_DIV shift 19
OP_MOD shift 20
OP_AND shift 21
'|' reduce 13
'\n' reduce 13
')' reduce 13
State 12 contains 6 shift/reduce conflicts.
State 26 contains 7 shift/reduce conflicts.
State 27 contains 7 shift/reduce conflicts.
State 28 contains 7 shift/reduce conflicts.
State 29 contains 7 shift/reduce conflicts.
State 30 contains 7 shift/reduce conflicts.
State 31 contains 7 shift/reduce conflicts.
State 32 contains 6 shift/reduce conflicts.
28 terminals, 5 nonterminals
19 grammar rules, 33 states
|