150 |
|
|
151 |
Grammar |
Grammar |
152 |
|
|
153 |
0 $axiom: exp $ |
0 $accept: exp $end |
154 |
|
|
155 |
1 exp: exp OP exp |
1 exp: exp OP exp |
156 |
2 | NUM |
2 | NUM |
158 |
|
|
159 |
Terminals, with rules where they appear |
Terminals, with rules where they appear |
160 |
|
|
161 |
$ (0) 0 |
$end (0) 0 |
162 |
error (256) |
error (256) |
163 |
NUM (258) 2 |
NUM (258) 2 |
164 |
OP (259) 1 |
OP (259) 1 |
166 |
|
|
167 |
Nonterminals, with rules where they appear |
Nonterminals, with rules where they appear |
168 |
|
|
169 |
$axiom (5) |
$accept (5) |
170 |
on left: 0 |
on left: 0 |
171 |
exp (6) |
exp (6) |
172 |
on left: 1 2, on right: 0 1 |
on left: 1 2, on right: 0 1 |
174 |
|
|
175 |
state 0 |
state 0 |
176 |
|
|
177 |
0 $axiom: . exp $ |
0 $accept: . exp $end |
178 |
1 exp: . exp OP exp |
1 exp: . exp OP exp |
179 |
2 | . NUM |
2 | . NUM |
180 |
|
|
192 |
|
|
193 |
state 2 |
state 2 |
194 |
|
|
195 |
0 $axiom: exp . $ |
0 $accept: exp . $end |
196 |
1 exp: exp . OP exp |
1 exp: exp . OP exp |
197 |
|
|
198 |
$ shift, and go to state 3 |
$end shift, and go to state 3 |
199 |
OP shift, and go to state 4 |
OP shift, and go to state 4 |
200 |
|
|
201 |
|
|
202 |
state 3 |
state 3 |
203 |
|
|
204 |
0 $axiom: exp $ . |
0 $accept: exp $end . |
205 |
|
|
206 |
$default accept |
$default accept |
207 |
|
|
219 |
|
|
220 |
state 5 |
state 5 |
221 |
|
|
222 |
1 exp: exp . OP exp [$, OP] |
1 exp: exp . OP exp [$end, OP] |
223 |
1 | exp OP exp . [$, OP] |
1 | exp OP exp . [$end, OP] |
224 |
|
|
225 |
OP shift, and go to state 4 |
OP shift, and go to state 4 |
226 |
|
|
253 |
AT_CHECK([cat input.output], [], |
AT_CHECK([cat input.output], [], |
254 |
[[Grammar |
[[Grammar |
255 |
|
|
256 |
0 $axiom: exp $ |
0 $accept: exp $end |
257 |
|
|
258 |
1 exp: exp OP exp |
1 exp: exp OP exp |
259 |
2 | NUM |
2 | NUM |
261 |
|
|
262 |
Terminals, with rules where they appear |
Terminals, with rules where they appear |
263 |
|
|
264 |
$ (0) 0 |
$end (0) 0 |
265 |
error (256) |
error (256) |
266 |
NUM (258) 2 |
NUM (258) 2 |
267 |
OP (259) 1 |
OP (259) 1 |
269 |
|
|
270 |
Nonterminals, with rules where they appear |
Nonterminals, with rules where they appear |
271 |
|
|
272 |
$axiom (5) |
$accept (5) |
273 |
on left: 0 |
on left: 0 |
274 |
exp (6) |
exp (6) |
275 |
on left: 1 2, on right: 0 1 |
on left: 1 2, on right: 0 1 |
277 |
|
|
278 |
state 0 |
state 0 |
279 |
|
|
280 |
0 $axiom: . exp $ |
0 $accept: . exp $end |
281 |
1 exp: . exp OP exp |
1 exp: . exp OP exp |
282 |
2 | . NUM |
2 | . NUM |
283 |
|
|
295 |
|
|
296 |
state 2 |
state 2 |
297 |
|
|
298 |
0 $axiom: exp . $ |
0 $accept: exp . $end |
299 |
1 exp: exp . OP exp |
1 exp: exp . OP exp |
300 |
|
|
301 |
$ shift, and go to state 3 |
$end shift, and go to state 3 |
302 |
OP shift, and go to state 4 |
OP shift, and go to state 4 |
303 |
|
|
304 |
|
|
305 |
state 3 |
state 3 |
306 |
|
|
307 |
0 $axiom: exp $ . |
0 $accept: exp $end . |
308 |
|
|
309 |
$default accept |
$default accept |
310 |
|
|
322 |
|
|
323 |
state 5 |
state 5 |
324 |
|
|
325 |
1 exp: exp . OP exp [$, OP] |
1 exp: exp . OP exp [$end, OP] |
326 |
1 | exp OP exp . [$, OP] |
1 | exp OP exp . [$end, OP] |
327 |
|
|
328 |
$default reduce using rule 1 (exp) |
$default reduce using rule 1 (exp) |
329 |
Conflict between rule 1 and token OP resolved as reduce (%left OP). |
Conflict between rule 1 and token OP resolved as reduce (%left OP). |
339 |
# When there are RR conflicts, some rules are disabled. Usually it is |
# When there are RR conflicts, some rules are disabled. Usually it is |
340 |
# simply displayed as: |
# simply displayed as: |
341 |
# |
# |
342 |
# $ reduce using rule 3 (num) |
# $end reduce using rule 3 (num) |
343 |
# $ [reduce using rule 4 (id)] |
# $end [reduce using rule 4 (id)] |
344 |
# |
# |
345 |
# But when `reduce 3' is the default action, we'd produce: |
# But when `reduce 3' is the default action, we'd produce: |
346 |
# |
# |
347 |
# $ [reduce using rule 4 (id)] |
# $end [reduce using rule 4 (id)] |
348 |
# $default reduce using rule 3 (num) |
# $default reduce using rule 3 (num) |
349 |
# |
# |
350 |
# In this precise case (a reduction is masked by the default |
# In this precise case (a reduction is masked by the default |
351 |
# reduction), we make the `reduce 3' explicit: |
# reduction), we make the `reduce 3' explicit: |
352 |
# |
# |
353 |
# $ reduce using rule 3 (num) |
# $end reduce using rule 3 (num) |
354 |
# $ [reduce using rule 4 (id)] |
# $end [reduce using rule 4 (id)] |
355 |
# $default reduce using rule 3 (num) |
# $default reduce using rule 3 (num) |
356 |
# |
# |
357 |
# Maybe that's not the best display, but then, please propose something |
# Maybe that's not the best display, but then, please propose something |
379 |
|
|
380 |
Grammar |
Grammar |
381 |
|
|
382 |
0 $axiom: exp $ |
0 $accept: exp $end |
383 |
|
|
384 |
1 exp: num |
1 exp: num |
385 |
2 | id |
2 | id |
391 |
|
|
392 |
Terminals, with rules where they appear |
Terminals, with rules where they appear |
393 |
|
|
394 |
$ (0) 0 |
$end (0) 0 |
395 |
'0' (48) 3 4 |
'0' (48) 3 4 |
396 |
error (256) |
error (256) |
397 |
|
|
398 |
|
|
399 |
Nonterminals, with rules where they appear |
Nonterminals, with rules where they appear |
400 |
|
|
401 |
$axiom (4) |
$accept (4) |
402 |
on left: 0 |
on left: 0 |
403 |
exp (5) |
exp (5) |
404 |
on left: 1 2, on right: 0 |
on left: 1 2, on right: 0 |
410 |
|
|
411 |
state 0 |
state 0 |
412 |
|
|
413 |
0 $axiom: . exp $ |
0 $accept: . exp $end |
414 |
1 exp: . num |
1 exp: . num |
415 |
2 | . id |
2 | . id |
416 |
3 num: . '0' |
3 num: . '0' |
425 |
|
|
426 |
state 1 |
state 1 |
427 |
|
|
428 |
3 num: '0' . [$] |
3 num: '0' . [$end] |
429 |
4 id: '0' . [$] |
4 id: '0' . [$end] |
430 |
|
|
431 |
$ reduce using rule 3 (num) |
$end reduce using rule 3 (num) |
432 |
$ [reduce using rule 4 (id)] |
$end [reduce using rule 4 (id)] |
433 |
$default reduce using rule 3 (num) |
$default reduce using rule 3 (num) |
434 |
|
|
435 |
|
|
436 |
state 2 |
state 2 |
437 |
|
|
438 |
0 $axiom: exp . $ |
0 $accept: exp . $end |
439 |
|
|
440 |
$ shift, and go to state 5 |
$end shift, and go to state 5 |
441 |
|
|
442 |
|
|
443 |
state 3 |
state 3 |
456 |
|
|
457 |
state 5 |
state 5 |
458 |
|
|
459 |
0 $axiom: exp $ . |
0 $accept: exp $end . |
460 |
|
|
461 |
$default accept |
$default accept |
462 |
]]) |
]]) |