-
Notifications
You must be signed in to change notification settings - Fork 0
/
y.output
515 lines (345 loc) · 8.47 KB
/
y.output
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
0 $accept : program $end
1 program : PROGRAMnumber IDnumber ISnumber BEGINnumber body ENDnumber
2 body :
3 | body statement SEMInumber
4 statement : print_statement
5 | variable_declaration
6 | assignment
7 assignment : IDnumber EQnumber expr
8 | IDnumber EQnumber STRINGnumber
9 expr : expr PLUSnumber t
10 | expr MINUSnumber t
11 | t
12 | MINUSnumber t
13 t : t TIMESnumber f
14 | t DIVnumber f
15 | f
16 f : IDnumber
17 | ICONSTnumber
18 | LPARENnumber expr RPARENnumber
19 variable_declaration : type var_list
20 var_list :
21 | var_list IDnumber
22 | var_list IDnumber COMMAnumber
23 type : VARINTnumber
24 | VARSTRnumber
25 print_statement : PRINTnumber print_argument
26 print_argument :
27 | print_argument expr
28 | print_argument DOTnumber expr
29 | print_argument STRINGnumber
30 | print_argument DOTnumber STRINGnumber
state 0
$accept : . program $end (0)
PROGRAMnumber shift 1
. error
program goto 2
state 1
program : PROGRAMnumber . IDnumber ISnumber BEGINnumber body ENDnumber (1)
IDnumber shift 3
. error
state 2
$accept : program . $end (0)
$end accept
state 3
program : PROGRAMnumber IDnumber . ISnumber BEGINnumber body ENDnumber (1)
ISnumber shift 4
. error
state 4
program : PROGRAMnumber IDnumber ISnumber . BEGINnumber body ENDnumber (1)
BEGINnumber shift 5
. error
state 5
program : PROGRAMnumber IDnumber ISnumber BEGINnumber . body ENDnumber (1)
body : . (2)
. reduce 2
body goto 6
state 6
program : PROGRAMnumber IDnumber ISnumber BEGINnumber body . ENDnumber (1)
body : body . statement SEMInumber (3)
PRINTnumber shift 7
ENDnumber shift 8
VARINTnumber shift 9
VARSTRnumber shift 10
IDnumber shift 11
. error
statement goto 12
print_statement goto 13
variable_declaration goto 14
assignment goto 15
type goto 16
state 7
print_statement : PRINTnumber . print_argument (25)
print_argument : . (26)
. reduce 26
print_argument goto 17
state 8
program : PROGRAMnumber IDnumber ISnumber BEGINnumber body ENDnumber . (1)
. reduce 1
state 9
type : VARINTnumber . (23)
. reduce 23
state 10
type : VARSTRnumber . (24)
. reduce 24
state 11
assignment : IDnumber . EQnumber expr (7)
assignment : IDnumber . EQnumber STRINGnumber (8)
EQnumber shift 18
. error
state 12
body : body statement . SEMInumber (3)
SEMInumber shift 19
. error
state 13
statement : print_statement . (4)
. reduce 4
state 14
statement : variable_declaration . (5)
. reduce 5
state 15
statement : assignment . (6)
. reduce 6
state 16
variable_declaration : type . var_list (19)
var_list : . (20)
. reduce 20
var_list goto 20
state 17
print_statement : PRINTnumber print_argument . (25)
print_argument : print_argument . expr (27)
print_argument : print_argument . DOTnumber expr (28)
print_argument : print_argument . STRINGnumber (29)
print_argument : print_argument . DOTnumber STRINGnumber (30)
MINUSnumber shift 21
DOTnumber shift 22
LPARENnumber shift 23
STRINGnumber shift 24
ICONSTnumber shift 25
IDnumber shift 26
SEMInumber reduce 25
f goto 27
t goto 28
expr goto 29
state 18
assignment : IDnumber EQnumber . expr (7)
assignment : IDnumber EQnumber . STRINGnumber (8)
MINUSnumber shift 21
LPARENnumber shift 23
STRINGnumber shift 30
ICONSTnumber shift 25
IDnumber shift 26
. error
f goto 27
t goto 28
expr goto 31
state 19
body : body statement SEMInumber . (3)
. reduce 3
state 20
variable_declaration : type var_list . (19)
var_list : var_list . IDnumber (21)
var_list : var_list . IDnumber COMMAnumber (22)
IDnumber shift 32
SEMInumber reduce 19
state 21
expr : MINUSnumber . t (12)
LPARENnumber shift 23
ICONSTnumber shift 25
IDnumber shift 26
. error
f goto 27
t goto 33
state 22
print_argument : print_argument DOTnumber . expr (28)
print_argument : print_argument DOTnumber . STRINGnumber (30)
MINUSnumber shift 21
LPARENnumber shift 23
STRINGnumber shift 34
ICONSTnumber shift 25
IDnumber shift 26
. error
f goto 27
t goto 28
expr goto 35
state 23
f : LPARENnumber . expr RPARENnumber (18)
MINUSnumber shift 21
LPARENnumber shift 23
ICONSTnumber shift 25
IDnumber shift 26
. error
f goto 27
t goto 28
expr goto 36
state 24
print_argument : print_argument STRINGnumber . (29)
. reduce 29
state 25
f : ICONSTnumber . (17)
. reduce 17
state 26
f : IDnumber . (16)
. reduce 16
state 27
t : f . (15)
. reduce 15
state 28
expr : t . (11)
t : t . TIMESnumber f (13)
t : t . DIVnumber f (14)
TIMESnumber shift 37
DIVnumber shift 38
PLUSnumber reduce 11
MINUSnumber reduce 11
DOTnumber reduce 11
SEMInumber reduce 11
LPARENnumber reduce 11
RPARENnumber reduce 11
STRINGnumber reduce 11
ICONSTnumber reduce 11
IDnumber reduce 11
29: shift/reduce conflict (shift 40, reduce 27) on MINUSnumber
state 29
expr : expr . PLUSnumber t (9)
expr : expr . MINUSnumber t (10)
print_argument : print_argument expr . (27)
PLUSnumber shift 39
MINUSnumber shift 40
DOTnumber reduce 27
SEMInumber reduce 27
LPARENnumber reduce 27
STRINGnumber reduce 27
ICONSTnumber reduce 27
IDnumber reduce 27
state 30
assignment : IDnumber EQnumber STRINGnumber . (8)
. reduce 8
state 31
assignment : IDnumber EQnumber expr . (7)
expr : expr . PLUSnumber t (9)
expr : expr . MINUSnumber t (10)
PLUSnumber shift 39
MINUSnumber shift 40
SEMInumber reduce 7
state 32
var_list : var_list IDnumber . (21)
var_list : var_list IDnumber . COMMAnumber (22)
COMMAnumber shift 41
SEMInumber reduce 21
IDnumber reduce 21
state 33
expr : MINUSnumber t . (12)
t : t . TIMESnumber f (13)
t : t . DIVnumber f (14)
TIMESnumber shift 37
DIVnumber shift 38
PLUSnumber reduce 12
MINUSnumber reduce 12
DOTnumber reduce 12
SEMInumber reduce 12
LPARENnumber reduce 12
RPARENnumber reduce 12
STRINGnumber reduce 12
ICONSTnumber reduce 12
IDnumber reduce 12
state 34
print_argument : print_argument DOTnumber STRINGnumber . (30)
. reduce 30
35: shift/reduce conflict (shift 40, reduce 28) on MINUSnumber
state 35
expr : expr . PLUSnumber t (9)
expr : expr . MINUSnumber t (10)
print_argument : print_argument DOTnumber expr . (28)
PLUSnumber shift 39
MINUSnumber shift 40
DOTnumber reduce 28
SEMInumber reduce 28
LPARENnumber reduce 28
STRINGnumber reduce 28
ICONSTnumber reduce 28
IDnumber reduce 28
state 36
expr : expr . PLUSnumber t (9)
expr : expr . MINUSnumber t (10)
f : LPARENnumber expr . RPARENnumber (18)
PLUSnumber shift 39
MINUSnumber shift 40
RPARENnumber shift 42
. error
state 37
t : t TIMESnumber . f (13)
LPARENnumber shift 23
ICONSTnumber shift 25
IDnumber shift 26
. error
f goto 43
state 38
t : t DIVnumber . f (14)
LPARENnumber shift 23
ICONSTnumber shift 25
IDnumber shift 26
. error
f goto 44
state 39
expr : expr PLUSnumber . t (9)
LPARENnumber shift 23
ICONSTnumber shift 25
IDnumber shift 26
. error
f goto 27
t goto 45
state 40
expr : expr MINUSnumber . t (10)
LPARENnumber shift 23
ICONSTnumber shift 25
IDnumber shift 26
. error
f goto 27
t goto 46
state 41
var_list : var_list IDnumber COMMAnumber . (22)
. reduce 22
state 42
f : LPARENnumber expr RPARENnumber . (18)
. reduce 18
state 43
t : t TIMESnumber f . (13)
. reduce 13
state 44
t : t DIVnumber f . (14)
. reduce 14
state 45
expr : expr PLUSnumber t . (9)
t : t . TIMESnumber f (13)
t : t . DIVnumber f (14)
TIMESnumber shift 37
DIVnumber shift 38
PLUSnumber reduce 9
MINUSnumber reduce 9
DOTnumber reduce 9
SEMInumber reduce 9
LPARENnumber reduce 9
RPARENnumber reduce 9
STRINGnumber reduce 9
ICONSTnumber reduce 9
IDnumber reduce 9
state 46
expr : expr MINUSnumber t . (10)
t : t . TIMESnumber f (13)
t : t . DIVnumber f (14)
TIMESnumber shift 37
DIVnumber shift 38
PLUSnumber reduce 10
MINUSnumber reduce 10
DOTnumber reduce 10
SEMInumber reduce 10
LPARENnumber reduce 10
RPARENnumber reduce 10
STRINGnumber reduce 10
ICONSTnumber reduce 10
IDnumber reduce 10
State 29 contains 1 shift/reduce conflict.
State 35 contains 1 shift/reduce conflict.
22 terminals, 13 nonterminals
31 grammar rules, 47 states