State table ----------- state 0 *start* --> . line *eoi* (rule 1) *default* : Error error : shift and goto state 6 ID : shift and goto state 5 NUM : shift and goto state 4 LPAREN : shift and goto state 3 NEWLINE : shift and goto state 2 - : shift and goto state 1 state 1 expr --> - . expr (rule 11) *default* : Error ID : shift and goto state 10 NUM : shift and goto state 4 LPAREN : shift and goto state 3 - : shift and goto state 1 state 2 line --> NEWLINE . (rule 4) *default* : reduce using rule 4 state 3 expr --> LPAREN . expr RPAREN (rule 15) *default* : Error ID : shift and goto state 10 NUM : shift and goto state 4 LPAREN : shift and goto state 3 - : shift and goto state 1 state 4 expr --> NUM . (rule 14) *default* : reduce using rule 14 state 5 assign --> ID . = expr (rule 6) expr --> ID . (rule 12) expr --> ID . LPAREN args RPAREN (rule 13) *default* : reduce using rule 12 = : shift and goto state 14 LPAREN : shift and goto state 13 state 6 line --> error . NEWLINE (rule 5) *default* : Error NEWLINE : shift and goto state 15 state 7 line --> expr . NEWLINE (rule 3) expr --> expr . + expr (rule 7) expr --> expr . - expr (rule 8) expr --> expr . * expr (rule 9) expr --> expr . / expr (rule 10) *default* : Error NEWLINE : shift and goto state 20 + : shift and goto state 19 - : shift and goto state 18 * : shift and goto state 17 / : shift and goto state 16 state 8 line --> assign . NEWLINE (rule 2) *default* : Error NEWLINE : shift and goto state 21 state 9 *start* --> line . *eoi* (rule 1) *default* : Error *eoi* : shift and goto state 22 state 10 expr --> ID . (rule 12) expr --> ID . LPAREN args RPAREN (rule 13) *default* : reduce using rule 12 LPAREN : shift and goto state 13 state 11 expr --> expr . + expr (rule 7) expr --> expr . - expr (rule 8) expr --> expr . * expr (rule 9) expr --> expr . / expr (rule 10) expr --> - expr . (rule 11) *default* : reduce using rule 11 / : shift and goto state 16 * : shift and goto state 17 state 12 expr --> expr . + expr (rule 7) expr --> expr . - expr (rule 8) expr --> expr . * expr (rule 9) expr --> expr . / expr (rule 10) expr --> LPAREN expr . RPAREN (rule 15) *default* : Error RPAREN : shift and goto state 23 + : shift and goto state 19 - : shift and goto state 18 * : shift and goto state 17 / : shift and goto state 16 state 13 expr --> ID LPAREN . args RPAREN (rule 13) *default* : reduce using rule 16 ID : shift and goto state 10 NUM : shift and goto state 4 LPAREN : shift and goto state 3 STRING : shift and goto state 24 - : shift and goto state 1 state 14 assign --> ID = . expr (rule 6) *default* : Error ID : shift and goto state 10 NUM : shift and goto state 4 LPAREN : shift and goto state 3 - : shift and goto state 1 state 15 line --> error NEWLINE . (rule 5) *default* : reduce using rule 5 state 16 expr --> expr / . expr (rule 10) *default* : Error ID : shift and goto state 10 NUM : shift and goto state 4 LPAREN : shift and goto state 3 - : shift and goto state 1 state 17 expr --> expr * . expr (rule 9) *default* : Error ID : shift and goto state 10 NUM : shift and goto state 4 LPAREN : shift and goto state 3 - : shift and goto state 1 state 18 expr --> expr - . expr (rule 8) *default* : Error ID : shift and goto state 10 NUM : shift and goto state 4 LPAREN : shift and goto state 3 - : shift and goto state 1 state 19 expr --> expr + . expr (rule 7) *default* : Error ID : shift and goto state 10 NUM : shift and goto state 4 LPAREN : shift and goto state 3 - : shift and goto state 1 state 20 line --> expr NEWLINE . (rule 3) *default* : reduce using rule 3 state 21 line --> assign NEWLINE . (rule 2) *default* : reduce using rule 2 state 22 *start* --> line *eoi* . (rule 1) *default* : reduce using rule 1 *eoi* : Accept input state 23 expr --> LPAREN expr RPAREN . (rule 15) *default* : reduce using rule 15 state 24 args --> STRING . arg-rest (rule 18) *default* : reduce using rule 21 COMMA : shift and goto state 32 state 25 expr --> ID LPAREN args . RPAREN (rule 13) *default* : Error RPAREN : shift and goto state 34 state 26 expr --> expr . + expr (rule 7) expr --> expr . - expr (rule 8) expr --> expr . * expr (rule 9) expr --> expr . / expr (rule 10) args --> expr . arg-rest (rule 17) *default* : reduce using rule 21 COMMA : shift and goto state 32 + : shift and goto state 19 - : shift and goto state 18 * : shift and goto state 17 / : shift and goto state 16 state 27 assign --> ID = expr . (rule 6) expr --> expr . + expr (rule 7) expr --> expr . - expr (rule 8) expr --> expr . * expr (rule 9) expr --> expr . / expr (rule 10) *default* : reduce using rule 6 + : shift and goto state 19 - : shift and goto state 18 * : shift and goto state 17 / : shift and goto state 16 state 28 expr --> expr . + expr (rule 7) expr --> expr . - expr (rule 8) expr --> expr . * expr (rule 9) expr --> expr . / expr (rule 10) expr --> expr / expr . (rule 10) *default* : reduce using rule 10 state 29 expr --> expr . + expr (rule 7) expr --> expr . - expr (rule 8) expr --> expr . * expr (rule 9) expr --> expr * expr . (rule 9) expr --> expr . / expr (rule 10) *default* : reduce using rule 9 state 30 expr --> expr . + expr (rule 7) expr --> expr . - expr (rule 8) expr --> expr - expr . (rule 8) expr --> expr . * expr (rule 9) expr --> expr . / expr (rule 10) *default* : reduce using rule 8 / : shift and goto state 16 * : shift and goto state 17 state 31 expr --> expr . + expr (rule 7) expr --> expr + expr . (rule 7) expr --> expr . - expr (rule 8) expr --> expr . * expr (rule 9) expr --> expr . / expr (rule 10) *default* : reduce using rule 7 / : shift and goto state 16 * : shift and goto state 17 state 32 arg-rest --> COMMA . expr arg-rest (rule 19) arg-rest --> COMMA . STRING arg-rest (rule 20) *default* : Error ID : shift and goto state 10 NUM : shift and goto state 4 LPAREN : shift and goto state 3 STRING : shift and goto state 36 - : shift and goto state 1 state 33 args --> STRING arg-rest . (rule 18) *default* : reduce using rule 18 state 34 expr --> ID LPAREN args RPAREN . (rule 13) *default* : reduce using rule 13 state 35 args --> expr arg-rest . (rule 17) *default* : reduce using rule 17 state 36 arg-rest --> COMMA STRING . arg-rest (rule 20) *default* : reduce using rule 21 COMMA : shift and goto state 32 state 37 expr --> expr . + expr (rule 7) expr --> expr . - expr (rule 8) expr --> expr . * expr (rule 9) expr --> expr . / expr (rule 10) arg-rest --> COMMA expr . arg-rest (rule 19) *default* : reduce using rule 21 COMMA : shift and goto state 32 + : shift and goto state 19 - : shift and goto state 18 * : shift and goto state 17 / : shift and goto state 16 state 38 arg-rest --> COMMA STRING arg-rest . (rule 20) *default* : reduce using rule 20 state 39 arg-rest --> COMMA expr arg-rest . (rule 19) *default* : reduce using rule 19