-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathparsing_rule.output
618 lines (386 loc) · 12.7 KB
/
parsing_rule.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
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
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
Grammar
0 $accept: and_or $end
1 and_or: pipe_sequence
2 | and_or AND pipe_sequence
3 | and_or OR pipe_sequence
4 pipe_sequence: command
5 | pipe_sequence PIPE command
6 command: simple_command
7 | subshell
8 | subshell redirect_list
9 subshell: L_PAREN and_or R_PAREN
10 simple_command: cmd_prefix cmd_word cmd_suffix
11 | cmd_prefix cmd_word
12 | cmd_prefix
13 | cmd_name cmd_suffix
14 | cmd_name
15 cmd_name: WORD
16 cmd_word: WORD
17 cmd_prefix: io_redirect
18 | cmd_prefix io_redirect
19 | ASSIGNMENT_WORD
20 | cmd_prefix ASSIGNMENT_WORD
21 cmd_suffix: io_redirect
22 | cmd_suffix io_redirect
23 | WORD
24 | cmd_suffix WORD
25 redirect_list: io_redirect
26 | redirect_list io_redirect
27 io_redirect: io_file
28 | io_here
29 io_file: RED_OUT filename
30 | RED_IN filename
31 | APPEND filename
32 filename: WORD
33 io_here: HERE_DOC here_end
34 here_end: WORD
Terminals, with rules where they appear
$end (0) 0
error (256)
WORD (258) 15 16 23 24 32 34
ASSIGNMENT_WORD (259) 19 20
RED_IN (260) 30
RED_OUT (261) 29
PIPE (262) 5
HERE_DOC (263) 33
APPEND (264) 31
AND (265) 2
OR (266) 3
L_PAREN (267) 9
R_PAREN (268) 9
Nonterminals, with rules where they appear
$accept (14)
on left: 0
and_or (15)
on left: 1 2 3, on right: 0 2 3 9
pipe_sequence (16)
on left: 4 5, on right: 1 2 3 5
command (17)
on left: 6 7 8, on right: 4 5
subshell (18)
on left: 9, on right: 7 8
simple_command (19)
on left: 10 11 12 13 14, on right: 6
cmd_name (20)
on left: 15, on right: 13 14
cmd_word (21)
on left: 16, on right: 10 11
cmd_prefix (22)
on left: 17 18 19 20, on right: 10 11 12 18 20
cmd_suffix (23)
on left: 21 22 23 24, on right: 10 13 22 24
redirect_list (24)
on left: 25 26, on right: 8 26
io_redirect (25)
on left: 27 28, on right: 17 18 21 22 25 26
io_file (26)
on left: 29 30 31, on right: 27
filename (27)
on left: 32, on right: 29 30 31
io_here (28)
on left: 33, on right: 28
here_end (29)
on left: 34, on right: 33
state 0
0 $accept: . and_or $end
WORD shift, and go to state 1
ASSIGNMENT_WORD shift, and go to state 2
RED_IN shift, and go to state 3
RED_OUT shift, and go to state 4
HERE_DOC shift, and go to state 5
APPEND shift, and go to state 6
L_PAREN shift, and go to state 7
and_or go to state 8
pipe_sequence go to state 9
command go to state 10
subshell go to state 11
simple_command go to state 12
cmd_name go to state 13
cmd_prefix go to state 14
io_redirect go to state 15
io_file go to state 16
io_here go to state 17
state 1
15 cmd_name: WORD .
$default reduce using rule 15 (cmd_name)
state 2
19 cmd_prefix: ASSIGNMENT_WORD .
$default reduce using rule 19 (cmd_prefix)
state 3
30 io_file: RED_IN . filename
WORD shift, and go to state 18
filename go to state 19
state 4
29 io_file: RED_OUT . filename
WORD shift, and go to state 18
filename go to state 20
state 5
33 io_here: HERE_DOC . here_end
WORD shift, and go to state 21
here_end go to state 22
state 6
31 io_file: APPEND . filename
WORD shift, and go to state 18
filename go to state 23
state 7
9 subshell: L_PAREN . and_or R_PAREN
WORD shift, and go to state 1
ASSIGNMENT_WORD shift, and go to state 2
RED_IN shift, and go to state 3
RED_OUT shift, and go to state 4
HERE_DOC shift, and go to state 5
APPEND shift, and go to state 6
L_PAREN shift, and go to state 7
and_or go to state 24
pipe_sequence go to state 9
command go to state 10
subshell go to state 11
simple_command go to state 12
cmd_name go to state 13
cmd_prefix go to state 14
io_redirect go to state 15
io_file go to state 16
io_here go to state 17
state 8
0 $accept: and_or . $end
2 and_or: and_or . AND pipe_sequence
3 | and_or . OR pipe_sequence
$end shift, and go to state 25
AND shift, and go to state 26
OR shift, and go to state 27
state 9
1 and_or: pipe_sequence .
5 pipe_sequence: pipe_sequence . PIPE command
PIPE shift, and go to state 28
$default reduce using rule 1 (and_or)
state 10
4 pipe_sequence: command .
$default reduce using rule 4 (pipe_sequence)
state 11
7 command: subshell .
8 | subshell . redirect_list
RED_IN shift, and go to state 3
RED_OUT shift, and go to state 4
HERE_DOC shift, and go to state 5
APPEND shift, and go to state 6
$default reduce using rule 7 (command)
redirect_list go to state 29
io_redirect go to state 30
io_file go to state 16
io_here go to state 17
state 12
6 command: simple_command .
$default reduce using rule 6 (command)
state 13
13 simple_command: cmd_name . cmd_suffix
14 | cmd_name .
WORD shift, and go to state 31
RED_IN shift, and go to state 3
RED_OUT shift, and go to state 4
HERE_DOC shift, and go to state 5
APPEND shift, and go to state 6
$default reduce using rule 14 (simple_command)
cmd_suffix go to state 32
io_redirect go to state 33
io_file go to state 16
io_here go to state 17
state 14
10 simple_command: cmd_prefix . cmd_word cmd_suffix
11 | cmd_prefix . cmd_word
12 | cmd_prefix .
18 cmd_prefix: cmd_prefix . io_redirect
20 | cmd_prefix . ASSIGNMENT_WORD
WORD shift, and go to state 34
ASSIGNMENT_WORD shift, and go to state 35
RED_IN shift, and go to state 3
RED_OUT shift, and go to state 4
HERE_DOC shift, and go to state 5
APPEND shift, and go to state 6
$default reduce using rule 12 (simple_command)
cmd_word go to state 36
io_redirect go to state 37
io_file go to state 16
io_here go to state 17
state 15
17 cmd_prefix: io_redirect .
$default reduce using rule 17 (cmd_prefix)
state 16
27 io_redirect: io_file .
$default reduce using rule 27 (io_redirect)
state 17
28 io_redirect: io_here .
$default reduce using rule 28 (io_redirect)
state 18
32 filename: WORD .
$default reduce using rule 32 (filename)
state 19
30 io_file: RED_IN filename .
$default reduce using rule 30 (io_file)
state 20
29 io_file: RED_OUT filename .
$default reduce using rule 29 (io_file)
state 21
34 here_end: WORD .
$default reduce using rule 34 (here_end)
state 22
33 io_here: HERE_DOC here_end .
$default reduce using rule 33 (io_here)
state 23
31 io_file: APPEND filename .
$default reduce using rule 31 (io_file)
state 24
2 and_or: and_or . AND pipe_sequence
3 | and_or . OR pipe_sequence
9 subshell: L_PAREN and_or . R_PAREN
AND shift, and go to state 26
OR shift, and go to state 27
R_PAREN shift, and go to state 38
state 25
0 $accept: and_or $end .
$default accept
state 26
2 and_or: and_or AND . pipe_sequence
WORD shift, and go to state 1
ASSIGNMENT_WORD shift, and go to state 2
RED_IN shift, and go to state 3
RED_OUT shift, and go to state 4
HERE_DOC shift, and go to state 5
APPEND shift, and go to state 6
L_PAREN shift, and go to state 7
pipe_sequence go to state 39
command go to state 10
subshell go to state 11
simple_command go to state 12
cmd_name go to state 13
cmd_prefix go to state 14
io_redirect go to state 15
io_file go to state 16
io_here go to state 17
state 27
3 and_or: and_or OR . pipe_sequence
WORD shift, and go to state 1
ASSIGNMENT_WORD shift, and go to state 2
RED_IN shift, and go to state 3
RED_OUT shift, and go to state 4
HERE_DOC shift, and go to state 5
APPEND shift, and go to state 6
L_PAREN shift, and go to state 7
pipe_sequence go to state 40
command go to state 10
subshell go to state 11
simple_command go to state 12
cmd_name go to state 13
cmd_prefix go to state 14
io_redirect go to state 15
io_file go to state 16
io_here go to state 17
state 28
5 pipe_sequence: pipe_sequence PIPE . command
WORD shift, and go to state 1
ASSIGNMENT_WORD shift, and go to state 2
RED_IN shift, and go to state 3
RED_OUT shift, and go to state 4
HERE_DOC shift, and go to state 5
APPEND shift, and go to state 6
L_PAREN shift, and go to state 7
command go to state 41
subshell go to state 11
simple_command go to state 12
cmd_name go to state 13
cmd_prefix go to state 14
io_redirect go to state 15
io_file go to state 16
io_here go to state 17
state 29
8 command: subshell redirect_list .
26 redirect_list: redirect_list . io_redirect
RED_IN shift, and go to state 3
RED_OUT shift, and go to state 4
HERE_DOC shift, and go to state 5
APPEND shift, and go to state 6
$default reduce using rule 8 (command)
io_redirect go to state 42
io_file go to state 16
io_here go to state 17
state 30
25 redirect_list: io_redirect .
$default reduce using rule 25 (redirect_list)
state 31
23 cmd_suffix: WORD .
$default reduce using rule 23 (cmd_suffix)
state 32
13 simple_command: cmd_name cmd_suffix .
22 cmd_suffix: cmd_suffix . io_redirect
24 | cmd_suffix . WORD
WORD shift, and go to state 43
RED_IN shift, and go to state 3
RED_OUT shift, and go to state 4
HERE_DOC shift, and go to state 5
APPEND shift, and go to state 6
$default reduce using rule 13 (simple_command)
io_redirect go to state 44
io_file go to state 16
io_here go to state 17
state 33
21 cmd_suffix: io_redirect .
$default reduce using rule 21 (cmd_suffix)
state 34
16 cmd_word: WORD .
$default reduce using rule 16 (cmd_word)
state 35
20 cmd_prefix: cmd_prefix ASSIGNMENT_WORD .
$default reduce using rule 20 (cmd_prefix)
state 36
10 simple_command: cmd_prefix cmd_word . cmd_suffix
11 | cmd_prefix cmd_word .
WORD shift, and go to state 31
RED_IN shift, and go to state 3
RED_OUT shift, and go to state 4
HERE_DOC shift, and go to state 5
APPEND shift, and go to state 6
$default reduce using rule 11 (simple_command)
cmd_suffix go to state 45
io_redirect go to state 33
io_file go to state 16
io_here go to state 17
state 37
18 cmd_prefix: cmd_prefix io_redirect .
$default reduce using rule 18 (cmd_prefix)
state 38
9 subshell: L_PAREN and_or R_PAREN .
$default reduce using rule 9 (subshell)
state 39
2 and_or: and_or AND pipe_sequence .
5 pipe_sequence: pipe_sequence . PIPE command
PIPE shift, and go to state 28
$default reduce using rule 2 (and_or)
state 40
3 and_or: and_or OR pipe_sequence .
5 pipe_sequence: pipe_sequence . PIPE command
PIPE shift, and go to state 28
$default reduce using rule 3 (and_or)
state 41
5 pipe_sequence: pipe_sequence PIPE command .
$default reduce using rule 5 (pipe_sequence)
state 42
26 redirect_list: redirect_list io_redirect .
$default reduce using rule 26 (redirect_list)
state 43
24 cmd_suffix: cmd_suffix WORD .
$default reduce using rule 24 (cmd_suffix)
state 44
22 cmd_suffix: cmd_suffix io_redirect .
$default reduce using rule 22 (cmd_suffix)
state 45
10 simple_command: cmd_prefix cmd_word cmd_suffix .
22 cmd_suffix: cmd_suffix . io_redirect
24 | cmd_suffix . WORD
WORD shift, and go to state 43
RED_IN shift, and go to state 3
RED_OUT shift, and go to state 4
HERE_DOC shift, and go to state 5
APPEND shift, and go to state 6
$default reduce using rule 10 (simple_command)
io_redirect go to state 44
io_file go to state 16
io_here go to state 17