1 | Terminals which are not used
|
---|
2 |
|
---|
3 | PROG_PARAMETER
|
---|
4 | IRRELEVANT
|
---|
5 |
|
---|
6 |
|
---|
7 | State 96 conflicts: 1 shift/reduce
|
---|
8 |
|
---|
9 |
|
---|
10 | Grammar
|
---|
11 |
|
---|
12 | 0 $accept: program $end
|
---|
13 |
|
---|
14 | 1 @1: /* empty */
|
---|
15 |
|
---|
16 | 2 program: PROGRAM ID @1 ';' declarations subprogram_declarations compound_statement '.'
|
---|
17 |
|
---|
18 | 3 type_identifier_list: ',' ID type_identifier_list
|
---|
19 | 4 | ':' type
|
---|
20 |
|
---|
21 | 5 declarations: declarations VAR ID type_identifier_list ';'
|
---|
22 | 6 | /* empty */
|
---|
23 |
|
---|
24 | 7 type: standard_type
|
---|
25 |
|
---|
26 | 8 standard_type: INTEGER
|
---|
27 | 9 | REAL
|
---|
28 |
|
---|
29 | 10 subprogram_declarations: subprogram_declarations subprogram_declaration ';'
|
---|
30 | 11 | /* empty */
|
---|
31 |
|
---|
32 | 12 subprogram_declaration: subprogram_head declarations compound_statement
|
---|
33 |
|
---|
34 | 13 subprogram_head: FUNCTION ID arguments ':' standard_type ';'
|
---|
35 | 14 | PROCEDURE ID arguments ';'
|
---|
36 |
|
---|
37 | 15 arguments: '(' parameter_lists ')'
|
---|
38 | 16 | /* empty */
|
---|
39 |
|
---|
40 | 17 parameter_lists: parameter_list ';' parameter_lists
|
---|
41 | 18 | parameter_list
|
---|
42 |
|
---|
43 | 19 parameter_list: ID type_identifier_list
|
---|
44 |
|
---|
45 | 20 compound_statement: PASCALBEGIN optional_statements END
|
---|
46 |
|
---|
47 | 21 optional_statements: statement_list
|
---|
48 | 22 | /* empty */
|
---|
49 |
|
---|
50 | 23 statement_list: statement
|
---|
51 | 24 | statement_list ';' statement
|
---|
52 |
|
---|
53 | 25 statement: variable ASSIGNOP expression
|
---|
54 | 26 | procedure_statement
|
---|
55 | 27 | compound_statement
|
---|
56 | 28 | IF boollikeexp THEN statement optional_else_statement
|
---|
57 | 29 | WHILE boollikeexp DO statement
|
---|
58 |
|
---|
59 | 30 optional_else_statement: ELSE statement
|
---|
60 | 31 | /* empty */
|
---|
61 |
|
---|
62 | 32 variable: ID
|
---|
63 |
|
---|
64 | 33 procedure_statement: ID
|
---|
65 | 34 | ID '(' expression_list ')'
|
---|
66 |
|
---|
67 | 35 expression_list: expression
|
---|
68 | 36 | expression ',' expression_list
|
---|
69 |
|
---|
70 | 37 boollikeexp: expression RELOP expression
|
---|
71 | 38 | '(' boollikeexp ')'
|
---|
72 |
|
---|
73 | 39 expression: simple_expression
|
---|
74 |
|
---|
75 | 40 simple_expression: term
|
---|
76 | 41 | signplus term
|
---|
77 | 42 | signminus term
|
---|
78 | 43 | simple_expression '+' term
|
---|
79 | 44 | simple_expression '-' term
|
---|
80 | 45 | simple_expression ADDOP term
|
---|
81 |
|
---|
82 | 46 term: factor
|
---|
83 | 47 | term MULOP factor
|
---|
84 |
|
---|
85 | 48 factor: ID
|
---|
86 | 49 | ID '(' expression_list ')'
|
---|
87 | 50 | NUM
|
---|
88 | 51 | '(' expression ')'
|
---|
89 | 52 | NOT factor
|
---|
90 |
|
---|
91 | 53 signplus: '+'
|
---|
92 |
|
---|
93 | 54 signminus: '-'
|
---|
94 |
|
---|
95 |
|
---|
96 | Terminals, with rules where they appear
|
---|
97 |
|
---|
98 | $end (0) 0
|
---|
99 | '(' (40) 15 34 38 49 51
|
---|
100 | ')' (41) 15 34 38 49 51
|
---|
101 | '+' (43) 43 53
|
---|
102 | ',' (44) 3 36
|
---|
103 | '-' (45) 44 54
|
---|
104 | '.' (46) 2
|
---|
105 | ':' (58) 4 13
|
---|
106 | ';' (59) 2 5 10 13 14 17 24
|
---|
107 | error (256)
|
---|
108 | PROGRAM (258) 2
|
---|
109 | ID (259) 2 3 5 13 14 19 32 33 34 48 49
|
---|
110 | VAR (260) 5
|
---|
111 | NUM (261) 50
|
---|
112 | INTEGER (262) 8
|
---|
113 | REAL (263) 9
|
---|
114 | FUNCTION (264) 13
|
---|
115 | PROCEDURE (265) 14
|
---|
116 | PASCALBEGIN (266) 20
|
---|
117 | END (267) 20
|
---|
118 | ADDOP (268) 45
|
---|
119 | ASSIGNOP (269) 25
|
---|
120 | IF (270) 28
|
---|
121 | THEN (271) 28
|
---|
122 | ELSE (272) 30
|
---|
123 | WHILE (273) 29
|
---|
124 | DO (274) 29
|
---|
125 | RELOP (275) 37
|
---|
126 | MULOP (276) 47
|
---|
127 | NOT (277) 52
|
---|
128 | PROG_PARAMETER (278)
|
---|
129 | IRRELEVANT (279)
|
---|
130 | UMINUS (280)
|
---|
131 |
|
---|
132 |
|
---|
133 | Nonterminals, with rules where they appear
|
---|
134 |
|
---|
135 | $accept (34)
|
---|
136 | on left: 0
|
---|
137 | program (35)
|
---|
138 | on left: 2, on right: 0
|
---|
139 | @1 (36)
|
---|
140 | on left: 1, on right: 2
|
---|
141 | type_identifier_list (37)
|
---|
142 | on left: 3 4, on right: 3 5 19
|
---|
143 | declarations (38)
|
---|
144 | on left: 5 6, on right: 2 5 12
|
---|
145 | type (39)
|
---|
146 | on left: 7, on right: 4
|
---|
147 | standard_type (40)
|
---|
148 | on left: 8 9, on right: 7 13
|
---|
149 | subprogram_declarations (41)
|
---|
150 | on left: 10 11, on right: 2 10
|
---|
151 | subprogram_declaration (42)
|
---|
152 | on left: 12, on right: 10
|
---|
153 | subprogram_head (43)
|
---|
154 | on left: 13 14, on right: 12
|
---|
155 | arguments (44)
|
---|
156 | on left: 15 16, on right: 13 14
|
---|
157 | parameter_lists (45)
|
---|
158 | on left: 17 18, on right: 15 17
|
---|
159 | parameter_list (46)
|
---|
160 | on left: 19, on right: 17 18
|
---|
161 | compound_statement (47)
|
---|
162 | on left: 20, on right: 2 12 27
|
---|
163 | optional_statements (48)
|
---|
164 | on left: 21 22, on right: 20
|
---|
165 | statement_list (49)
|
---|
166 | on left: 23 24, on right: 21 24
|
---|
167 | statement (50)
|
---|
168 | on left: 25 26 27 28 29, on right: 23 24 28 29 30
|
---|
169 | optional_else_statement (51)
|
---|
170 | on left: 30 31, on right: 28
|
---|
171 | variable (52)
|
---|
172 | on left: 32, on right: 25
|
---|
173 | procedure_statement (53)
|
---|
174 | on left: 33 34, on right: 26
|
---|
175 | expression_list (54)
|
---|
176 | on left: 35 36, on right: 34 36 49
|
---|
177 | boollikeexp (55)
|
---|
178 | on left: 37 38, on right: 28 29 38
|
---|
179 | expression (56)
|
---|
180 | on left: 39, on right: 25 35 36 37 51
|
---|
181 | simple_expression (57)
|
---|
182 | on left: 40 41 42 43 44 45, on right: 39 43 44 45
|
---|
183 | term (58)
|
---|
184 | on left: 46 47, on right: 40 41 42 43 44 45 47
|
---|
185 | factor (59)
|
---|
186 | on left: 48 49 50 51 52, on right: 46 47 52
|
---|
187 | signplus (60)
|
---|
188 | on left: 53, on right: 41
|
---|
189 | signminus (61)
|
---|
190 | on left: 54, on right: 42
|
---|
191 |
|
---|
192 |
|
---|
193 | state 0
|
---|
194 |
|
---|
195 | 0 $accept: . program $end
|
---|
196 |
|
---|
197 | PROGRAM shift, and go to state 1
|
---|
198 |
|
---|
199 | program go to state 2
|
---|
200 |
|
---|
201 |
|
---|
202 | state 1
|
---|
203 |
|
---|
204 | 2 program: PROGRAM . ID @1 ';' declarations subprogram_declarations compound_statement '.'
|
---|
205 |
|
---|
206 | ID shift, and go to state 3
|
---|
207 |
|
---|
208 |
|
---|
209 | state 2
|
---|
210 |
|
---|
211 | 0 $accept: program . $end
|
---|
212 |
|
---|
213 | $end shift, and go to state 4
|
---|
214 |
|
---|
215 |
|
---|
216 | state 3
|
---|
217 |
|
---|
218 | 2 program: PROGRAM ID . @1 ';' declarations subprogram_declarations compound_statement '.'
|
---|
219 |
|
---|
220 | $default reduce using rule 1 (@1)
|
---|
221 |
|
---|
222 | @1 go to state 5
|
---|
223 |
|
---|
224 |
|
---|
225 | state 4
|
---|
226 |
|
---|
227 | 0 $accept: program $end .
|
---|
228 |
|
---|
229 | $default accept
|
---|
230 |
|
---|
231 |
|
---|
232 | state 5
|
---|
233 |
|
---|
234 | 2 program: PROGRAM ID @1 . ';' declarations subprogram_declarations compound_statement '.'
|
---|
235 |
|
---|
236 | ';' shift, and go to state 6
|
---|
237 |
|
---|
238 |
|
---|
239 | state 6
|
---|
240 |
|
---|
241 | 2 program: PROGRAM ID @1 ';' . declarations subprogram_declarations compound_statement '.'
|
---|
242 |
|
---|
243 | $default reduce using rule 6 (declarations)
|
---|
244 |
|
---|
245 | declarations go to state 7
|
---|
246 |
|
---|
247 |
|
---|
248 | state 7
|
---|
249 |
|
---|
250 | 2 program: PROGRAM ID @1 ';' declarations . subprogram_declarations compound_statement '.'
|
---|
251 | 5 declarations: declarations . VAR ID type_identifier_list ';'
|
---|
252 |
|
---|
253 | VAR shift, and go to state 8
|
---|
254 |
|
---|
255 | $default reduce using rule 11 (subprogram_declarations)
|
---|
256 |
|
---|
257 | subprogram_declarations go to state 9
|
---|
258 |
|
---|
259 |
|
---|
260 | state 8
|
---|
261 |
|
---|
262 | 5 declarations: declarations VAR . ID type_identifier_list ';'
|
---|
263 |
|
---|
264 | ID shift, and go to state 10
|
---|
265 |
|
---|
266 |
|
---|
267 | state 9
|
---|
268 |
|
---|
269 | 2 program: PROGRAM ID @1 ';' declarations subprogram_declarations . compound_statement '.'
|
---|
270 | 10 subprogram_declarations: subprogram_declarations . subprogram_declaration ';'
|
---|
271 |
|
---|
272 | FUNCTION shift, and go to state 11
|
---|
273 | PROCEDURE shift, and go to state 12
|
---|
274 | PASCALBEGIN shift, and go to state 13
|
---|
275 |
|
---|
276 | subprogram_declaration go to state 14
|
---|
277 | subprogram_head go to state 15
|
---|
278 | compound_statement go to state 16
|
---|
279 |
|
---|
280 |
|
---|
281 | state 10
|
---|
282 |
|
---|
283 | 5 declarations: declarations VAR ID . type_identifier_list ';'
|
---|
284 |
|
---|
285 | ',' shift, and go to state 17
|
---|
286 | ':' shift, and go to state 18
|
---|
287 |
|
---|
288 | type_identifier_list go to state 19
|
---|
289 |
|
---|
290 |
|
---|
291 | state 11
|
---|
292 |
|
---|
293 | 13 subprogram_head: FUNCTION . ID arguments ':' standard_type ';'
|
---|
294 |
|
---|
295 | ID shift, and go to state 20
|
---|
296 |
|
---|
297 |
|
---|
298 | state 12
|
---|
299 |
|
---|
300 | 14 subprogram_head: PROCEDURE . ID arguments ';'
|
---|
301 |
|
---|
302 | ID shift, and go to state 21
|
---|
303 |
|
---|
304 |
|
---|
305 | state 13
|
---|
306 |
|
---|
307 | 20 compound_statement: PASCALBEGIN . optional_statements END
|
---|
308 |
|
---|
309 | ID shift, and go to state 22
|
---|
310 | PASCALBEGIN shift, and go to state 13
|
---|
311 | IF shift, and go to state 23
|
---|
312 | WHILE shift, and go to state 24
|
---|
313 |
|
---|
314 | $default reduce using rule 22 (optional_statements)
|
---|
315 |
|
---|
316 | compound_statement go to state 25
|
---|
317 | optional_statements go to state 26
|
---|
318 | statement_list go to state 27
|
---|
319 | statement go to state 28
|
---|
320 | variable go to state 29
|
---|
321 | procedure_statement go to state 30
|
---|
322 |
|
---|
323 |
|
---|
324 | state 14
|
---|
325 |
|
---|
326 | 10 subprogram_declarations: subprogram_declarations subprogram_declaration . ';'
|
---|
327 |
|
---|
328 | ';' shift, and go to state 31
|
---|
329 |
|
---|
330 |
|
---|
331 | state 15
|
---|
332 |
|
---|
333 | 12 subprogram_declaration: subprogram_head . declarations compound_statement
|
---|
334 |
|
---|
335 | $default reduce using rule 6 (declarations)
|
---|
336 |
|
---|
337 | declarations go to state 32
|
---|
338 |
|
---|
339 |
|
---|
340 | state 16
|
---|
341 |
|
---|
342 | 2 program: PROGRAM ID @1 ';' declarations subprogram_declarations compound_statement . '.'
|
---|
343 |
|
---|
344 | '.' shift, and go to state 33
|
---|
345 |
|
---|
346 |
|
---|
347 | state 17
|
---|
348 |
|
---|
349 | 3 type_identifier_list: ',' . ID type_identifier_list
|
---|
350 |
|
---|
351 | ID shift, and go to state 34
|
---|
352 |
|
---|
353 |
|
---|
354 | state 18
|
---|
355 |
|
---|
356 | 4 type_identifier_list: ':' . type
|
---|
357 |
|
---|
358 | INTEGER shift, and go to state 35
|
---|
359 | REAL shift, and go to state 36
|
---|
360 |
|
---|
361 | type go to state 37
|
---|
362 | standard_type go to state 38
|
---|
363 |
|
---|
364 |
|
---|
365 | state 19
|
---|
366 |
|
---|
367 | 5 declarations: declarations VAR ID type_identifier_list . ';'
|
---|
368 |
|
---|
369 | ';' shift, and go to state 39
|
---|
370 |
|
---|
371 |
|
---|
372 | state 20
|
---|
373 |
|
---|
374 | 13 subprogram_head: FUNCTION ID . arguments ':' standard_type ';'
|
---|
375 |
|
---|
376 | '(' shift, and go to state 40
|
---|
377 |
|
---|
378 | $default reduce using rule 16 (arguments)
|
---|
379 |
|
---|
380 | arguments go to state 41
|
---|
381 |
|
---|
382 |
|
---|
383 | state 21
|
---|
384 |
|
---|
385 | 14 subprogram_head: PROCEDURE ID . arguments ';'
|
---|
386 |
|
---|
387 | '(' shift, and go to state 40
|
---|
388 |
|
---|
389 | $default reduce using rule 16 (arguments)
|
---|
390 |
|
---|
391 | arguments go to state 42
|
---|
392 |
|
---|
393 |
|
---|
394 | state 22
|
---|
395 |
|
---|
396 | 32 variable: ID .
|
---|
397 | 33 procedure_statement: ID .
|
---|
398 | 34 | ID . '(' expression_list ')'
|
---|
399 |
|
---|
400 | '(' shift, and go to state 43
|
---|
401 |
|
---|
402 | ASSIGNOP reduce using rule 32 (variable)
|
---|
403 | $default reduce using rule 33 (procedure_statement)
|
---|
404 |
|
---|
405 |
|
---|
406 | state 23
|
---|
407 |
|
---|
408 | 28 statement: IF . boollikeexp THEN statement optional_else_statement
|
---|
409 |
|
---|
410 | ID shift, and go to state 44
|
---|
411 | NUM shift, and go to state 45
|
---|
412 | NOT shift, and go to state 46
|
---|
413 | '(' shift, and go to state 47
|
---|
414 | '+' shift, and go to state 48
|
---|
415 | '-' shift, and go to state 49
|
---|
416 |
|
---|
417 | boollikeexp go to state 50
|
---|
418 | expression go to state 51
|
---|
419 | simple_expression go to state 52
|
---|
420 | term go to state 53
|
---|
421 | factor go to state 54
|
---|
422 | signplus go to state 55
|
---|
423 | signminus go to state 56
|
---|
424 |
|
---|
425 |
|
---|
426 | state 24
|
---|
427 |
|
---|
428 | 29 statement: WHILE . boollikeexp DO statement
|
---|
429 |
|
---|
430 | ID shift, and go to state 44
|
---|
431 | NUM shift, and go to state 45
|
---|
432 | NOT shift, and go to state 46
|
---|
433 | '(' shift, and go to state 47
|
---|
434 | '+' shift, and go to state 48
|
---|
435 | '-' shift, and go to state 49
|
---|
436 |
|
---|
437 | boollikeexp go to state 57
|
---|
438 | expression go to state 51
|
---|
439 | simple_expression go to state 52
|
---|
440 | term go to state 53
|
---|
441 | factor go to state 54
|
---|
442 | signplus go to state 55
|
---|
443 | signminus go to state 56
|
---|
444 |
|
---|
445 |
|
---|
446 | state 25
|
---|
447 |
|
---|
448 | 27 statement: compound_statement .
|
---|
449 |
|
---|
450 | $default reduce using rule 27 (statement)
|
---|
451 |
|
---|
452 |
|
---|
453 | state 26
|
---|
454 |
|
---|
455 | 20 compound_statement: PASCALBEGIN optional_statements . END
|
---|
456 |
|
---|
457 | END shift, and go to state 58
|
---|
458 |
|
---|
459 |
|
---|
460 | state 27
|
---|
461 |
|
---|
462 | 21 optional_statements: statement_list .
|
---|
463 | 24 statement_list: statement_list . ';' statement
|
---|
464 |
|
---|
465 | ';' shift, and go to state 59
|
---|
466 |
|
---|
467 | $default reduce using rule 21 (optional_statements)
|
---|
468 |
|
---|
469 |
|
---|
470 | state 28
|
---|
471 |
|
---|
472 | 23 statement_list: statement .
|
---|
473 |
|
---|
474 | $default reduce using rule 23 (statement_list)
|
---|
475 |
|
---|
476 |
|
---|
477 | state 29
|
---|
478 |
|
---|
479 | 25 statement: variable . ASSIGNOP expression
|
---|
480 |
|
---|
481 | ASSIGNOP shift, and go to state 60
|
---|
482 |
|
---|
483 |
|
---|
484 | state 30
|
---|
485 |
|
---|
486 | 26 statement: procedure_statement .
|
---|
487 |
|
---|
488 | $default reduce using rule 26 (statement)
|
---|
489 |
|
---|
490 |
|
---|
491 | state 31
|
---|
492 |
|
---|
493 | 10 subprogram_declarations: subprogram_declarations subprogram_declaration ';' .
|
---|
494 |
|
---|
495 | $default reduce using rule 10 (subprogram_declarations)
|
---|
496 |
|
---|
497 |
|
---|
498 | state 32
|
---|
499 |
|
---|
500 | 5 declarations: declarations . VAR ID type_identifier_list ';'
|
---|
501 | 12 subprogram_declaration: subprogram_head declarations . compound_statement
|
---|
502 |
|
---|
503 | VAR shift, and go to state 8
|
---|
504 | PASCALBEGIN shift, and go to state 13
|
---|
505 |
|
---|
506 | compound_statement go to state 61
|
---|
507 |
|
---|
508 |
|
---|
509 | state 33
|
---|
510 |
|
---|
511 | 2 program: PROGRAM ID @1 ';' declarations subprogram_declarations compound_statement '.' .
|
---|
512 |
|
---|
513 | $default reduce using rule 2 (program)
|
---|
514 |
|
---|
515 |
|
---|
516 | state 34
|
---|
517 |
|
---|
518 | 3 type_identifier_list: ',' ID . type_identifier_list
|
---|
519 |
|
---|
520 | ',' shift, and go to state 17
|
---|
521 | ':' shift, and go to state 18
|
---|
522 |
|
---|
523 | type_identifier_list go to state 62
|
---|
524 |
|
---|
525 |
|
---|
526 | state 35
|
---|
527 |
|
---|
528 | 8 standard_type: INTEGER .
|
---|
529 |
|
---|
530 | $default reduce using rule 8 (standard_type)
|
---|
531 |
|
---|
532 |
|
---|
533 | state 36
|
---|
534 |
|
---|
535 | 9 standard_type: REAL .
|
---|
536 |
|
---|
537 | $default reduce using rule 9 (standard_type)
|
---|
538 |
|
---|
539 |
|
---|
540 | state 37
|
---|
541 |
|
---|
542 | 4 type_identifier_list: ':' type .
|
---|
543 |
|
---|
544 | $default reduce using rule 4 (type_identifier_list)
|
---|
545 |
|
---|
546 |
|
---|
547 | state 38
|
---|
548 |
|
---|
549 | 7 type: standard_type .
|
---|
550 |
|
---|
551 | $default reduce using rule 7 (type)
|
---|
552 |
|
---|
553 |
|
---|
554 | state 39
|
---|
555 |
|
---|
556 | 5 declarations: declarations VAR ID type_identifier_list ';' .
|
---|
557 |
|
---|
558 | $default reduce using rule 5 (declarations)
|
---|
559 |
|
---|
560 |
|
---|
561 | state 40
|
---|
562 |
|
---|
563 | 15 arguments: '(' . parameter_lists ')'
|
---|
564 |
|
---|
565 | ID shift, and go to state 63
|
---|
566 |
|
---|
567 | parameter_lists go to state 64
|
---|
568 | parameter_list go to state 65
|
---|
569 |
|
---|
570 |
|
---|
571 | state 41
|
---|
572 |
|
---|
573 | 13 subprogram_head: FUNCTION ID arguments . ':' standard_type ';'
|
---|
574 |
|
---|
575 | ':' shift, and go to state 66
|
---|
576 |
|
---|
577 |
|
---|
578 | state 42
|
---|
579 |
|
---|
580 | 14 subprogram_head: PROCEDURE ID arguments . ';'
|
---|
581 |
|
---|
582 | ';' shift, and go to state 67
|
---|
583 |
|
---|
584 |
|
---|
585 | state 43
|
---|
586 |
|
---|
587 | 34 procedure_statement: ID '(' . expression_list ')'
|
---|
588 |
|
---|
589 | ID shift, and go to state 44
|
---|
590 | NUM shift, and go to state 45
|
---|
591 | NOT shift, and go to state 46
|
---|
592 | '(' shift, and go to state 68
|
---|
593 | '+' shift, and go to state 48
|
---|
594 | '-' shift, and go to state 49
|
---|
595 |
|
---|
596 | expression_list go to state 69
|
---|
597 | expression go to state 70
|
---|
598 | simple_expression go to state 52
|
---|
599 | term go to state 53
|
---|
600 | factor go to state 54
|
---|
601 | signplus go to state 55
|
---|
602 | signminus go to state 56
|
---|
603 |
|
---|
604 |
|
---|
605 | state 44
|
---|
606 |
|
---|
607 | 48 factor: ID .
|
---|
608 | 49 | ID . '(' expression_list ')'
|
---|
609 |
|
---|
610 | '(' shift, and go to state 71
|
---|
611 |
|
---|
612 | $default reduce using rule 48 (factor)
|
---|
613 |
|
---|
614 |
|
---|
615 | state 45
|
---|
616 |
|
---|
617 | 50 factor: NUM .
|
---|
618 |
|
---|
619 | $default reduce using rule 50 (factor)
|
---|
620 |
|
---|
621 |
|
---|
622 | state 46
|
---|
623 |
|
---|
624 | 52 factor: NOT . factor
|
---|
625 |
|
---|
626 | ID shift, and go to state 44
|
---|
627 | NUM shift, and go to state 45
|
---|
628 | NOT shift, and go to state 46
|
---|
629 | '(' shift, and go to state 68
|
---|
630 |
|
---|
631 | factor go to state 72
|
---|
632 |
|
---|
633 |
|
---|
634 | state 47
|
---|
635 |
|
---|
636 | 38 boollikeexp: '(' . boollikeexp ')'
|
---|
637 | 51 factor: '(' . expression ')'
|
---|
638 |
|
---|
639 | ID shift, and go to state 44
|
---|
640 | NUM shift, and go to state 45
|
---|
641 | NOT shift, and go to state 46
|
---|
642 | '(' shift, and go to state 47
|
---|
643 | '+' shift, and go to state 48
|
---|
644 | '-' shift, and go to state 49
|
---|
645 |
|
---|
646 | boollikeexp go to state 73
|
---|
647 | expression go to state 74
|
---|
648 | simple_expression go to state 52
|
---|
649 | term go to state 53
|
---|
650 | factor go to state 54
|
---|
651 | signplus go to state 55
|
---|
652 | signminus go to state 56
|
---|
653 |
|
---|
654 |
|
---|
655 | state 48
|
---|
656 |
|
---|
657 | 53 signplus: '+' .
|
---|
658 |
|
---|
659 | $default reduce using rule 53 (signplus)
|
---|
660 |
|
---|
661 |
|
---|
662 | state 49
|
---|
663 |
|
---|
664 | 54 signminus: '-' .
|
---|
665 |
|
---|
666 | $default reduce using rule 54 (signminus)
|
---|
667 |
|
---|
668 |
|
---|
669 | state 50
|
---|
670 |
|
---|
671 | 28 statement: IF boollikeexp . THEN statement optional_else_statement
|
---|
672 |
|
---|
673 | THEN shift, and go to state 75
|
---|
674 |
|
---|
675 |
|
---|
676 | state 51
|
---|
677 |
|
---|
678 | 37 boollikeexp: expression . RELOP expression
|
---|
679 |
|
---|
680 | RELOP shift, and go to state 76
|
---|
681 |
|
---|
682 |
|
---|
683 | state 52
|
---|
684 |
|
---|
685 | 39 expression: simple_expression .
|
---|
686 | 43 simple_expression: simple_expression . '+' term
|
---|
687 | 44 | simple_expression . '-' term
|
---|
688 | 45 | simple_expression . ADDOP term
|
---|
689 |
|
---|
690 | ADDOP shift, and go to state 77
|
---|
691 | '+' shift, and go to state 78
|
---|
692 | '-' shift, and go to state 79
|
---|
693 |
|
---|
694 | $default reduce using rule 39 (expression)
|
---|
695 |
|
---|
696 |
|
---|
697 | state 53
|
---|
698 |
|
---|
699 | 40 simple_expression: term .
|
---|
700 | 47 term: term . MULOP factor
|
---|
701 |
|
---|
702 | MULOP shift, and go to state 80
|
---|
703 |
|
---|
704 | $default reduce using rule 40 (simple_expression)
|
---|
705 |
|
---|
706 |
|
---|
707 | state 54
|
---|
708 |
|
---|
709 | 46 term: factor .
|
---|
710 |
|
---|
711 | $default reduce using rule 46 (term)
|
---|
712 |
|
---|
713 |
|
---|
714 | state 55
|
---|
715 |
|
---|
716 | 41 simple_expression: signplus . term
|
---|
717 |
|
---|
718 | ID shift, and go to state 44
|
---|
719 | NUM shift, and go to state 45
|
---|
720 | NOT shift, and go to state 46
|
---|
721 | '(' shift, and go to state 68
|
---|
722 |
|
---|
723 | term go to state 81
|
---|
724 | factor go to state 54
|
---|
725 |
|
---|
726 |
|
---|
727 | state 56
|
---|
728 |
|
---|
729 | 42 simple_expression: signminus . term
|
---|
730 |
|
---|
731 | ID shift, and go to state 44
|
---|
732 | NUM shift, and go to state 45
|
---|
733 | NOT shift, and go to state 46
|
---|
734 | '(' shift, and go to state 68
|
---|
735 |
|
---|
736 | term go to state 82
|
---|
737 | factor go to state 54
|
---|
738 |
|
---|
739 |
|
---|
740 | state 57
|
---|
741 |
|
---|
742 | 29 statement: WHILE boollikeexp . DO statement
|
---|
743 |
|
---|
744 | DO shift, and go to state 83
|
---|
745 |
|
---|
746 |
|
---|
747 | state 58
|
---|
748 |
|
---|
749 | 20 compound_statement: PASCALBEGIN optional_statements END .
|
---|
750 |
|
---|
751 | $default reduce using rule 20 (compound_statement)
|
---|
752 |
|
---|
753 |
|
---|
754 | state 59
|
---|
755 |
|
---|
756 | 24 statement_list: statement_list ';' . statement
|
---|
757 |
|
---|
758 | ID shift, and go to state 22
|
---|
759 | PASCALBEGIN shift, and go to state 13
|
---|
760 | IF shift, and go to state 23
|
---|
761 | WHILE shift, and go to state 24
|
---|
762 |
|
---|
763 | compound_statement go to state 25
|
---|
764 | statement go to state 84
|
---|
765 | variable go to state 29
|
---|
766 | procedure_statement go to state 30
|
---|
767 |
|
---|
768 |
|
---|
769 | state 60
|
---|
770 |
|
---|
771 | 25 statement: variable ASSIGNOP . expression
|
---|
772 |
|
---|
773 | ID shift, and go to state 44
|
---|
774 | NUM shift, and go to state 45
|
---|
775 | NOT shift, and go to state 46
|
---|
776 | '(' shift, and go to state 68
|
---|
777 | '+' shift, and go to state 48
|
---|
778 | '-' shift, and go to state 49
|
---|
779 |
|
---|
780 | expression go to state 85
|
---|
781 | simple_expression go to state 52
|
---|
782 | term go to state 53
|
---|
783 | factor go to state 54
|
---|
784 | signplus go to state 55
|
---|
785 | signminus go to state 56
|
---|
786 |
|
---|
787 |
|
---|
788 | state 61
|
---|
789 |
|
---|
790 | 12 subprogram_declaration: subprogram_head declarations compound_statement .
|
---|
791 |
|
---|
792 | $default reduce using rule 12 (subprogram_declaration)
|
---|
793 |
|
---|
794 |
|
---|
795 | state 62
|
---|
796 |
|
---|
797 | 3 type_identifier_list: ',' ID type_identifier_list .
|
---|
798 |
|
---|
799 | $default reduce using rule 3 (type_identifier_list)
|
---|
800 |
|
---|
801 |
|
---|
802 | state 63
|
---|
803 |
|
---|
804 | 19 parameter_list: ID . type_identifier_list
|
---|
805 |
|
---|
806 | ',' shift, and go to state 17
|
---|
807 | ':' shift, and go to state 18
|
---|
808 |
|
---|
809 | type_identifier_list go to state 86
|
---|
810 |
|
---|
811 |
|
---|
812 | state 64
|
---|
813 |
|
---|
814 | 15 arguments: '(' parameter_lists . ')'
|
---|
815 |
|
---|
816 | ')' shift, and go to state 87
|
---|
817 |
|
---|
818 |
|
---|
819 | state 65
|
---|
820 |
|
---|
821 | 17 parameter_lists: parameter_list . ';' parameter_lists
|
---|
822 | 18 | parameter_list .
|
---|
823 |
|
---|
824 | ';' shift, and go to state 88
|
---|
825 |
|
---|
826 | $default reduce using rule 18 (parameter_lists)
|
---|
827 |
|
---|
828 |
|
---|
829 | state 66
|
---|
830 |
|
---|
831 | 13 subprogram_head: FUNCTION ID arguments ':' . standard_type ';'
|
---|
832 |
|
---|
833 | INTEGER shift, and go to state 35
|
---|
834 | REAL shift, and go to state 36
|
---|
835 |
|
---|
836 | standard_type go to state 89
|
---|
837 |
|
---|
838 |
|
---|
839 | state 67
|
---|
840 |
|
---|
841 | 14 subprogram_head: PROCEDURE ID arguments ';' .
|
---|
842 |
|
---|
843 | $default reduce using rule 14 (subprogram_head)
|
---|
844 |
|
---|
845 |
|
---|
846 | state 68
|
---|
847 |
|
---|
848 | 51 factor: '(' . expression ')'
|
---|
849 |
|
---|
850 | ID shift, and go to state 44
|
---|
851 | NUM shift, and go to state 45
|
---|
852 | NOT shift, and go to state 46
|
---|
853 | '(' shift, and go to state 68
|
---|
854 | '+' shift, and go to state 48
|
---|
855 | '-' shift, and go to state 49
|
---|
856 |
|
---|
857 | expression go to state 90
|
---|
858 | simple_expression go to state 52
|
---|
859 | term go to state 53
|
---|
860 | factor go to state 54
|
---|
861 | signplus go to state 55
|
---|
862 | signminus go to state 56
|
---|
863 |
|
---|
864 |
|
---|
865 | state 69
|
---|
866 |
|
---|
867 | 34 procedure_statement: ID '(' expression_list . ')'
|
---|
868 |
|
---|
869 | ')' shift, and go to state 91
|
---|
870 |
|
---|
871 |
|
---|
872 | state 70
|
---|
873 |
|
---|
874 | 35 expression_list: expression .
|
---|
875 | 36 | expression . ',' expression_list
|
---|
876 |
|
---|
877 | ',' shift, and go to state 92
|
---|
878 |
|
---|
879 | $default reduce using rule 35 (expression_list)
|
---|
880 |
|
---|
881 |
|
---|
882 | state 71
|
---|
883 |
|
---|
884 | 49 factor: ID '(' . expression_list ')'
|
---|
885 |
|
---|
886 | ID shift, and go to state 44
|
---|
887 | NUM shift, and go to state 45
|
---|
888 | NOT shift, and go to state 46
|
---|
889 | '(' shift, and go to state 68
|
---|
890 | '+' shift, and go to state 48
|
---|
891 | '-' shift, and go to state 49
|
---|
892 |
|
---|
893 | expression_list go to state 93
|
---|
894 | expression go to state 70
|
---|
895 | simple_expression go to state 52
|
---|
896 | term go to state 53
|
---|
897 | factor go to state 54
|
---|
898 | signplus go to state 55
|
---|
899 | signminus go to state 56
|
---|
900 |
|
---|
901 |
|
---|
902 | state 72
|
---|
903 |
|
---|
904 | 52 factor: NOT factor .
|
---|
905 |
|
---|
906 | $default reduce using rule 52 (factor)
|
---|
907 |
|
---|
908 |
|
---|
909 | state 73
|
---|
910 |
|
---|
911 | 38 boollikeexp: '(' boollikeexp . ')'
|
---|
912 |
|
---|
913 | ')' shift, and go to state 94
|
---|
914 |
|
---|
915 |
|
---|
916 | state 74
|
---|
917 |
|
---|
918 | 37 boollikeexp: expression . RELOP expression
|
---|
919 | 51 factor: '(' expression . ')'
|
---|
920 |
|
---|
921 | RELOP shift, and go to state 76
|
---|
922 | ')' shift, and go to state 95
|
---|
923 |
|
---|
924 |
|
---|
925 | state 75
|
---|
926 |
|
---|
927 | 28 statement: IF boollikeexp THEN . statement optional_else_statement
|
---|
928 |
|
---|
929 | ID shift, and go to state 22
|
---|
930 | PASCALBEGIN shift, and go to state 13
|
---|
931 | IF shift, and go to state 23
|
---|
932 | WHILE shift, and go to state 24
|
---|
933 |
|
---|
934 | compound_statement go to state 25
|
---|
935 | statement go to state 96
|
---|
936 | variable go to state 29
|
---|
937 | procedure_statement go to state 30
|
---|
938 |
|
---|
939 |
|
---|
940 | state 76
|
---|
941 |
|
---|
942 | 37 boollikeexp: expression RELOP . expression
|
---|
943 |
|
---|
944 | ID shift, and go to state 44
|
---|
945 | NUM shift, and go to state 45
|
---|
946 | NOT shift, and go to state 46
|
---|
947 | '(' shift, and go to state 68
|
---|
948 | '+' shift, and go to state 48
|
---|
949 | '-' shift, and go to state 49
|
---|
950 |
|
---|
951 | expression go to state 97
|
---|
952 | simple_expression go to state 52
|
---|
953 | term go to state 53
|
---|
954 | factor go to state 54
|
---|
955 | signplus go to state 55
|
---|
956 | signminus go to state 56
|
---|
957 |
|
---|
958 |
|
---|
959 | state 77
|
---|
960 |
|
---|
961 | 45 simple_expression: simple_expression ADDOP . term
|
---|
962 |
|
---|
963 | ID shift, and go to state 44
|
---|
964 | NUM shift, and go to state 45
|
---|
965 | NOT shift, and go to state 46
|
---|
966 | '(' shift, and go to state 68
|
---|
967 |
|
---|
968 | term go to state 98
|
---|
969 | factor go to state 54
|
---|
970 |
|
---|
971 |
|
---|
972 | state 78
|
---|
973 |
|
---|
974 | 43 simple_expression: simple_expression '+' . term
|
---|
975 |
|
---|
976 | ID shift, and go to state 44
|
---|
977 | NUM shift, and go to state 45
|
---|
978 | NOT shift, and go to state 46
|
---|
979 | '(' shift, and go to state 68
|
---|
980 |
|
---|
981 | term go to state 99
|
---|
982 | factor go to state 54
|
---|
983 |
|
---|
984 |
|
---|
985 | state 79
|
---|
986 |
|
---|
987 | 44 simple_expression: simple_expression '-' . term
|
---|
988 |
|
---|
989 | ID shift, and go to state 44
|
---|
990 | NUM shift, and go to state 45
|
---|
991 | NOT shift, and go to state 46
|
---|
992 | '(' shift, and go to state 68
|
---|
993 |
|
---|
994 | term go to state 100
|
---|
995 | factor go to state 54
|
---|
996 |
|
---|
997 |
|
---|
998 | state 80
|
---|
999 |
|
---|
1000 | 47 term: term MULOP . factor
|
---|
1001 |
|
---|
1002 | ID shift, and go to state 44
|
---|
1003 | NUM shift, and go to state 45
|
---|
1004 | NOT shift, and go to state 46
|
---|
1005 | '(' shift, and go to state 68
|
---|
1006 |
|
---|
1007 | factor go to state 101
|
---|
1008 |
|
---|
1009 |
|
---|
1010 | state 81
|
---|
1011 |
|
---|
1012 | 41 simple_expression: signplus term .
|
---|
1013 | 47 term: term . MULOP factor
|
---|
1014 |
|
---|
1015 | MULOP shift, and go to state 80
|
---|
1016 |
|
---|
1017 | $default reduce using rule 41 (simple_expression)
|
---|
1018 |
|
---|
1019 |
|
---|
1020 | state 82
|
---|
1021 |
|
---|
1022 | 42 simple_expression: signminus term .
|
---|
1023 | 47 term: term . MULOP factor
|
---|
1024 |
|
---|
1025 | MULOP shift, and go to state 80
|
---|
1026 |
|
---|
1027 | $default reduce using rule 42 (simple_expression)
|
---|
1028 |
|
---|
1029 |
|
---|
1030 | state 83
|
---|
1031 |
|
---|
1032 | 29 statement: WHILE boollikeexp DO . statement
|
---|
1033 |
|
---|
1034 | ID shift, and go to state 22
|
---|
1035 | PASCALBEGIN shift, and go to state 13
|
---|
1036 | IF shift, and go to state 23
|
---|
1037 | WHILE shift, and go to state 24
|
---|
1038 |
|
---|
1039 | compound_statement go to state 25
|
---|
1040 | statement go to state 102
|
---|
1041 | variable go to state 29
|
---|
1042 | procedure_statement go to state 30
|
---|
1043 |
|
---|
1044 |
|
---|
1045 | state 84
|
---|
1046 |
|
---|
1047 | 24 statement_list: statement_list ';' statement .
|
---|
1048 |
|
---|
1049 | $default reduce using rule 24 (statement_list)
|
---|
1050 |
|
---|
1051 |
|
---|
1052 | state 85
|
---|
1053 |
|
---|
1054 | 25 statement: variable ASSIGNOP expression .
|
---|
1055 |
|
---|
1056 | $default reduce using rule 25 (statement)
|
---|
1057 |
|
---|
1058 |
|
---|
1059 | state 86
|
---|
1060 |
|
---|
1061 | 19 parameter_list: ID type_identifier_list .
|
---|
1062 |
|
---|
1063 | $default reduce using rule 19 (parameter_list)
|
---|
1064 |
|
---|
1065 |
|
---|
1066 | state 87
|
---|
1067 |
|
---|
1068 | 15 arguments: '(' parameter_lists ')' .
|
---|
1069 |
|
---|
1070 | $default reduce using rule 15 (arguments)
|
---|
1071 |
|
---|
1072 |
|
---|
1073 | state 88
|
---|
1074 |
|
---|
1075 | 17 parameter_lists: parameter_list ';' . parameter_lists
|
---|
1076 |
|
---|
1077 | ID shift, and go to state 63
|
---|
1078 |
|
---|
1079 | parameter_lists go to state 103
|
---|
1080 | parameter_list go to state 65
|
---|
1081 |
|
---|
1082 |
|
---|
1083 | state 89
|
---|
1084 |
|
---|
1085 | 13 subprogram_head: FUNCTION ID arguments ':' standard_type . ';'
|
---|
1086 |
|
---|
1087 | ';' shift, and go to state 104
|
---|
1088 |
|
---|
1089 |
|
---|
1090 | state 90
|
---|
1091 |
|
---|
1092 | 51 factor: '(' expression . ')'
|
---|
1093 |
|
---|
1094 | ')' shift, and go to state 95
|
---|
1095 |
|
---|
1096 |
|
---|
1097 | state 91
|
---|
1098 |
|
---|
1099 | 34 procedure_statement: ID '(' expression_list ')' .
|
---|
1100 |
|
---|
1101 | $default reduce using rule 34 (procedure_statement)
|
---|
1102 |
|
---|
1103 |
|
---|
1104 | state 92
|
---|
1105 |
|
---|
1106 | 36 expression_list: expression ',' . expression_list
|
---|
1107 |
|
---|
1108 | ID shift, and go to state 44
|
---|
1109 | NUM shift, and go to state 45
|
---|
1110 | NOT shift, and go to state 46
|
---|
1111 | '(' shift, and go to state 68
|
---|
1112 | '+' shift, and go to state 48
|
---|
1113 | '-' shift, and go to state 49
|
---|
1114 |
|
---|
1115 | expression_list go to state 105
|
---|
1116 | expression go to state 70
|
---|
1117 | simple_expression go to state 52
|
---|
1118 | term go to state 53
|
---|
1119 | factor go to state 54
|
---|
1120 | signplus go to state 55
|
---|
1121 | signminus go to state 56
|
---|
1122 |
|
---|
1123 |
|
---|
1124 | state 93
|
---|
1125 |
|
---|
1126 | 49 factor: ID '(' expression_list . ')'
|
---|
1127 |
|
---|
1128 | ')' shift, and go to state 106
|
---|
1129 |
|
---|
1130 |
|
---|
1131 | state 94
|
---|
1132 |
|
---|
1133 | 38 boollikeexp: '(' boollikeexp ')' .
|
---|
1134 |
|
---|
1135 | $default reduce using rule 38 (boollikeexp)
|
---|
1136 |
|
---|
1137 |
|
---|
1138 | state 95
|
---|
1139 |
|
---|
1140 | 51 factor: '(' expression ')' .
|
---|
1141 |
|
---|
1142 | $default reduce using rule 51 (factor)
|
---|
1143 |
|
---|
1144 |
|
---|
1145 | state 96
|
---|
1146 |
|
---|
1147 | 28 statement: IF boollikeexp THEN statement . optional_else_statement
|
---|
1148 |
|
---|
1149 | ELSE shift, and go to state 107
|
---|
1150 |
|
---|
1151 | ELSE [reduce using rule 31 (optional_else_statement)]
|
---|
1152 | $default reduce using rule 31 (optional_else_statement)
|
---|
1153 |
|
---|
1154 | optional_else_statement go to state 108
|
---|
1155 |
|
---|
1156 |
|
---|
1157 | state 97
|
---|
1158 |
|
---|
1159 | 37 boollikeexp: expression RELOP expression .
|
---|
1160 |
|
---|
1161 | $default reduce using rule 37 (boollikeexp)
|
---|
1162 |
|
---|
1163 |
|
---|
1164 | state 98
|
---|
1165 |
|
---|
1166 | 45 simple_expression: simple_expression ADDOP term .
|
---|
1167 | 47 term: term . MULOP factor
|
---|
1168 |
|
---|
1169 | MULOP shift, and go to state 80
|
---|
1170 |
|
---|
1171 | $default reduce using rule 45 (simple_expression)
|
---|
1172 |
|
---|
1173 |
|
---|
1174 | state 99
|
---|
1175 |
|
---|
1176 | 43 simple_expression: simple_expression '+' term .
|
---|
1177 | 47 term: term . MULOP factor
|
---|
1178 |
|
---|
1179 | MULOP shift, and go to state 80
|
---|
1180 |
|
---|
1181 | $default reduce using rule 43 (simple_expression)
|
---|
1182 |
|
---|
1183 |
|
---|
1184 | state 100
|
---|
1185 |
|
---|
1186 | 44 simple_expression: simple_expression '-' term .
|
---|
1187 | 47 term: term . MULOP factor
|
---|
1188 |
|
---|
1189 | MULOP shift, and go to state 80
|
---|
1190 |
|
---|
1191 | $default reduce using rule 44 (simple_expression)
|
---|
1192 |
|
---|
1193 |
|
---|
1194 | state 101
|
---|
1195 |
|
---|
1196 | 47 term: term MULOP factor .
|
---|
1197 |
|
---|
1198 | $default reduce using rule 47 (term)
|
---|
1199 |
|
---|
1200 |
|
---|
1201 | state 102
|
---|
1202 |
|
---|
1203 | 29 statement: WHILE boollikeexp DO statement .
|
---|
1204 |
|
---|
1205 | $default reduce using rule 29 (statement)
|
---|
1206 |
|
---|
1207 |
|
---|
1208 | state 103
|
---|
1209 |
|
---|
1210 | 17 parameter_lists: parameter_list ';' parameter_lists .
|
---|
1211 |
|
---|
1212 | $default reduce using rule 17 (parameter_lists)
|
---|
1213 |
|
---|
1214 |
|
---|
1215 | state 104
|
---|
1216 |
|
---|
1217 | 13 subprogram_head: FUNCTION ID arguments ':' standard_type ';' .
|
---|
1218 |
|
---|
1219 | $default reduce using rule 13 (subprogram_head)
|
---|
1220 |
|
---|
1221 |
|
---|
1222 | state 105
|
---|
1223 |
|
---|
1224 | 36 expression_list: expression ',' expression_list .
|
---|
1225 |
|
---|
1226 | $default reduce using rule 36 (expression_list)
|
---|
1227 |
|
---|
1228 |
|
---|
1229 | state 106
|
---|
1230 |
|
---|
1231 | 49 factor: ID '(' expression_list ')' .
|
---|
1232 |
|
---|
1233 | $default reduce using rule 49 (factor)
|
---|
1234 |
|
---|
1235 |
|
---|
1236 | state 107
|
---|
1237 |
|
---|
1238 | 30 optional_else_statement: ELSE . statement
|
---|
1239 |
|
---|
1240 | ID shift, and go to state 22
|
---|
1241 | PASCALBEGIN shift, and go to state 13
|
---|
1242 | IF shift, and go to state 23
|
---|
1243 | WHILE shift, and go to state 24
|
---|
1244 |
|
---|
1245 | compound_statement go to state 25
|
---|
1246 | statement go to state 109
|
---|
1247 | variable go to state 29
|
---|
1248 | procedure_statement go to state 30
|
---|
1249 |
|
---|
1250 |
|
---|
1251 | state 108
|
---|
1252 |
|
---|
1253 | 28 statement: IF boollikeexp THEN statement optional_else_statement .
|
---|
1254 |
|
---|
1255 | $default reduce using rule 28 (statement)
|
---|
1256 |
|
---|
1257 |
|
---|
1258 | state 109
|
---|
1259 |
|
---|
1260 | 30 optional_else_statement: ELSE statement .
|
---|
1261 |
|
---|
1262 | $default reduce using rule 30 (optional_else_statement)
|
---|