61 |
|
|
62 |
# Check the contents of the report. |
# Check the contents of the report. |
63 |
AT_CHECK([cat input.output], [], |
AT_CHECK([cat input.output], [], |
64 |
[[State 4 contains 1 shift/reduce conflict. |
[[State 5 contains 1 shift/reduce conflict. |
65 |
|
|
66 |
|
|
67 |
Grammar |
Grammar |
68 |
|
|
69 |
Number, Line, Rule |
Number, Line, Rule |
70 |
|
0 4 $axiom -> exp $ |
71 |
1 3 exp -> exp OP exp |
1 3 exp -> exp OP exp |
72 |
2 3 exp -> NUM |
2 3 exp -> NUM |
73 |
|
|
74 |
|
|
75 |
Terminals, with rules where they appear |
Terminals, with rules where they appear |
76 |
|
|
77 |
$ (0) |
$ (0) 0 |
78 |
error (256) |
error (256) |
79 |
NUM (257) 2 |
NUM (257) 2 |
80 |
OP (258) 1 |
OP (258) 1 |
82 |
|
|
83 |
Nonterminals, with rules where they appear |
Nonterminals, with rules where they appear |
84 |
|
|
85 |
exp (5) |
$axiom (5) |
86 |
on left: 1 2, on right: 1 |
on left: 0 |
87 |
|
exp (6) |
88 |
|
on left: 1 2, on right: 0 1 |
89 |
|
|
90 |
|
|
91 |
state 0 |
state 0 |
106 |
|
|
107 |
state 2 |
state 2 |
108 |
|
|
109 |
|
$axiom -> exp . $ (rule 0) |
110 |
exp -> exp . OP exp (rule 1) |
exp -> exp . OP exp (rule 1) |
111 |
|
|
112 |
$ shift, and go to state 5 |
$ shift, and go to state 3 |
113 |
OP shift, and go to state 3 |
OP shift, and go to state 4 |
114 |
|
|
115 |
|
|
116 |
|
|
117 |
state 3 |
state 3 |
118 |
|
|
119 |
exp -> exp OP . exp (rule 1) |
$axiom -> exp $ . (rule 0) |
|
|
|
|
NUM shift, and go to state 1 |
|
|
|
|
|
exp go to state 4 |
|
120 |
|
|
121 |
|
$default accept |
122 |
|
|
123 |
|
|
124 |
state 4 |
state 4 |
125 |
|
|
126 |
exp -> exp . OP exp (rule 1) |
exp -> exp OP . exp (rule 1) |
|
exp -> exp OP exp . (rule 1) |
|
127 |
|
|
128 |
OP shift, and go to state 3 |
NUM shift, and go to state 1 |
129 |
|
|
130 |
OP [reduce using rule 1 (exp)] |
exp go to state 5 |
|
$default reduce using rule 1 (exp) |
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
state 5 |
state 5 |
135 |
|
|
136 |
$ shift, and go to state 6 |
exp -> exp . OP exp (rule 1) |
137 |
|
exp -> exp OP exp . (rule 1) |
138 |
|
|
139 |
|
OP shift, and go to state 4 |
140 |
|
|
141 |
state 6 |
OP [reduce using rule 1 (exp)] |
142 |
|
$default reduce using rule 1 (exp) |
143 |
|
|
|
$default accept |
|
144 |
|
|
145 |
|
|
146 |
]]) |
]]) |
165 |
|
|
166 |
# Check the contents of the report. |
# Check the contents of the report. |
167 |
AT_CHECK([cat input.output], [], |
AT_CHECK([cat input.output], [], |
168 |
[[Conflict in state 4 between rule 1 and token OP resolved as shift. |
[[Conflict in state 5 between rule 2 and token OP resolved as shift. |
169 |
|
|
170 |
|
|
171 |
Grammar |
Grammar |
172 |
|
|
173 |
Number, Line, Rule |
Number, Line, Rule |
174 |
|
0 5 $axiom -> exp $ |
175 |
1 4 exp -> exp OP exp |
1 4 exp -> exp OP exp |
176 |
2 4 exp -> NUM |
2 4 exp -> NUM |
177 |
|
|
178 |
|
|
179 |
Terminals, with rules where they appear |
Terminals, with rules where they appear |
180 |
|
|
181 |
$ (0) |
$ (0) 0 |
182 |
error (256) |
error (256) |
183 |
NUM (257) 2 |
NUM (257) 2 |
184 |
OP (258) 1 |
OP (258) 1 |
186 |
|
|
187 |
Nonterminals, with rules where they appear |
Nonterminals, with rules where they appear |
188 |
|
|
189 |
exp (5) |
$axiom (5) |
190 |
on left: 1 2, on right: 1 |
on left: 0 |
191 |
|
exp (6) |
192 |
|
on left: 1 2, on right: 0 1 |
193 |
|
|
194 |
|
|
195 |
state 0 |
state 0 |
210 |
|
|
211 |
state 2 |
state 2 |
212 |
|
|
213 |
|
$axiom -> exp . $ (rule 0) |
214 |
exp -> exp . OP exp (rule 1) |
exp -> exp . OP exp (rule 1) |
215 |
|
|
216 |
$ shift, and go to state 5 |
$ shift, and go to state 3 |
217 |
OP shift, and go to state 3 |
OP shift, and go to state 4 |
218 |
|
|
219 |
|
|
220 |
|
|
221 |
state 3 |
state 3 |
222 |
|
|
223 |
exp -> exp OP . exp (rule 1) |
$axiom -> exp $ . (rule 0) |
|
|
|
|
NUM shift, and go to state 1 |
|
|
|
|
|
exp go to state 4 |
|
224 |
|
|
225 |
|
$default accept |
226 |
|
|
227 |
|
|
228 |
state 4 |
state 4 |
229 |
|
|
230 |
exp -> exp . OP exp (rule 1) |
exp -> exp OP . exp (rule 1) |
|
exp -> exp OP exp . (rule 1) |
|
231 |
|
|
232 |
OP shift, and go to state 3 |
NUM shift, and go to state 1 |
233 |
|
|
234 |
$default reduce using rule 1 (exp) |
exp go to state 5 |
235 |
|
|
236 |
|
|
237 |
|
|
238 |
state 5 |
state 5 |
239 |
|
|
240 |
$ shift, and go to state 6 |
exp -> exp . OP exp (rule 1) |
241 |
|
exp -> exp OP exp . (rule 1) |
242 |
|
|
243 |
|
OP shift, and go to state 4 |
244 |
|
|
245 |
state 6 |
$default reduce using rule 1 (exp) |
246 |
|
|
|
$default accept |
|
247 |
|
|
248 |
|
|
249 |
]]) |
]]) |
296 |
[[Grammar |
[[Grammar |
297 |
|
|
298 |
Number, Line, Rule |
Number, Line, Rule |
299 |
|
0 28 $axiom -> expr $ |
300 |
1 2 @1 -> /* empty */ |
1 2 @1 -> /* empty */ |
301 |
2 2 expr -> 'a' @1 'b' |
2 2 expr -> 'a' @1 'b' |
302 |
3 15 @2 -> /* empty */ |
3 15 @2 -> /* empty */ |
305 |
|
|
306 |
Terminals, with rules where they appear |
Terminals, with rules where they appear |
307 |
|
|
308 |
$ (0) |
$ (0) 0 |
309 |
'a' (97) 2 |
'a' (97) 2 |
310 |
'b' (98) 2 |
'b' (98) 2 |
311 |
'c' (99) 4 |
'c' (99) 4 |
314 |
|
|
315 |
Nonterminals, with rules where they appear |
Nonterminals, with rules where they appear |
316 |
|
|
317 |
expr (6) |
$axiom (6) |
318 |
on left: 2 4 |
on left: 0 |
319 |
@1 (7) |
expr (7) |
320 |
|
on left: 2 4, on right: 0 |
321 |
|
@1 (8) |
322 |
on left: 1, on right: 2 |
on left: 1, on right: 2 |
323 |
@2 (8) |
@2 (9) |
324 |
on left: 3, on right: 4 |
on left: 3, on right: 4 |
325 |
|
|
326 |
|
|
328 |
|
|
329 |
'a' shift, and go to state 1 |
'a' shift, and go to state 1 |
330 |
|
|
331 |
$default reduce using rule 3 (@2) |
expr go to state 2 |
332 |
|
@2 go to state 3 |
|
expr go to state 6 |
|
|
@2 go to state 2 |
|
333 |
|
|
334 |
|
|
335 |
|
|
339 |
|
|
340 |
$default reduce using rule 1 (@1) |
$default reduce using rule 1 (@1) |
341 |
|
|
342 |
@1 go to state 3 |
@1 go to state 4 |
343 |
|
|
344 |
|
|
345 |
|
|
346 |
state 2 |
state 2 |
347 |
|
|
348 |
expr -> @2 . 'c' (rule 4) |
$axiom -> expr . $ (rule 0) |
349 |
|
|
350 |
'c' shift, and go to state 4 |
$ shift, and go to state 5 |
351 |
|
|
352 |
|
|
353 |
|
|
354 |
state 3 |
state 3 |
355 |
|
|
356 |
expr -> 'a' @1 . 'b' (rule 2) |
expr -> @2 . 'c' (rule 4) |
357 |
|
|
358 |
'b' shift, and go to state 5 |
'c' shift, and go to state 6 |
359 |
|
|
360 |
|
|
361 |
|
|
362 |
state 4 |
state 4 |
363 |
|
|
364 |
expr -> @2 'c' . (rule 4) |
expr -> 'a' @1 . 'b' (rule 2) |
365 |
|
|
366 |
$default reduce using rule 4 (expr) |
'b' shift, and go to state 7 |
367 |
|
|
368 |
|
|
369 |
|
|
370 |
state 5 |
state 5 |
371 |
|
|
372 |
expr -> 'a' @1 'b' . (rule 2) |
$axiom -> expr $ . (rule 0) |
|
|
|
|
$default reduce using rule 2 (expr) |
|
373 |
|
|
374 |
|
$default accept |
375 |
|
|
376 |
|
|
377 |
state 6 |
state 6 |
378 |
|
|
379 |
$ shift, and go to state 7 |
expr -> @2 'c' . (rule 4) |
380 |
|
|
381 |
|
$default reduce using rule 4 (expr) |
382 |
|
|
383 |
|
|
384 |
|
|
385 |
state 7 |
state 7 |
386 |
|
|
387 |
$default accept |
expr -> 'a' @1 'b' . (rule 2) |
388 |
|
|
389 |
|
$default reduce using rule 2 (expr) |
390 |
|
|
391 |
|
|
392 |
|
|
393 |
]]) |
]]) |