GNU Bison XML Automaton Report

input grammar: parser.y

Table of Contents

Reductions

Nonterminals useless in grammar

Terminals unused in grammar

Rules useless in grammar

Conflicts

Grammar

0 $acceptinput $end 1 input → %empty 2 | expr 3 exprNUMBER 4 | '(' expr ')' 5 | expr PLUS expr 6 | expr MINUS expr 7 | expr MULT expr 8 | expr DIV expr

Terminals, with rules where they appear

$end (0) 0 '(' (40) 4 ')' (41) 4 error (256) NUMBER (258) 3 PLUS (259) 5 MINUS (260) 6 MULT (261) 7 DIV (262) 8

Nonterminals, with rules where they appear

$accept (10) on left: 0 input (11) on left: 1 2 on right: 0 expr (12) on left: 3 4 5 6 7 8 on right: 2 4 5 6 7 8

Automaton

state 0

0 $accept. input $end 1 input. %empty [$end] 2 | . expr 3 expr. NUMBER 4 | . '(' expr ')' 5 | . expr PLUS expr 6 | . expr MINUS expr 7 | . expr MULT expr 8 | . expr DIV expr NUMBER shift, and go to state 1 '(' shift, and go to state 2 $default reduce using rule 1 (input) input go to state 3 expr go to state 4

state 1

3 exprNUMBER . $default reduce using rule 3 (expr)

state 2

3 expr. NUMBER 4 | . '(' expr ')' 4 | '(' . expr ')' 5 | . expr PLUS expr 6 | . expr MINUS expr 7 | . expr MULT expr 8 | . expr DIV expr NUMBER shift, and go to state 1 '(' shift, and go to state 2 expr go to state 5

state 3

0 $acceptinput . $end $end shift, and go to state 6

state 4

2 inputexpr . [$end] 5 exprexpr . PLUS expr 6 | expr . MINUS expr 7 | expr . MULT expr 8 | expr . DIV expr PLUS shift, and go to state 7 MINUS shift, and go to state 8 MULT shift, and go to state 9 DIV shift, and go to state 10 $default reduce using rule 2 (input)

state 5

4 expr'(' expr . ')' 5 | expr . PLUS expr 6 | expr . MINUS expr 7 | expr . MULT expr 8 | expr . DIV expr PLUS shift, and go to state 7 MINUS shift, and go to state 8 MULT shift, and go to state 9 DIV shift, and go to state 10 ')' shift, and go to state 11

state 6

0 $acceptinput $end . $default accept

state 7

3 expr. NUMBER 4 | . '(' expr ')' 5 | . expr PLUS expr 5 | expr PLUS . expr 6 | . expr MINUS expr 7 | . expr MULT expr 8 | . expr DIV expr NUMBER shift, and go to state 1 '(' shift, and go to state 2 expr go to state 12

state 8

3 expr. NUMBER 4 | . '(' expr ')' 5 | . expr PLUS expr 6 | . expr MINUS expr 6 | expr MINUS . expr 7 | . expr MULT expr 8 | . expr DIV expr NUMBER shift, and go to state 1 '(' shift, and go to state 2 expr go to state 13

state 9

3 expr. NUMBER 4 | . '(' expr ')' 5 | . expr PLUS expr 6 | . expr MINUS expr 7 | . expr MULT expr 7 | expr MULT . expr 8 | . expr DIV expr NUMBER shift, and go to state 1 '(' shift, and go to state 2 expr go to state 14

state 10

3 expr. NUMBER 4 | . '(' expr ')' 5 | . expr PLUS expr 6 | . expr MINUS expr 7 | . expr MULT expr 8 | . expr DIV expr 8 | expr DIV . expr NUMBER shift, and go to state 1 '(' shift, and go to state 2 expr go to state 15

state 11

4 expr'(' expr ')' . $default reduce using rule 4 (expr)

state 12

5 exprexpr . PLUS expr 5 | expr PLUS expr . [$end, PLUS, MINUS, ')'] 6 | expr . MINUS expr 7 | expr . MULT expr 8 | expr . DIV expr MULT shift, and go to state 9 DIV shift, and go to state 10 $default reduce using rule 5 (expr) Conflict between rule 5 and token PLUS resolved as reduce (%left PLUS). Conflict between rule 5 and token MINUS resolved as reduce (%left MINUS). Conflict between rule 5 and token MULT resolved as shift (PLUS < MULT). Conflict between rule 5 and token DIV resolved as shift (PLUS < DIV).

state 13

5 exprexpr . PLUS expr 6 | expr . MINUS expr 6 | expr MINUS expr . [$end, PLUS, MINUS, ')'] 7 | expr . MULT expr 8 | expr . DIV expr MULT shift, and go to state 9 DIV shift, and go to state 10 $default reduce using rule 6 (expr) Conflict between rule 6 and token PLUS resolved as reduce (%left PLUS). Conflict between rule 6 and token MINUS resolved as reduce (%left MINUS). Conflict between rule 6 and token MULT resolved as shift (MINUS < MULT). Conflict between rule 6 and token DIV resolved as shift (MINUS < DIV).

state 14

5 exprexpr . PLUS expr 6 | expr . MINUS expr 7 | expr . MULT expr 7 | expr MULT expr . [$end, PLUS, MINUS, MULT, DIV, ')'] 8 | expr . DIV expr $default reduce using rule 7 (expr) Conflict between rule 7 and token PLUS resolved as reduce (PLUS < MULT). Conflict between rule 7 and token MINUS resolved as reduce (MINUS < MULT). Conflict between rule 7 and token MULT resolved as reduce (%left MULT). Conflict between rule 7 and token DIV resolved as reduce (%left DIV).

state 15

5 exprexpr . PLUS expr 6 | expr . MINUS expr 7 | expr . MULT expr 8 | expr . DIV expr 8 | expr DIV expr . [$end, PLUS, MINUS, MULT, DIV, ')'] $default reduce using rule 8 (expr) Conflict between rule 8 and token PLUS resolved as reduce (PLUS < DIV). Conflict between rule 8 and token MINUS resolved as reduce (MINUS < DIV). Conflict between rule 8 and token MULT resolved as reduce (%left MULT). Conflict between rule 8 and token DIV resolved as reduce (%left DIV).