This repository was archived by the owner on Jun 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathparser.out
More file actions
559 lines (368 loc) · 16.2 KB
/
Copy pathparser.out
File metadata and controls
559 lines (368 loc) · 16.2 KB
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
558
Created by PLY version 3.2 (http://www.dabeaz.com/ply)
Grammar
Rule 0 S' -> file
Rule 1 file -> opt_rom_or_macros
Rule 2 opt_rom_or_macros -> <empty>
Rule 3 opt_rom_or_macros -> rom_or_macros
Rule 4 rom_or_macros -> rom_or_macro
Rule 5 rom_or_macros -> rom_or_macros rom_or_macro
Rule 6 rom_or_macro -> rom_block
Rule 7 rom_or_macro -> macroop_def
Rule 8 rom_block -> DEF ROM block SEMI
Rule 9 macroop_def -> DEF MACROOP ID LPAREN ID RPAREN SEMI
Rule 10 macroop_def -> DEF MACROOP ID block SEMI
Rule 11 block -> LBRACE statements RBRACE
Rule 12 statements -> statement
Rule 13 statements -> statements statement
Rule 14 statement -> content_of_statement end_of_statement
Rule 15 content_of_statement -> microop
Rule 16 content_of_statement -> directive
Rule 17 content_of_statement -> <empty>
Rule 18 end_of_statement -> NEWLINE
Rule 19 end_of_statement -> SEMI
Rule 20 microop -> labels ID
Rule 21 microop -> ID
Rule 22 microop -> labels ID PARAMS
Rule 23 microop -> ID PARAMS
Rule 24 labels -> label
Rule 25 labels -> labels label
Rule 26 labels -> labels NEWLINE
Rule 27 label -> ID COLON
Rule 28 label -> EXTERN ID COLON
Rule 29 directive -> DOT ID
Rule 30 directive -> DOT ID PARAMS
Terminals, with rules where they appear
COLON : 27 28
DEF : 8 9 10
DOT : 29 30
EXTERN : 28
ID : 9 9 10 20 21 22 23 27 28 29 30
LBRACE : 11
LPAREN : 9
MACROOP : 9 10
NEWLINE : 18 26
PARAMS : 22 23 30
RBRACE : 11
ROM : 8
RPAREN : 9
SEMI : 8 9 10 19
error :
Nonterminals, with rules where they appear
block : 8 10
content_of_statement : 14
directive : 16
end_of_statement : 14
file : 0
label : 24 25
labels : 20 22 25 26
macroop_def : 7
microop : 15
opt_rom_or_macros : 1
rom_block : 6
rom_or_macro : 4 5
rom_or_macros : 3 5
statement : 12 13
statements : 11 13
Parsing method: LALR
state 0
(0) S' -> . file
(1) file -> . opt_rom_or_macros
(2) opt_rom_or_macros -> .
(3) opt_rom_or_macros -> . rom_or_macros
(4) rom_or_macros -> . rom_or_macro
(5) rom_or_macros -> . rom_or_macros rom_or_macro
(6) rom_or_macro -> . rom_block
(7) rom_or_macro -> . macroop_def
(8) rom_block -> . DEF ROM block SEMI
(9) macroop_def -> . DEF MACROOP ID LPAREN ID RPAREN SEMI
(10) macroop_def -> . DEF MACROOP ID block SEMI
$end reduce using rule 2 (opt_rom_or_macros -> .)
DEF shift and go to state 6
macroop_def shift and go to state 1
rom_or_macros shift and go to state 2
rom_block shift and go to state 3
file shift and go to state 4
opt_rom_or_macros shift and go to state 5
rom_or_macro shift and go to state 7
state 1
(7) rom_or_macro -> macroop_def .
DEF reduce using rule 7 (rom_or_macro -> macroop_def .)
$end reduce using rule 7 (rom_or_macro -> macroop_def .)
state 2
(3) opt_rom_or_macros -> rom_or_macros .
(5) rom_or_macros -> rom_or_macros . rom_or_macro
(6) rom_or_macro -> . rom_block
(7) rom_or_macro -> . macroop_def
(8) rom_block -> . DEF ROM block SEMI
(9) macroop_def -> . DEF MACROOP ID LPAREN ID RPAREN SEMI
(10) macroop_def -> . DEF MACROOP ID block SEMI
$end reduce using rule 3 (opt_rom_or_macros -> rom_or_macros .)
DEF shift and go to state 6
rom_block shift and go to state 3
macroop_def shift and go to state 1
rom_or_macro shift and go to state 8
state 3
(6) rom_or_macro -> rom_block .
DEF reduce using rule 6 (rom_or_macro -> rom_block .)
$end reduce using rule 6 (rom_or_macro -> rom_block .)
state 4
(0) S' -> file .
state 5
(1) file -> opt_rom_or_macros .
$end reduce using rule 1 (file -> opt_rom_or_macros .)
state 6
(8) rom_block -> DEF . ROM block SEMI
(9) macroop_def -> DEF . MACROOP ID LPAREN ID RPAREN SEMI
(10) macroop_def -> DEF . MACROOP ID block SEMI
ROM shift and go to state 9
MACROOP shift and go to state 10
state 7
(4) rom_or_macros -> rom_or_macro .
DEF reduce using rule 4 (rom_or_macros -> rom_or_macro .)
$end reduce using rule 4 (rom_or_macros -> rom_or_macro .)
state 8
(5) rom_or_macros -> rom_or_macros rom_or_macro .
DEF reduce using rule 5 (rom_or_macros -> rom_or_macros rom_or_macro .)
$end reduce using rule 5 (rom_or_macros -> rom_or_macros rom_or_macro .)
state 9
(8) rom_block -> DEF ROM . block SEMI
(11) block -> . LBRACE statements RBRACE
LBRACE shift and go to state 11
block shift and go to state 12
state 10
(9) macroop_def -> DEF MACROOP . ID LPAREN ID RPAREN SEMI
(10) macroop_def -> DEF MACROOP . ID block SEMI
ID shift and go to state 13
state 11
(11) block -> LBRACE . statements RBRACE
(12) statements -> . statement
(13) statements -> . statements statement
(14) statement -> . content_of_statement end_of_statement
(15) content_of_statement -> . microop
(16) content_of_statement -> . directive
(17) content_of_statement -> .
(20) microop -> . labels ID
(21) microop -> . ID
(22) microop -> . labels ID PARAMS
(23) microop -> . ID PARAMS
(29) directive -> . DOT ID
(30) directive -> . DOT ID PARAMS
(24) labels -> . label
(25) labels -> . labels label
(26) labels -> . labels NEWLINE
(27) label -> . ID COLON
(28) label -> . EXTERN ID COLON
NEWLINE reduce using rule 17 (content_of_statement -> .)
SEMI reduce using rule 17 (content_of_statement -> .)
ID shift and go to state 22
DOT shift and go to state 23
EXTERN shift and go to state 20
statements shift and go to state 14
directive shift and go to state 15
labels shift and go to state 16
label shift and go to state 17
microop shift and go to state 18
statement shift and go to state 19
content_of_statement shift and go to state 21
state 12
(8) rom_block -> DEF ROM block . SEMI
SEMI shift and go to state 24
state 13
(9) macroop_def -> DEF MACROOP ID . LPAREN ID RPAREN SEMI
(10) macroop_def -> DEF MACROOP ID . block SEMI
(11) block -> . LBRACE statements RBRACE
LPAREN shift and go to state 26
LBRACE shift and go to state 11
block shift and go to state 25
state 14
(11) block -> LBRACE statements . RBRACE
(13) statements -> statements . statement
(14) statement -> . content_of_statement end_of_statement
(15) content_of_statement -> . microop
(16) content_of_statement -> . directive
(17) content_of_statement -> .
(20) microop -> . labels ID
(21) microop -> . ID
(22) microop -> . labels ID PARAMS
(23) microop -> . ID PARAMS
(29) directive -> . DOT ID
(30) directive -> . DOT ID PARAMS
(24) labels -> . label
(25) labels -> . labels label
(26) labels -> . labels NEWLINE
(27) label -> . ID COLON
(28) label -> . EXTERN ID COLON
RBRACE shift and go to state 27
NEWLINE reduce using rule 17 (content_of_statement -> .)
SEMI reduce using rule 17 (content_of_statement -> .)
ID shift and go to state 22
DOT shift and go to state 23
EXTERN shift and go to state 20
directive shift and go to state 15
labels shift and go to state 16
label shift and go to state 17
microop shift and go to state 18
statement shift and go to state 28
content_of_statement shift and go to state 21
state 15
(16) content_of_statement -> directive .
NEWLINE reduce using rule 16 (content_of_statement -> directive .)
SEMI reduce using rule 16 (content_of_statement -> directive .)
state 16
(20) microop -> labels . ID
(22) microop -> labels . ID PARAMS
(25) labels -> labels . label
(26) labels -> labels . NEWLINE
(27) label -> . ID COLON
(28) label -> . EXTERN ID COLON
ID shift and go to state 31
NEWLINE shift and go to state 29
EXTERN shift and go to state 20
label shift and go to state 30
state 17
(24) labels -> label .
ID reduce using rule 24 (labels -> label .)
NEWLINE reduce using rule 24 (labels -> label .)
EXTERN reduce using rule 24 (labels -> label .)
state 18
(15) content_of_statement -> microop .
NEWLINE reduce using rule 15 (content_of_statement -> microop .)
SEMI reduce using rule 15 (content_of_statement -> microop .)
state 19
(12) statements -> statement .
RBRACE reduce using rule 12 (statements -> statement .)
ID reduce using rule 12 (statements -> statement .)
DOT reduce using rule 12 (statements -> statement .)
EXTERN reduce using rule 12 (statements -> statement .)
NEWLINE reduce using rule 12 (statements -> statement .)
SEMI reduce using rule 12 (statements -> statement .)
state 20
(28) label -> EXTERN . ID COLON
ID shift and go to state 32
state 21
(14) statement -> content_of_statement . end_of_statement
(18) end_of_statement -> . NEWLINE
(19) end_of_statement -> . SEMI
NEWLINE shift and go to state 33
SEMI shift and go to state 34
end_of_statement shift and go to state 35
state 22
(21) microop -> ID .
(23) microop -> ID . PARAMS
(27) label -> ID . COLON
NEWLINE reduce using rule 21 (microop -> ID .)
SEMI reduce using rule 21 (microop -> ID .)
PARAMS shift and go to state 37
COLON shift and go to state 36
state 23
(29) directive -> DOT . ID
(30) directive -> DOT . ID PARAMS
ID shift and go to state 38
state 24
(8) rom_block -> DEF ROM block SEMI .
DEF reduce using rule 8 (rom_block -> DEF ROM block SEMI .)
$end reduce using rule 8 (rom_block -> DEF ROM block SEMI .)
state 25
(10) macroop_def -> DEF MACROOP ID block . SEMI
SEMI shift and go to state 39
state 26
(9) macroop_def -> DEF MACROOP ID LPAREN . ID RPAREN SEMI
ID shift and go to state 40
state 27
(11) block -> LBRACE statements RBRACE .
SEMI reduce using rule 11 (block -> LBRACE statements RBRACE .)
state 28
(13) statements -> statements statement .
RBRACE reduce using rule 13 (statements -> statements statement .)
ID reduce using rule 13 (statements -> statements statement .)
DOT reduce using rule 13 (statements -> statements statement .)
EXTERN reduce using rule 13 (statements -> statements statement .)
NEWLINE reduce using rule 13 (statements -> statements statement .)
SEMI reduce using rule 13 (statements -> statements statement .)
state 29
(26) labels -> labels NEWLINE .
ID reduce using rule 26 (labels -> labels NEWLINE .)
NEWLINE reduce using rule 26 (labels -> labels NEWLINE .)
EXTERN reduce using rule 26 (labels -> labels NEWLINE .)
state 30
(25) labels -> labels label .
ID reduce using rule 25 (labels -> labels label .)
NEWLINE reduce using rule 25 (labels -> labels label .)
EXTERN reduce using rule 25 (labels -> labels label .)
state 31
(20) microop -> labels ID .
(22) microop -> labels ID . PARAMS
(27) label -> ID . COLON
NEWLINE reduce using rule 20 (microop -> labels ID .)
SEMI reduce using rule 20 (microop -> labels ID .)
PARAMS shift and go to state 41
COLON shift and go to state 36
state 32
(28) label -> EXTERN ID . COLON
COLON shift and go to state 42
state 33
(18) end_of_statement -> NEWLINE .
RBRACE reduce using rule 18 (end_of_statement -> NEWLINE .)
ID reduce using rule 18 (end_of_statement -> NEWLINE .)
DOT reduce using rule 18 (end_of_statement -> NEWLINE .)
EXTERN reduce using rule 18 (end_of_statement -> NEWLINE .)
NEWLINE reduce using rule 18 (end_of_statement -> NEWLINE .)
SEMI reduce using rule 18 (end_of_statement -> NEWLINE .)
state 34
(19) end_of_statement -> SEMI .
RBRACE reduce using rule 19 (end_of_statement -> SEMI .)
ID reduce using rule 19 (end_of_statement -> SEMI .)
DOT reduce using rule 19 (end_of_statement -> SEMI .)
EXTERN reduce using rule 19 (end_of_statement -> SEMI .)
NEWLINE reduce using rule 19 (end_of_statement -> SEMI .)
SEMI reduce using rule 19 (end_of_statement -> SEMI .)
state 35
(14) statement -> content_of_statement end_of_statement .
RBRACE reduce using rule 14 (statement -> content_of_statement end_of_statement .)
ID reduce using rule 14 (statement -> content_of_statement end_of_statement .)
DOT reduce using rule 14 (statement -> content_of_statement end_of_statement .)
EXTERN reduce using rule 14 (statement -> content_of_statement end_of_statement .)
NEWLINE reduce using rule 14 (statement -> content_of_statement end_of_statement .)
SEMI reduce using rule 14 (statement -> content_of_statement end_of_statement .)
state 36
(27) label -> ID COLON .
ID reduce using rule 27 (label -> ID COLON .)
NEWLINE reduce using rule 27 (label -> ID COLON .)
EXTERN reduce using rule 27 (label -> ID COLON .)
state 37
(23) microop -> ID PARAMS .
NEWLINE reduce using rule 23 (microop -> ID PARAMS .)
SEMI reduce using rule 23 (microop -> ID PARAMS .)
state 38
(29) directive -> DOT ID .
(30) directive -> DOT ID . PARAMS
NEWLINE reduce using rule 29 (directive -> DOT ID .)
SEMI reduce using rule 29 (directive -> DOT ID .)
PARAMS shift and go to state 43
state 39
(10) macroop_def -> DEF MACROOP ID block SEMI .
DEF reduce using rule 10 (macroop_def -> DEF MACROOP ID block SEMI .)
$end reduce using rule 10 (macroop_def -> DEF MACROOP ID block SEMI .)
state 40
(9) macroop_def -> DEF MACROOP ID LPAREN ID . RPAREN SEMI
RPAREN shift and go to state 44
state 41
(22) microop -> labels ID PARAMS .
NEWLINE reduce using rule 22 (microop -> labels ID PARAMS .)
SEMI reduce using rule 22 (microop -> labels ID PARAMS .)
state 42
(28) label -> EXTERN ID COLON .
ID reduce using rule 28 (label -> EXTERN ID COLON .)
NEWLINE reduce using rule 28 (label -> EXTERN ID COLON .)
EXTERN reduce using rule 28 (label -> EXTERN ID COLON .)
state 43
(30) directive -> DOT ID PARAMS .
NEWLINE reduce using rule 30 (directive -> DOT ID PARAMS .)
SEMI reduce using rule 30 (directive -> DOT ID PARAMS .)
state 44
(9) macroop_def -> DEF MACROOP ID LPAREN ID RPAREN . SEMI
SEMI shift and go to state 45
state 45
(9) macroop_def -> DEF MACROOP ID LPAREN ID RPAREN SEMI .
DEF reduce using rule 9 (macroop_def -> DEF MACROOP ID LPAREN ID RPAREN SEMI .)
$end reduce using rule 9 (macroop_def -> DEF MACROOP ID LPAREN ID RPAREN SEMI .)