GNU Bison XML Automaton Report

input grammar: c++-types.y

Table of Contents

Reductions

Nonterminals useless in grammar

Terminals unused in grammar

Rules useless in grammar

Conflicts

State 17 conflicts: 1 reduce/reduce

Grammar

0 $acceptprog $end 1 prog → %empty 2 | prog stmt 3 stmtexpr ';' 4 | decl 5 | error ';' 6 expr"identifier" 7 | "typename" '(' expr ')' 8 | expr '+' expr 9 | expr '=' expr 10 decl"typename" declarator ';' 11 | "typename" declarator '=' expr ';' 12 declarator"identifier" 13 | '(' declarator ')'

Terminals, with rules where they appear

Nonterminals, with rules where they appear

Automaton

State 0

0 $accept prog $end 1 prog %empty 2 | prog stmt $default reduce using rule 1 (prog) prog go to state 1

State 1

0 $acceptprog $end 2 progprog stmt 3 stmt expr ';' 4 | decl 5 | error ';' 6 expr "identifier" 7 | "typename" '(' expr ')' 8 | expr '+' expr 9 | expr '=' expr 10 decl "typename" declarator ';' 11 | "typename" declarator '=' expr ';' $end shift, and go to state 2 error shift, and go to state 3 "typename" shift, and go to state 4 "identifier" shift, and go to state 5 stmt go to state 6 expr go to state 7 decl go to state 8

State 2

0 $acceptprog $end $default accept

State 3

5 stmterror ';' ';' shift, and go to state 9

State 4

7 expr"typename" '(' expr ')' 10 decl"typename" declarator ';' 11 | "typename" declarator '=' expr ';' 12 declarator "identifier" 13 | '(' declarator ')' "identifier" shift, and go to state 10 '(' shift, and go to state 11 declarator go to state 12

State 5

6 expr"identifier" $default reduce using rule 6 (expr)

State 6

2 progprog stmt $default reduce using rule 2 (prog)

State 7

3 stmtexpr ';' 8 exprexpr '+' expr 9 | expr '=' expr '=' shift, and go to state 13 '+' shift, and go to state 14 ';' shift, and go to state 15

State 8

4 stmtdecl $default reduce using rule 4 (stmt)

State 9

5 stmterror ';' $default reduce using rule 5 (stmt)

State 10

12 declarator"identifier" $default reduce using rule 12 (declarator)

State 11

6 expr "identifier" 7 | "typename" '(' expr ')' 7 | "typename" '(' expr ')' 8 | expr '+' expr 9 | expr '=' expr 12 declarator "identifier" 13 | '(' declarator ')' 13 | '(' declarator ')' "typename" shift, and go to state 16 "identifier" shift, and go to state 17 '(' shift, and go to state 18 expr go to state 19 declarator go to state 20

State 12

10 decl"typename" declarator ';' 11 | "typename" declarator '=' expr ';' '=' shift, and go to state 21 ';' shift, and go to state 22

State 13

6 expr "identifier" 7 | "typename" '(' expr ')' 8 | expr '+' expr 9 | expr '=' expr 9 | expr '=' expr "typename" shift, and go to state 16 "identifier" shift, and go to state 5 expr go to state 23

State 14

6 expr "identifier" 7 | "typename" '(' expr ')' 8 | expr '+' expr 8 | expr '+' expr 9 | expr '=' expr "typename" shift, and go to state 16 "identifier" shift, and go to state 5 expr go to state 24

State 15

3 stmtexpr ';' $default reduce using rule 3 (stmt)

State 16

7 expr"typename" '(' expr ')' '(' shift, and go to state 25

State 17

6 expr"identifier" ['=', '+', ')'] 12 declarator"identifier" [')'] ')' reduce using rule 6 (expr) ')' [reduce using rule 12 (declarator)] $default reduce using rule 6 (expr)

State 18

12 declarator "identifier" 13 | '(' declarator ')' 13 | '(' declarator ')' "identifier" shift, and go to state 10 '(' shift, and go to state 18 declarator go to state 20

State 19

7 expr"typename" '(' expr ')' 8 | expr '+' expr 9 | expr '=' expr '=' shift, and go to state 13 '+' shift, and go to state 14 ')' shift, and go to state 26

State 20

13 declarator'(' declarator ')' ')' shift, and go to state 27

State 21

6 expr "identifier" 7 | "typename" '(' expr ')' 8 | expr '+' expr 9 | expr '=' expr 11 decl"typename" declarator '=' expr ';' "typename" shift, and go to state 16 "identifier" shift, and go to state 5 expr go to state 28

State 22

10 decl"typename" declarator ';' $default reduce using rule 10 (decl)

State 23

8 exprexpr '+' expr 9 | expr '=' expr 9 | expr '=' expr [';', ')'] '=' shift, and go to state 13 '+' shift, and go to state 14 $default reduce using rule 9 (expr) Conflict between rule 9 and token '=' resolved as shift (%right '='). Conflict between rule 9 and token '+' resolved as shift ('=' < '+').

State 24

8 exprexpr '+' expr 8 | expr '+' expr ['=', '+', ';', ')'] 9 | expr '=' expr $default reduce using rule 8 (expr) Conflict between rule 8 and token '=' resolved as reduce ('=' < '+'). Conflict between rule 8 and token '+' resolved as reduce (%left '+').

State 25

6 expr "identifier" 7 | "typename" '(' expr ')' 7 | "typename" '(' expr ')' 8 | expr '+' expr 9 | expr '=' expr "typename" shift, and go to state 16 "identifier" shift, and go to state 5 expr go to state 19

State 26

7 expr"typename" '(' expr ')' $default reduce using rule 7 (expr)

State 27

13 declarator'(' declarator ')' $default reduce using rule 13 (declarator)

State 28

8 exprexpr '+' expr 9 | expr '=' expr 11 decl"typename" declarator '=' expr ';' '=' shift, and go to state 13 '+' shift, and go to state 14 ';' shift, and go to state 29

State 29

11 decl"typename" declarator '=' expr ';' $default reduce using rule 11 (decl)