t64/c_compiler/frontend/parser.output
2020-06-21 14:14:57 -05:00

1024 lines
20 KiB
Plaintext

state 19 contains 1 shift/reduce conflicts
-------- Grammar --------
rule 1 program: func program
rule 2 program: func
rule 3 func: type IDENT LPAREN RPAREN block
rule 4 block: LCURL lines RCURL
rule 5 lines: line lines
rule 6 lines: line
rule 7 line: stmt SEMICOLON
rule 8 line: stmtnosemi
rule 9 line: ASM
rule 10 stmt: IDENT EQUAL expr
rule 11 stmt: postfixexp EQUAL expr
rule 12 stmt: type IDENT
rule 13 stmt: type IDENT EQUAL expr
rule 14 stmt: EXTERN type IDENT
rule 15 stmt: expr LPAREN RPAREN
rule 16 optstmtsemi: stmt SEMICOLON
rule 17 optstmtsemi: SEMICOLON
rule 18 optexprsemi: expr SEMICOLON
rule 19 optexprsemi: SEMICOLON
rule 20 optstmtparen: stmt RPAREN
rule 21 optstmtparen: RPAREN
rule 22 stmtnosemi: WHILE LPAREN expr RPAREN block
rule 23 stmtnosemi: FOR LPAREN optstmtsemi optexprsemi optstmtparen block
rule 24 factor: NUM
rule 25 factor: IDENT
rule 26 factor: LPAREN expr RPAREN
rule 27 postfixexp: factor
rule 28 postfixexp: postfixexp LBRACK expr RBRACK
rule 29 unaryexp: postfixexp
rule 30 unaryexp: ASTERISK castexp
rule 31 unaryexp: TILDE castexp
rule 32 castexp: unaryexp
rule 33 castexp: LPAREN type RPAREN castexp
rule 34 addexp: castexp
rule 35 addexp: addexp PLUS castexp
rule 36 addexp: addexp MINUS castexp
rule 37 cmpexp: addexp
rule 38 cmpexp: cmpexp GT addexp
rule 39 bitor: cmpexp
rule 40 bitor: bitor PIPE cmpexp
rule 41 expr: bitor
rule 42 type: TYPE
rule 43 type: TYPE ASTERISK
------- Symbols -------
**Nonterminals, with rules where they appear
$start (23)
on right:
on left :
program (24)
on right: 1
on left : 1 2
func (25)
on right: 1 2
on left : 3
type (26)
on right: 3 12 13 14 33
on left : 42 43
block (27)
on right: 3 22 23
on left : 4
lines (28)
on right: 4 5
on left : 5 6
line (29)
on right: 5 6
on left : 7 8 9
stmt (30)
on right: 7 16 20
on left : 10 11 12 13 14 15
stmtnosemi (31)
on right: 8
on left : 22 23
expr (32)
on right: 10 11 13 15 18 22 26 28
on left : 41
postfixexp (33)
on right: 11 28 29
on left : 27 28
optstmtsemi (34)
on right: 23
on left : 16 17
optexprsemi (35)
on right: 23
on left : 18 19
optstmtparen (36)
on right: 23
on left : 20 21
factor (37)
on right: 27
on left : 24 25 26
unaryexp (38)
on right: 32
on left : 29 30 31
castexp (39)
on right: 30 31 33 34 35 36
on left : 32 33
addexp (40)
on right: 35 36 37 38
on left : 34 35 36
cmpexp (41)
on right: 38 39 40
on left : 37 38
bitor (42)
on right: 40 41
on left : 39 40
**Terminals, with rules where they appear
$end (0)
error (1)
IDENT (2) 3 10 12 13 14 25
LPAREN (3) 3 15 22 23 26 33
RPAREN (4) 3 15 20 21 22 26 33
LCURL (5) 4
RCURL (6) 4
SEMICOLON (7) 7 16 17 18 19
ASM (8) 9
EQUAL (9) 10 11 13
EXTERN (10) 14
WHILE (11) 22
FOR (12) 23
NUM (13) 24
LBRACK (14) 28
RBRACK (15) 28
ASTERISK (16) 30 43
TILDE (17) 31
PLUS (18) 35
MINUS (19) 36
GT (20) 38
PIPE (21) 40
TYPE (22) 42 43
--------- State ---------
state 0
TYPE shift, and go to state 4
program go to state 1
func go to state 2
type go to state 3
state 1
$end shift, and go to state 5
state 2
1) program : func _ program
2) program : func _
TYPE shift, and go to state 4
$default reduce using rule 2 (program)
func go to state 2
program go to state 6
type go to state 3
state 3
3) func : type _ IDENT LPAREN RPAREN block
IDENT shift, and go to state 7
state 4
42) type : TYPE _
43) type : TYPE _ ASTERISK
ASTERISK shift, and go to state 8
$default reduce using rule 42 (type)
state 5
$end shift, and go to state 9
state 6
1) program : func program _
$default reduce using rule 1 (program)
state 7
3) func : type IDENT _ LPAREN RPAREN block
LPAREN shift, and go to state 10
state 8
43) type : TYPE ASTERISK _
$default reduce using rule 43 (type)
state 9
$default accept
state 10
3) func : type IDENT LPAREN _ RPAREN block
RPAREN shift, and go to state 11
state 11
3) func : type IDENT LPAREN RPAREN _ block
LCURL shift, and go to state 13
block go to state 12
state 12
3) func : type IDENT LPAREN RPAREN block _
$default reduce using rule 3 (func)
state 13
4) block : LCURL _ lines RCURL
IDENT shift, and go to state 19
LPAREN shift, and go to state 27
ASM shift, and go to state 18
EXTERN shift, and go to state 22
WHILE shift, and go to state 24
FOR shift, and go to state 25
NUM shift, and go to state 26
ASTERISK shift, and go to state 29
TILDE shift, and go to state 30
TYPE shift, and go to state 4
lines go to state 14
line go to state 15
stmt go to state 16
stmtnosemi go to state 17
postfixexp go to state 20
type go to state 21
expr go to state 23
factor go to state 28
unaryexp go to state 31
castexp go to state 32
addexp go to state 33
cmpexp go to state 34
bitor go to state 35
state 14
4) block : LCURL lines _ RCURL
RCURL shift, and go to state 36
state 15
5) lines : line _ lines
6) lines : line _
IDENT shift, and go to state 19
LPAREN shift, and go to state 27
ASM shift, and go to state 18
EXTERN shift, and go to state 22
WHILE shift, and go to state 24
FOR shift, and go to state 25
NUM shift, and go to state 26
ASTERISK shift, and go to state 29
TILDE shift, and go to state 30
TYPE shift, and go to state 4
$default reduce using rule 6 (lines)
line go to state 15
lines go to state 37
stmt go to state 16
stmtnosemi go to state 17
postfixexp go to state 20
type go to state 21
expr go to state 23
factor go to state 28
unaryexp go to state 31
castexp go to state 32
addexp go to state 33
cmpexp go to state 34
bitor go to state 35
state 16
7) line : stmt _ SEMICOLON
SEMICOLON shift, and go to state 38
state 17
8) line : stmtnosemi _
$default reduce using rule 8 (line)
state 18
9) line : ASM _
$default reduce using rule 9 (line)
state 19
10) stmt : IDENT _ EQUAL expr
25) factor : IDENT _
EQUAL shift, and go to state 39
EQUAL [reduce using rule 25 (factor)]
$default reduce using rule 25 (factor)
state 20
11) stmt : postfixexp _ EQUAL expr
28) postfixexp : postfixexp _ LBRACK expr RBRACK
29) unaryexp : postfixexp _
EQUAL shift, and go to state 40
LBRACK shift, and go to state 41
$default reduce using rule 29 (unaryexp)
state 21
12) stmt : type _ IDENT
13) stmt : type _ IDENT EQUAL expr
IDENT shift, and go to state 42
state 22
14) stmt : EXTERN _ type IDENT
TYPE shift, and go to state 4
type go to state 43
state 23
15) stmt : expr _ LPAREN RPAREN
LPAREN shift, and go to state 44
state 24
22) stmtnosemi : WHILE _ LPAREN expr RPAREN block
LPAREN shift, and go to state 45
state 25
23) stmtnosemi : FOR _ LPAREN optstmtsemi optexprsemi optstmtparen block
LPAREN shift, and go to state 46
state 26
24) factor : NUM _
$default reduce using rule 24 (factor)
state 27
26) factor : LPAREN _ expr RPAREN
33) castexp : LPAREN _ type RPAREN castexp
IDENT shift, and go to state 47
LPAREN shift, and go to state 27
NUM shift, and go to state 26
ASTERISK shift, and go to state 29
TILDE shift, and go to state 30
TYPE shift, and go to state 4
expr go to state 48
factor go to state 28
postfixexp go to state 49
unaryexp go to state 31
type go to state 50
castexp go to state 32
addexp go to state 33
cmpexp go to state 34
bitor go to state 35
state 28
27) postfixexp : factor _
$default reduce using rule 27 (postfixexp)
state 29
30) unaryexp : ASTERISK _ castexp
IDENT shift, and go to state 47
LPAREN shift, and go to state 27
NUM shift, and go to state 26
ASTERISK shift, and go to state 29
TILDE shift, and go to state 30
factor go to state 28
postfixexp go to state 49
castexp go to state 51
unaryexp go to state 31
state 30
31) unaryexp : TILDE _ castexp
IDENT shift, and go to state 47
LPAREN shift, and go to state 27
NUM shift, and go to state 26
ASTERISK shift, and go to state 29
TILDE shift, and go to state 30
factor go to state 28
postfixexp go to state 49
castexp go to state 52
unaryexp go to state 31
state 31
32) castexp : unaryexp _
$default reduce using rule 32 (castexp)
state 32
34) addexp : castexp _
$default reduce using rule 34 (addexp)
state 33
35) addexp : addexp _ PLUS castexp
36) addexp : addexp _ MINUS castexp
37) cmpexp : addexp _
PLUS shift, and go to state 53
MINUS shift, and go to state 54
$default reduce using rule 37 (cmpexp)
state 34
38) cmpexp : cmpexp _ GT addexp
39) bitor : cmpexp _
GT shift, and go to state 55
$default reduce using rule 39 (bitor)
state 35
40) bitor : bitor _ PIPE cmpexp
41) expr : bitor _
PIPE shift, and go to state 56
$default reduce using rule 41 (expr)
state 36
4) block : LCURL lines RCURL _
$default reduce using rule 4 (block)
state 37
5) lines : line lines _
$default reduce using rule 5 (lines)
state 38
7) line : stmt SEMICOLON _
$default reduce using rule 7 (line)
state 39
10) stmt : IDENT EQUAL _ expr
IDENT shift, and go to state 47
LPAREN shift, and go to state 27
NUM shift, and go to state 26
ASTERISK shift, and go to state 29
TILDE shift, and go to state 30
expr go to state 57
factor go to state 28
postfixexp go to state 49
unaryexp go to state 31
castexp go to state 32
addexp go to state 33
cmpexp go to state 34
bitor go to state 35
state 40
11) stmt : postfixexp EQUAL _ expr
IDENT shift, and go to state 47
LPAREN shift, and go to state 27
NUM shift, and go to state 26
ASTERISK shift, and go to state 29
TILDE shift, and go to state 30
expr go to state 58
factor go to state 28
postfixexp go to state 49
unaryexp go to state 31
castexp go to state 32
addexp go to state 33
cmpexp go to state 34
bitor go to state 35
state 41
28) postfixexp : postfixexp LBRACK _ expr RBRACK
IDENT shift, and go to state 47
LPAREN shift, and go to state 27
NUM shift, and go to state 26
ASTERISK shift, and go to state 29
TILDE shift, and go to state 30
factor go to state 28
postfixexp go to state 49
expr go to state 59
unaryexp go to state 31
castexp go to state 32
addexp go to state 33
cmpexp go to state 34
bitor go to state 35
state 42
12) stmt : type IDENT _
13) stmt : type IDENT _ EQUAL expr
EQUAL shift, and go to state 60
$default reduce using rule 12 (stmt)
state 43
14) stmt : EXTERN type _ IDENT
IDENT shift, and go to state 61
state 44
15) stmt : expr LPAREN _ RPAREN
RPAREN shift, and go to state 62
state 45
22) stmtnosemi : WHILE LPAREN _ expr RPAREN block
IDENT shift, and go to state 47
LPAREN shift, and go to state 27
NUM shift, and go to state 26
ASTERISK shift, and go to state 29
TILDE shift, and go to state 30
expr go to state 63
factor go to state 28
postfixexp go to state 49
unaryexp go to state 31
castexp go to state 32
addexp go to state 33
cmpexp go to state 34
bitor go to state 35
state 46
23) stmtnosemi : FOR LPAREN _ optstmtsemi optexprsemi optstmtparen block
IDENT shift, and go to state 19
LPAREN shift, and go to state 27
SEMICOLON shift, and go to state 65
EXTERN shift, and go to state 22
NUM shift, and go to state 26
ASTERISK shift, and go to state 29
TILDE shift, and go to state 30
TYPE shift, and go to state 4
postfixexp go to state 20
type go to state 21
expr go to state 23
stmt go to state 64
optstmtsemi go to state 66
factor go to state 28
unaryexp go to state 31
castexp go to state 32
addexp go to state 33
cmpexp go to state 34
bitor go to state 35
state 47
25) factor : IDENT _
$default reduce using rule 25 (factor)
state 48
26) factor : LPAREN expr _ RPAREN
RPAREN shift, and go to state 67
state 49
28) postfixexp : postfixexp _ LBRACK expr RBRACK
29) unaryexp : postfixexp _
LBRACK shift, and go to state 41
$default reduce using rule 29 (unaryexp)
state 50
33) castexp : LPAREN type _ RPAREN castexp
RPAREN shift, and go to state 68
state 51
30) unaryexp : ASTERISK castexp _
$default reduce using rule 30 (unaryexp)
state 52
31) unaryexp : TILDE castexp _
$default reduce using rule 31 (unaryexp)
state 53
35) addexp : addexp PLUS _ castexp
IDENT shift, and go to state 47
LPAREN shift, and go to state 27
NUM shift, and go to state 26
ASTERISK shift, and go to state 29
TILDE shift, and go to state 30
factor go to state 28
postfixexp go to state 49
unaryexp go to state 31
castexp go to state 69
state 54
36) addexp : addexp MINUS _ castexp
IDENT shift, and go to state 47
LPAREN shift, and go to state 27
NUM shift, and go to state 26
ASTERISK shift, and go to state 29
TILDE shift, and go to state 30
factor go to state 28
postfixexp go to state 49
unaryexp go to state 31
castexp go to state 70
state 55
38) cmpexp : cmpexp GT _ addexp
IDENT shift, and go to state 47
LPAREN shift, and go to state 27
NUM shift, and go to state 26
ASTERISK shift, and go to state 29
TILDE shift, and go to state 30
factor go to state 28
postfixexp go to state 49
unaryexp go to state 31
castexp go to state 32
addexp go to state 71
state 56
40) bitor : bitor PIPE _ cmpexp
IDENT shift, and go to state 47
LPAREN shift, and go to state 27
NUM shift, and go to state 26
ASTERISK shift, and go to state 29
TILDE shift, and go to state 30
factor go to state 28
postfixexp go to state 49
unaryexp go to state 31
castexp go to state 32
addexp go to state 33
cmpexp go to state 72
state 57
10) stmt : IDENT EQUAL expr _
$default reduce using rule 10 (stmt)
state 58
11) stmt : postfixexp EQUAL expr _
$default reduce using rule 11 (stmt)
state 59
28) postfixexp : postfixexp LBRACK expr _ RBRACK
RBRACK shift, and go to state 73
state 60
13) stmt : type IDENT EQUAL _ expr
IDENT shift, and go to state 47
LPAREN shift, and go to state 27
NUM shift, and go to state 26
ASTERISK shift, and go to state 29
TILDE shift, and go to state 30
expr go to state 74
factor go to state 28
postfixexp go to state 49
unaryexp go to state 31
castexp go to state 32
addexp go to state 33
cmpexp go to state 34
bitor go to state 35
state 61
14) stmt : EXTERN type IDENT _
$default reduce using rule 14 (stmt)
state 62
15) stmt : expr LPAREN RPAREN _
$default reduce using rule 15 (stmt)
state 63
22) stmtnosemi : WHILE LPAREN expr _ RPAREN block
RPAREN shift, and go to state 75
state 64
16) optstmtsemi : stmt _ SEMICOLON
SEMICOLON shift, and go to state 76
state 65
17) optstmtsemi : SEMICOLON _
$default reduce using rule 17 (optstmtsemi)
state 66
23) stmtnosemi : FOR LPAREN optstmtsemi _ optexprsemi optstmtparen block
IDENT shift, and go to state 47
LPAREN shift, and go to state 27
SEMICOLON shift, and go to state 78
NUM shift, and go to state 26
ASTERISK shift, and go to state 29
TILDE shift, and go to state 30
expr go to state 77
optexprsemi go to state 79
factor go to state 28
postfixexp go to state 49
unaryexp go to state 31
castexp go to state 32
addexp go to state 33
cmpexp go to state 34
bitor go to state 35
state 67
26) factor : LPAREN expr RPAREN _
$default reduce using rule 26 (factor)
state 68
33) castexp : LPAREN type RPAREN _ castexp
IDENT shift, and go to state 47
LPAREN shift, and go to state 27
NUM shift, and go to state 26
ASTERISK shift, and go to state 29
TILDE shift, and go to state 30
factor go to state 28
postfixexp go to state 49
unaryexp go to state 31
castexp go to state 80
state 69
35) addexp : addexp PLUS castexp _
$default reduce using rule 35 (addexp)
state 70
36) addexp : addexp MINUS castexp _
$default reduce using rule 36 (addexp)
state 71
35) addexp : addexp _ PLUS castexp
36) addexp : addexp _ MINUS castexp
38) cmpexp : cmpexp GT addexp _
PLUS shift, and go to state 53
MINUS shift, and go to state 54
$default reduce using rule 38 (cmpexp)
state 72
38) cmpexp : cmpexp _ GT addexp
40) bitor : bitor PIPE cmpexp _
GT shift, and go to state 55
$default reduce using rule 40 (bitor)
state 73
28) postfixexp : postfixexp LBRACK expr RBRACK _
$default reduce using rule 28 (postfixexp)
state 74
13) stmt : type IDENT EQUAL expr _
$default reduce using rule 13 (stmt)
state 75
22) stmtnosemi : WHILE LPAREN expr RPAREN _ block
LCURL shift, and go to state 13
block go to state 81
state 76
16) optstmtsemi : stmt SEMICOLON _
$default reduce using rule 16 (optstmtsemi)
state 77
18) optexprsemi : expr _ SEMICOLON
SEMICOLON shift, and go to state 82
state 78
19) optexprsemi : SEMICOLON _
$default reduce using rule 19 (optexprsemi)
state 79
23) stmtnosemi : FOR LPAREN optstmtsemi optexprsemi _ optstmtparen block
IDENT shift, and go to state 19
LPAREN shift, and go to state 27
RPAREN shift, and go to state 84
EXTERN shift, and go to state 22
NUM shift, and go to state 26
ASTERISK shift, and go to state 29
TILDE shift, and go to state 30
TYPE shift, and go to state 4
postfixexp go to state 20
type go to state 21
expr go to state 23
stmt go to state 83
optstmtparen go to state 85
factor go to state 28
unaryexp go to state 31
castexp go to state 32
addexp go to state 33
cmpexp go to state 34
bitor go to state 35
state 80
33) castexp : LPAREN type RPAREN castexp _
$default reduce using rule 33 (castexp)
state 81
22) stmtnosemi : WHILE LPAREN expr RPAREN block _
$default reduce using rule 22 (stmtnosemi)
state 82
18) optexprsemi : expr SEMICOLON _
$default reduce using rule 18 (optexprsemi)
state 83
20) optstmtparen : stmt _ RPAREN
RPAREN shift, and go to state 86
state 84
21) optstmtparen : RPAREN _
$default reduce using rule 21 (optstmtparen)
state 85
23) stmtnosemi : FOR LPAREN optstmtsemi optexprsemi optstmtparen _ block
LCURL shift, and go to state 13
block go to state 87
state 86
20) optstmtparen : stmt RPAREN _
$default reduce using rule 20 (optstmtparen)
state 87
23) stmtnosemi : FOR LPAREN optstmtsemi optexprsemi optstmtparen block _
$default reduce using rule 23 (stmtnosemi)