Website Summary Files Commits Branches @commit @diff @stats
path: root / demo / bison / calc / parser.output
blob: 6cc90740fba6683ba543651ca6325b31ba586ed5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
Grammar

    0 $accept: input $end

    1 input: %empty
    2      | expr

    3 expr: NUMBER
    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


State 0

    0 $accept: . input $end

    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 expr: NUMBER .

    $default  reduce using rule 3 (expr)


State 2

    4 expr: '(' . expr ')'

    NUMBER  shift, and go to state 1
    '('     shift, and go to state 2

    expr  go to state 5


State 3

    0 $accept: input . $end

    $end  shift, and go to state 6


State 4

    2 input: expr .
    5 expr: 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

    $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 $accept: input $end .

    $default  accept


State 7

    5 expr: expr PLUS . expr

    NUMBER  shift, and go to state 1
    '('     shift, and go to state 2

    expr  go to state 12


State 8

    6 expr: expr MINUS . expr

    NUMBER  shift, and go to state 1
    '('     shift, and go to state 2

    expr  go to state 13


State 9

    7 expr: expr MULT . expr

    NUMBER  shift, and go to state 1
    '('     shift, and go to state 2

    expr  go to state 14


State 10

    8 expr: 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 expr: expr . PLUS expr
    5     | expr PLUS expr .
    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)


State 13

    5 expr: expr . PLUS expr
    6     | expr . MINUS expr
    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 6 (expr)


State 14

    5 expr: expr . PLUS expr
    6     | expr . MINUS expr
    7     | expr . MULT expr
    7     | expr MULT expr .
    8     | expr . DIV expr

    $default  reduce using rule 7 (expr)


State 15

    5 expr: expr . PLUS expr
    6     | expr . MINUS expr
    7     | expr . MULT expr
    8     | expr . DIV expr
    8     | expr DIV expr .

    $default  reduce using rule 8 (expr)