Grammar 0 $accept: line $end 1 line: /* empty */ 2 | line stmt '\n' 3 | line error '\n' 4 stmt: expr 5 expr: OPEN_PAREN expr CLOSE_PAREN 6 | '|' expr '|' 7 | expr '*' expr 8 | expr '/' expr 9 | expr '%' expr 10 | expr '-' expr 11 | expr '+' expr 12 | expr '!' 13 | expr EXPONENT expr 14 | '-' expr 15 | number 16 number: PI 17 | DIGIT 18 | number DIGIT Terminals, with rules where they appear $end (0) 0 '\n' (10) 2 3 '!' (33) 12 '%' (37) 9 '*' (42) 7 '+' (43) 11 '-' (45) 10 14 '/' (47) 8 '|' (124) 6 error (256) 3 DIGIT (258) 17 18 PI (259) 16 OPEN_PAREN (260) 5 CLOSE_PAREN (261) 5 UMINUS (262) EXPONENT (263) 13 Nonterminals, with rules where they appear $accept (17) on left: 0 line (18) on left: 1 2 3, on right: 0 2 3 stmt (19) on left: 4, on right: 2 expr (20) on left: 5 6 7 8 9 10 11 12 13 14 15, on right: 4 5 6 7 8 9 10 11 12 13 14 number (21) on left: 16 17 18, on right: 15 18 state 0 0 $accept: . line $end $default reduce using rule 1 (line) line go to state 1 state 1 0 $accept: line . $end 2 line: line . stmt '\n' 3 | line . error '\n' $end shift, and go to state 2 error shift, and go to state 3 DIGIT shift, and go to state 4 PI shift, and go to state 5 OPEN_PAREN shift, and go to state 6 '|' shift, and go to state 7 '-' shift, and go to state 8 stmt go to state 9 expr go to state 10 number go to state 11 state 2 0 $accept: line $end . $default accept state 3 3 line: line error . '\n' '\n' shift, and go to state 12 state 4 17 number: DIGIT . $default reduce using rule 17 (number) state 5 16 number: PI . $default reduce using rule 16 (number) state 6 5 expr: OPEN_PAREN . expr CLOSE_PAREN DIGIT shift, and go to state 4 PI shift, and go to state 5 OPEN_PAREN shift, and go to state 6 '|' shift, and go to state 7 '-' shift, and go to state 8 expr go to state 13 number go to state 11 state 7 6 expr: '|' . expr '|' DIGIT shift, and go to state 4 PI shift, and go to state 5 OPEN_PAREN shift, and go to state 6 '|' shift, and go to state 7 '-' shift, and go to state 8 expr go to state 14 number go to state 11 state 8 14 expr: '-' . expr DIGIT shift, and go to state 4 PI shift, and go to state 5 OPEN_PAREN shift, and go to state 6 '|' shift, and go to state 7 '-' shift, and go to state 8 expr go to state 15 number go to state 11 state 9 2 line: line stmt . '\n' '\n' shift, and go to state 16 state 10 4 stmt: expr . 7 expr: expr . '*' expr 8 | expr . '/' expr 9 | expr . '%' expr 10 | expr . '-' expr 11 | expr . '+' expr 12 | expr . '!' 13 | expr . EXPONENT expr '-' shift, and go to state 17 '+' shift, and go to state 18 '*' shift, and go to state 19 '/' shift, and go to state 20 '%' shift, and go to state 21 '!' shift, and go to state 22 EXPONENT shift, and go to state 23 $default reduce using rule 4 (stmt) state 11 15 expr: number . 18 number: number . DIGIT DIGIT shift, and go to state 24 $default reduce using rule 15 (expr) state 12 3 line: line error '\n' . $default reduce using rule 3 (line) state 13 5 expr: OPEN_PAREN expr . CLOSE_PAREN 7 | expr . '*' expr 8 | expr . '/' expr 9 | expr . '%' expr 10 | expr . '-' expr 11 | expr . '+' expr 12 | expr . '!' 13 | expr . EXPONENT expr CLOSE_PAREN shift, and go to state 25 '-' shift, and go to state 17 '+' shift, and go to state 18 '*' shift, and go to state 19 '/' shift, and go to state 20 '%' shift, and go to state 21 '!' shift, and go to state 22 EXPONENT shift, and go to state 23 state 14 6 expr: '|' expr . '|' 7 | expr . '*' expr 8 | expr . '/' expr 9 | expr . '%' expr 10 | expr . '-' expr 11 | expr . '+' expr 12 | expr . '!' 13 | expr . EXPONENT expr '|' shift, and go to state 26 '-' shift, and go to state 17 '+' shift, and go to state 18 '*' shift, and go to state 19 '/' shift, and go to state 20 '%' shift, and go to state 21 '!' shift, and go to state 22 EXPONENT shift, and go to state 23 state 15 7 expr: expr . '*' expr 8 | expr . '/' expr 9 | expr . '%' expr 10 | expr . '-' expr 11 | expr . '+' expr 12 | expr . '!' 13 | expr . EXPONENT expr 14 | '-' expr . '!' shift, and go to state 22 EXPONENT shift, and go to state 23 $default reduce using rule 14 (expr) state 16 2 line: line stmt '\n' . $default reduce using rule 2 (line) state 17 10 expr: expr '-' . expr DIGIT shift, and go to state 4 PI shift, and go to state 5 OPEN_PAREN shift, and go to state 6 '|' shift, and go to state 7 '-' shift, and go to state 8 expr go to state 27 number go to state 11 state 18 11 expr: expr '+' . expr DIGIT shift, and go to state 4 PI shift, and go to state 5 OPEN_PAREN shift, and go to state 6 '|' shift, and go to state 7 '-' shift, and go to state 8 expr go to state 28 number go to state 11 state 19 7 expr: expr '*' . expr DIGIT shift, and go to state 4 PI shift, and go to state 5 OPEN_PAREN shift, and go to state 6 '|' shift, and go to state 7 '-' shift, and go to state 8 expr go to state 29 number go to state 11 state 20 8 expr: expr '/' . expr DIGIT shift, and go to state 4 PI shift, and go to state 5 OPEN_PAREN shift, and go to state 6 '|' shift, and go to state 7 '-' shift, and go to state 8 expr go to state 30 number go to state 11 state 21 9 expr: expr '%' . expr DIGIT shift, and go to state 4 PI shift, and go to state 5 OPEN_PAREN shift, and go to state 6 '|' shift, and go to state 7 '-' shift, and go to state 8 expr go to state 31 number go to state 11 state 22 12 expr: expr '!' . $default reduce using rule 12 (expr) state 23 13 expr: expr EXPONENT . expr DIGIT shift, and go to state 4 PI shift, and go to state 5 OPEN_PAREN shift, and go to state 6 '|' shift, and go to state 7 '-' shift, and go to state 8 expr go to state 32 number go to state 11 state 24 18 number: number DIGIT . $default reduce using rule 18 (number) state 25 5 expr: OPEN_PAREN expr CLOSE_PAREN . $default reduce using rule 5 (expr) state 26 6 expr: '|' expr '|' . $default reduce using rule 6 (expr) state 27 7 expr: expr . '*' expr 8 | expr . '/' expr 9 | expr . '%' expr 10 | expr . '-' expr 10 | expr '-' expr . 11 | expr . '+' expr 12 | expr . '!' 13 | expr . EXPONENT expr '*' shift, and go to state 19 '/' shift, and go to state 20 '%' shift, and go to state 21 '!' shift, and go to state 22 EXPONENT shift, and go to state 23 $default reduce using rule 10 (expr) state 28 7 expr: expr . '*' expr 8 | expr . '/' expr 9 | expr . '%' expr 10 | expr . '-' expr 11 | expr . '+' expr 11 | expr '+' expr . 12 | expr . '!' 13 | expr . EXPONENT expr '*' shift, and go to state 19 '/' shift, and go to state 20 '%' shift, and go to state 21 '!' shift, and go to state 22 EXPONENT shift, and go to state 23 $default reduce using rule 11 (expr) state 29 7 expr: expr . '*' expr 7 | expr '*' expr . 8 | expr . '/' expr 9 | expr . '%' expr 10 | expr . '-' expr 11 | expr . '+' expr 12 | expr . '!' 13 | expr . EXPONENT expr '!' shift, and go to state 22 EXPONENT shift, and go to state 23 $default reduce using rule 7 (expr) state 30 7 expr: expr . '*' expr 8 | expr . '/' expr 8 | expr '/' expr . 9 | expr . '%' expr 10 | expr . '-' expr 11 | expr . '+' expr 12 | expr . '!' 13 | expr . EXPONENT expr '!' shift, and go to state 22 EXPONENT shift, and go to state 23 $default reduce using rule 8 (expr) state 31 7 expr: expr . '*' expr 8 | expr . '/' expr 9 | expr . '%' expr 9 | expr '%' expr . 10 | expr . '-' expr 11 | expr . '+' expr 12 | expr . '!' 13 | expr . EXPONENT expr '!' shift, and go to state 22 EXPONENT shift, and go to state 23 $default reduce using rule 9 (expr) state 32 7 expr: expr . '*' expr 8 | expr . '/' expr 9 | expr . '%' expr 10 | expr . '-' expr 11 | expr . '+' expr 12 | expr . '!' 13 | expr . EXPONENT expr 13 | expr EXPONENT expr . EXPONENT shift, and go to state 23 $default reduce using rule 13 (expr)