Terminals which are not used PROG_PARAMETER IRRELEVANT State 96 conflicts: 1 shift/reduce Grammar 0 $accept: program $end 1 @1: /* empty */ 2 program: PROGRAM ID @1 ';' declarations subprogram_declarations compound_statement '.' 3 type_identifier_list: ',' ID type_identifier_list 4 | ':' type 5 declarations: declarations VAR ID type_identifier_list ';' 6 | /* empty */ 7 type: standard_type 8 standard_type: INTEGER 9 | REAL 10 subprogram_declarations: subprogram_declarations subprogram_declaration ';' 11 | /* empty */ 12 subprogram_declaration: subprogram_head declarations compound_statement 13 subprogram_head: FUNCTION ID arguments ':' standard_type ';' 14 | PROCEDURE ID arguments ';' 15 arguments: '(' parameter_lists ')' 16 | /* empty */ 17 parameter_lists: parameter_list ';' parameter_lists 18 | parameter_list 19 parameter_list: ID type_identifier_list 20 compound_statement: PASCALBEGIN optional_statements END 21 optional_statements: statement_list 22 | /* empty */ 23 statement_list: statement 24 | statement_list ';' statement 25 statement: variable ASSIGNOP expression 26 | procedure_statement 27 | compound_statement 28 | IF boollikeexp THEN statement optional_else_statement 29 | WHILE boollikeexp DO statement 30 optional_else_statement: ELSE statement 31 | /* empty */ 32 variable: ID 33 procedure_statement: ID 34 | ID '(' expression_list ')' 35 expression_list: expression 36 | expression ',' expression_list 37 boollikeexp: expression RELOP expression 38 | '(' boollikeexp ')' 39 expression: simple_expression 40 simple_expression: term 41 | signplus term 42 | signminus term 43 | simple_expression '+' term 44 | simple_expression '-' term 45 | simple_expression ADDOP term 46 term: factor 47 | term MULOP factor 48 factor: ID 49 | ID '(' expression_list ')' 50 | NUM 51 | '(' expression ')' 52 | NOT factor 53 signplus: '+' 54 signminus: '-' Terminals, with rules where they appear $end (0) 0 '(' (40) 15 34 38 49 51 ')' (41) 15 34 38 49 51 '+' (43) 43 53 ',' (44) 3 36 '-' (45) 44 54 '.' (46) 2 ':' (58) 4 13 ';' (59) 2 5 10 13 14 17 24 error (256) PROGRAM (258) 2 ID (259) 2 3 5 13 14 19 32 33 34 48 49 VAR (260) 5 NUM (261) 50 INTEGER (262) 8 REAL (263) 9 FUNCTION (264) 13 PROCEDURE (265) 14 PASCALBEGIN (266) 20 END (267) 20 ADDOP (268) 45 ASSIGNOP (269) 25 IF (270) 28 THEN (271) 28 ELSE (272) 30 WHILE (273) 29 DO (274) 29 RELOP (275) 37 MULOP (276) 47 NOT (277) 52 PROG_PARAMETER (278) IRRELEVANT (279) UMINUS (280) Nonterminals, with rules where they appear $accept (34) on left: 0 program (35) on left: 2, on right: 0 @1 (36) on left: 1, on right: 2 type_identifier_list (37) on left: 3 4, on right: 3 5 19 declarations (38) on left: 5 6, on right: 2 5 12 type (39) on left: 7, on right: 4 standard_type (40) on left: 8 9, on right: 7 13 subprogram_declarations (41) on left: 10 11, on right: 2 10 subprogram_declaration (42) on left: 12, on right: 10 subprogram_head (43) on left: 13 14, on right: 12 arguments (44) on left: 15 16, on right: 13 14 parameter_lists (45) on left: 17 18, on right: 15 17 parameter_list (46) on left: 19, on right: 17 18 compound_statement (47) on left: 20, on right: 2 12 27 optional_statements (48) on left: 21 22, on right: 20 statement_list (49) on left: 23 24, on right: 21 24 statement (50) on left: 25 26 27 28 29, on right: 23 24 28 29 30 optional_else_statement (51) on left: 30 31, on right: 28 variable (52) on left: 32, on right: 25 procedure_statement (53) on left: 33 34, on right: 26 expression_list (54) on left: 35 36, on right: 34 36 49 boollikeexp (55) on left: 37 38, on right: 28 29 38 expression (56) on left: 39, on right: 25 35 36 37 51 simple_expression (57) on left: 40 41 42 43 44 45, on right: 39 43 44 45 term (58) on left: 46 47, on right: 40 41 42 43 44 45 47 factor (59) on left: 48 49 50 51 52, on right: 46 47 52 signplus (60) on left: 53, on right: 41 signminus (61) on left: 54, on right: 42 state 0 0 $accept: . program $end PROGRAM shift, and go to state 1 program go to state 2 state 1 2 program: PROGRAM . ID @1 ';' declarations subprogram_declarations compound_statement '.' ID shift, and go to state 3 state 2 0 $accept: program . $end $end shift, and go to state 4 state 3 2 program: PROGRAM ID . @1 ';' declarations subprogram_declarations compound_statement '.' $default reduce using rule 1 (@1) @1 go to state 5 state 4 0 $accept: program $end . $default accept state 5 2 program: PROGRAM ID @1 . ';' declarations subprogram_declarations compound_statement '.' ';' shift, and go to state 6 state 6 2 program: PROGRAM ID @1 ';' . declarations subprogram_declarations compound_statement '.' $default reduce using rule 6 (declarations) declarations go to state 7 state 7 2 program: PROGRAM ID @1 ';' declarations . subprogram_declarations compound_statement '.' 5 declarations: declarations . VAR ID type_identifier_list ';' VAR shift, and go to state 8 $default reduce using rule 11 (subprogram_declarations) subprogram_declarations go to state 9 state 8 5 declarations: declarations VAR . ID type_identifier_list ';' ID shift, and go to state 10 state 9 2 program: PROGRAM ID @1 ';' declarations subprogram_declarations . compound_statement '.' 10 subprogram_declarations: subprogram_declarations . subprogram_declaration ';' FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PASCALBEGIN shift, and go to state 13 subprogram_declaration go to state 14 subprogram_head go to state 15 compound_statement go to state 16 state 10 5 declarations: declarations VAR ID . type_identifier_list ';' ',' shift, and go to state 17 ':' shift, and go to state 18 type_identifier_list go to state 19 state 11 13 subprogram_head: FUNCTION . ID arguments ':' standard_type ';' ID shift, and go to state 20 state 12 14 subprogram_head: PROCEDURE . ID arguments ';' ID shift, and go to state 21 state 13 20 compound_statement: PASCALBEGIN . optional_statements END ID shift, and go to state 22 PASCALBEGIN shift, and go to state 13 IF shift, and go to state 23 WHILE shift, and go to state 24 $default reduce using rule 22 (optional_statements) compound_statement go to state 25 optional_statements go to state 26 statement_list go to state 27 statement go to state 28 variable go to state 29 procedure_statement go to state 30 state 14 10 subprogram_declarations: subprogram_declarations subprogram_declaration . ';' ';' shift, and go to state 31 state 15 12 subprogram_declaration: subprogram_head . declarations compound_statement $default reduce using rule 6 (declarations) declarations go to state 32 state 16 2 program: PROGRAM ID @1 ';' declarations subprogram_declarations compound_statement . '.' '.' shift, and go to state 33 state 17 3 type_identifier_list: ',' . ID type_identifier_list ID shift, and go to state 34 state 18 4 type_identifier_list: ':' . type INTEGER shift, and go to state 35 REAL shift, and go to state 36 type go to state 37 standard_type go to state 38 state 19 5 declarations: declarations VAR ID type_identifier_list . ';' ';' shift, and go to state 39 state 20 13 subprogram_head: FUNCTION ID . arguments ':' standard_type ';' '(' shift, and go to state 40 $default reduce using rule 16 (arguments) arguments go to state 41 state 21 14 subprogram_head: PROCEDURE ID . arguments ';' '(' shift, and go to state 40 $default reduce using rule 16 (arguments) arguments go to state 42 state 22 32 variable: ID . 33 procedure_statement: ID . 34 | ID . '(' expression_list ')' '(' shift, and go to state 43 ASSIGNOP reduce using rule 32 (variable) $default reduce using rule 33 (procedure_statement) state 23 28 statement: IF . boollikeexp THEN statement optional_else_statement ID shift, and go to state 44 NUM shift, and go to state 45 NOT shift, and go to state 46 '(' shift, and go to state 47 '+' shift, and go to state 48 '-' shift, and go to state 49 boollikeexp go to state 50 expression go to state 51 simple_expression go to state 52 term go to state 53 factor go to state 54 signplus go to state 55 signminus go to state 56 state 24 29 statement: WHILE . boollikeexp DO statement ID shift, and go to state 44 NUM shift, and go to state 45 NOT shift, and go to state 46 '(' shift, and go to state 47 '+' shift, and go to state 48 '-' shift, and go to state 49 boollikeexp go to state 57 expression go to state 51 simple_expression go to state 52 term go to state 53 factor go to state 54 signplus go to state 55 signminus go to state 56 state 25 27 statement: compound_statement . $default reduce using rule 27 (statement) state 26 20 compound_statement: PASCALBEGIN optional_statements . END END shift, and go to state 58 state 27 21 optional_statements: statement_list . 24 statement_list: statement_list . ';' statement ';' shift, and go to state 59 $default reduce using rule 21 (optional_statements) state 28 23 statement_list: statement . $default reduce using rule 23 (statement_list) state 29 25 statement: variable . ASSIGNOP expression ASSIGNOP shift, and go to state 60 state 30 26 statement: procedure_statement . $default reduce using rule 26 (statement) state 31 10 subprogram_declarations: subprogram_declarations subprogram_declaration ';' . $default reduce using rule 10 (subprogram_declarations) state 32 5 declarations: declarations . VAR ID type_identifier_list ';' 12 subprogram_declaration: subprogram_head declarations . compound_statement VAR shift, and go to state 8 PASCALBEGIN shift, and go to state 13 compound_statement go to state 61 state 33 2 program: PROGRAM ID @1 ';' declarations subprogram_declarations compound_statement '.' . $default reduce using rule 2 (program) state 34 3 type_identifier_list: ',' ID . type_identifier_list ',' shift, and go to state 17 ':' shift, and go to state 18 type_identifier_list go to state 62 state 35 8 standard_type: INTEGER . $default reduce using rule 8 (standard_type) state 36 9 standard_type: REAL . $default reduce using rule 9 (standard_type) state 37 4 type_identifier_list: ':' type . $default reduce using rule 4 (type_identifier_list) state 38 7 type: standard_type . $default reduce using rule 7 (type) state 39 5 declarations: declarations VAR ID type_identifier_list ';' . $default reduce using rule 5 (declarations) state 40 15 arguments: '(' . parameter_lists ')' ID shift, and go to state 63 parameter_lists go to state 64 parameter_list go to state 65 state 41 13 subprogram_head: FUNCTION ID arguments . ':' standard_type ';' ':' shift, and go to state 66 state 42 14 subprogram_head: PROCEDURE ID arguments . ';' ';' shift, and go to state 67 state 43 34 procedure_statement: ID '(' . expression_list ')' ID shift, and go to state 44 NUM shift, and go to state 45 NOT shift, and go to state 46 '(' shift, and go to state 68 '+' shift, and go to state 48 '-' shift, and go to state 49 expression_list go to state 69 expression go to state 70 simple_expression go to state 52 term go to state 53 factor go to state 54 signplus go to state 55 signminus go to state 56 state 44 48 factor: ID . 49 | ID . '(' expression_list ')' '(' shift, and go to state 71 $default reduce using rule 48 (factor) state 45 50 factor: NUM . $default reduce using rule 50 (factor) state 46 52 factor: NOT . factor ID shift, and go to state 44 NUM shift, and go to state 45 NOT shift, and go to state 46 '(' shift, and go to state 68 factor go to state 72 state 47 38 boollikeexp: '(' . boollikeexp ')' 51 factor: '(' . expression ')' ID shift, and go to state 44 NUM shift, and go to state 45 NOT shift, and go to state 46 '(' shift, and go to state 47 '+' shift, and go to state 48 '-' shift, and go to state 49 boollikeexp go to state 73 expression go to state 74 simple_expression go to state 52 term go to state 53 factor go to state 54 signplus go to state 55 signminus go to state 56 state 48 53 signplus: '+' . $default reduce using rule 53 (signplus) state 49 54 signminus: '-' . $default reduce using rule 54 (signminus) state 50 28 statement: IF boollikeexp . THEN statement optional_else_statement THEN shift, and go to state 75 state 51 37 boollikeexp: expression . RELOP expression RELOP shift, and go to state 76 state 52 39 expression: simple_expression . 43 simple_expression: simple_expression . '+' term 44 | simple_expression . '-' term 45 | simple_expression . ADDOP term ADDOP shift, and go to state 77 '+' shift, and go to state 78 '-' shift, and go to state 79 $default reduce using rule 39 (expression) state 53 40 simple_expression: term . 47 term: term . MULOP factor MULOP shift, and go to state 80 $default reduce using rule 40 (simple_expression) state 54 46 term: factor . $default reduce using rule 46 (term) state 55 41 simple_expression: signplus . term ID shift, and go to state 44 NUM shift, and go to state 45 NOT shift, and go to state 46 '(' shift, and go to state 68 term go to state 81 factor go to state 54 state 56 42 simple_expression: signminus . term ID shift, and go to state 44 NUM shift, and go to state 45 NOT shift, and go to state 46 '(' shift, and go to state 68 term go to state 82 factor go to state 54 state 57 29 statement: WHILE boollikeexp . DO statement DO shift, and go to state 83 state 58 20 compound_statement: PASCALBEGIN optional_statements END . $default reduce using rule 20 (compound_statement) state 59 24 statement_list: statement_list ';' . statement ID shift, and go to state 22 PASCALBEGIN shift, and go to state 13 IF shift, and go to state 23 WHILE shift, and go to state 24 compound_statement go to state 25 statement go to state 84 variable go to state 29 procedure_statement go to state 30 state 60 25 statement: variable ASSIGNOP . expression ID shift, and go to state 44 NUM shift, and go to state 45 NOT shift, and go to state 46 '(' shift, and go to state 68 '+' shift, and go to state 48 '-' shift, and go to state 49 expression go to state 85 simple_expression go to state 52 term go to state 53 factor go to state 54 signplus go to state 55 signminus go to state 56 state 61 12 subprogram_declaration: subprogram_head declarations compound_statement . $default reduce using rule 12 (subprogram_declaration) state 62 3 type_identifier_list: ',' ID type_identifier_list . $default reduce using rule 3 (type_identifier_list) state 63 19 parameter_list: ID . type_identifier_list ',' shift, and go to state 17 ':' shift, and go to state 18 type_identifier_list go to state 86 state 64 15 arguments: '(' parameter_lists . ')' ')' shift, and go to state 87 state 65 17 parameter_lists: parameter_list . ';' parameter_lists 18 | parameter_list . ';' shift, and go to state 88 $default reduce using rule 18 (parameter_lists) state 66 13 subprogram_head: FUNCTION ID arguments ':' . standard_type ';' INTEGER shift, and go to state 35 REAL shift, and go to state 36 standard_type go to state 89 state 67 14 subprogram_head: PROCEDURE ID arguments ';' . $default reduce using rule 14 (subprogram_head) state 68 51 factor: '(' . expression ')' ID shift, and go to state 44 NUM shift, and go to state 45 NOT shift, and go to state 46 '(' shift, and go to state 68 '+' shift, and go to state 48 '-' shift, and go to state 49 expression go to state 90 simple_expression go to state 52 term go to state 53 factor go to state 54 signplus go to state 55 signminus go to state 56 state 69 34 procedure_statement: ID '(' expression_list . ')' ')' shift, and go to state 91 state 70 35 expression_list: expression . 36 | expression . ',' expression_list ',' shift, and go to state 92 $default reduce using rule 35 (expression_list) state 71 49 factor: ID '(' . expression_list ')' ID shift, and go to state 44 NUM shift, and go to state 45 NOT shift, and go to state 46 '(' shift, and go to state 68 '+' shift, and go to state 48 '-' shift, and go to state 49 expression_list go to state 93 expression go to state 70 simple_expression go to state 52 term go to state 53 factor go to state 54 signplus go to state 55 signminus go to state 56 state 72 52 factor: NOT factor . $default reduce using rule 52 (factor) state 73 38 boollikeexp: '(' boollikeexp . ')' ')' shift, and go to state 94 state 74 37 boollikeexp: expression . RELOP expression 51 factor: '(' expression . ')' RELOP shift, and go to state 76 ')' shift, and go to state 95 state 75 28 statement: IF boollikeexp THEN . statement optional_else_statement ID shift, and go to state 22 PASCALBEGIN shift, and go to state 13 IF shift, and go to state 23 WHILE shift, and go to state 24 compound_statement go to state 25 statement go to state 96 variable go to state 29 procedure_statement go to state 30 state 76 37 boollikeexp: expression RELOP . expression ID shift, and go to state 44 NUM shift, and go to state 45 NOT shift, and go to state 46 '(' shift, and go to state 68 '+' shift, and go to state 48 '-' shift, and go to state 49 expression go to state 97 simple_expression go to state 52 term go to state 53 factor go to state 54 signplus go to state 55 signminus go to state 56 state 77 45 simple_expression: simple_expression ADDOP . term ID shift, and go to state 44 NUM shift, and go to state 45 NOT shift, and go to state 46 '(' shift, and go to state 68 term go to state 98 factor go to state 54 state 78 43 simple_expression: simple_expression '+' . term ID shift, and go to state 44 NUM shift, and go to state 45 NOT shift, and go to state 46 '(' shift, and go to state 68 term go to state 99 factor go to state 54 state 79 44 simple_expression: simple_expression '-' . term ID shift, and go to state 44 NUM shift, and go to state 45 NOT shift, and go to state 46 '(' shift, and go to state 68 term go to state 100 factor go to state 54 state 80 47 term: term MULOP . factor ID shift, and go to state 44 NUM shift, and go to state 45 NOT shift, and go to state 46 '(' shift, and go to state 68 factor go to state 101 state 81 41 simple_expression: signplus term . 47 term: term . MULOP factor MULOP shift, and go to state 80 $default reduce using rule 41 (simple_expression) state 82 42 simple_expression: signminus term . 47 term: term . MULOP factor MULOP shift, and go to state 80 $default reduce using rule 42 (simple_expression) state 83 29 statement: WHILE boollikeexp DO . statement ID shift, and go to state 22 PASCALBEGIN shift, and go to state 13 IF shift, and go to state 23 WHILE shift, and go to state 24 compound_statement go to state 25 statement go to state 102 variable go to state 29 procedure_statement go to state 30 state 84 24 statement_list: statement_list ';' statement . $default reduce using rule 24 (statement_list) state 85 25 statement: variable ASSIGNOP expression . $default reduce using rule 25 (statement) state 86 19 parameter_list: ID type_identifier_list . $default reduce using rule 19 (parameter_list) state 87 15 arguments: '(' parameter_lists ')' . $default reduce using rule 15 (arguments) state 88 17 parameter_lists: parameter_list ';' . parameter_lists ID shift, and go to state 63 parameter_lists go to state 103 parameter_list go to state 65 state 89 13 subprogram_head: FUNCTION ID arguments ':' standard_type . ';' ';' shift, and go to state 104 state 90 51 factor: '(' expression . ')' ')' shift, and go to state 95 state 91 34 procedure_statement: ID '(' expression_list ')' . $default reduce using rule 34 (procedure_statement) state 92 36 expression_list: expression ',' . expression_list ID shift, and go to state 44 NUM shift, and go to state 45 NOT shift, and go to state 46 '(' shift, and go to state 68 '+' shift, and go to state 48 '-' shift, and go to state 49 expression_list go to state 105 expression go to state 70 simple_expression go to state 52 term go to state 53 factor go to state 54 signplus go to state 55 signminus go to state 56 state 93 49 factor: ID '(' expression_list . ')' ')' shift, and go to state 106 state 94 38 boollikeexp: '(' boollikeexp ')' . $default reduce using rule 38 (boollikeexp) state 95 51 factor: '(' expression ')' . $default reduce using rule 51 (factor) state 96 28 statement: IF boollikeexp THEN statement . optional_else_statement ELSE shift, and go to state 107 ELSE [reduce using rule 31 (optional_else_statement)] $default reduce using rule 31 (optional_else_statement) optional_else_statement go to state 108 state 97 37 boollikeexp: expression RELOP expression . $default reduce using rule 37 (boollikeexp) state 98 45 simple_expression: simple_expression ADDOP term . 47 term: term . MULOP factor MULOP shift, and go to state 80 $default reduce using rule 45 (simple_expression) state 99 43 simple_expression: simple_expression '+' term . 47 term: term . MULOP factor MULOP shift, and go to state 80 $default reduce using rule 43 (simple_expression) state 100 44 simple_expression: simple_expression '-' term . 47 term: term . MULOP factor MULOP shift, and go to state 80 $default reduce using rule 44 (simple_expression) state 101 47 term: term MULOP factor . $default reduce using rule 47 (term) state 102 29 statement: WHILE boollikeexp DO statement . $default reduce using rule 29 (statement) state 103 17 parameter_lists: parameter_list ';' parameter_lists . $default reduce using rule 17 (parameter_lists) state 104 13 subprogram_head: FUNCTION ID arguments ':' standard_type ';' . $default reduce using rule 13 (subprogram_head) state 105 36 expression_list: expression ',' expression_list . $default reduce using rule 36 (expression_list) state 106 49 factor: ID '(' expression_list ')' . $default reduce using rule 49 (factor) state 107 30 optional_else_statement: ELSE . statement ID shift, and go to state 22 PASCALBEGIN shift, and go to state 13 IF shift, and go to state 23 WHILE shift, and go to state 24 compound_statement go to state 25 statement go to state 109 variable go to state 29 procedure_statement go to state 30 state 108 28 statement: IF boollikeexp THEN statement optional_else_statement . $default reduce using rule 28 (statement) state 109 30 optional_else_statement: ELSE statement . $default reduce using rule 30 (optional_else_statement)