/[bison]/bison/tests/conflicts.at
ViewVC logotype

Diff of /bison/tests/conflicts.at

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by akim, Thu Jul 25 21:21:02 2002 UTC revision 1.13 by akim, Mon Jul 29 17:30:33 2002 UTC
# Line 150  AT_CHECK([cat input.output], [], Line 150  AT_CHECK([cat input.output], [],
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
# Line 158  Grammar Line 158  Grammar
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
# Line 166  OP (259) 1 Line 166  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
# Line 174  exp (6) Line 174  exp (6)
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    
# Line 192  state 1 Line 192  state 1
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    
# Line 219  state 4 Line 219  state 4
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    
# Line 253  AT_CHECK([bison input.y -o input.c --rep Line 253  AT_CHECK([bison input.y -o input.c --rep
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
# Line 261  AT_CHECK([cat input.output], [], Line 261  AT_CHECK([cat input.output], [],
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
# Line 269  OP (259) 1 Line 269  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
# Line 277  exp (6) Line 277  exp (6)
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    
# Line 295  state 1 Line 295  state 1
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    
# Line 322  state 4 Line 322  state 4
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).
# Line 339  AT_CLEANUP Line 339  AT_CLEANUP
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
# Line 379  AT_CHECK([cat input.output], [], Line 379  AT_CHECK([cat input.output], [],
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
# Line 391  Grammar Line 391  Grammar
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
# Line 410  id (7) Line 410  id (7)
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'
# Line 425  state 0 Line 425  state 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
# Line 456  state 4 Line 456  state 4
456    
457  state 5  state 5
458    
459      0 $axiom: exp $ .      0 $accept: exp $end .
460    
461      $default    accept      $default    accept
462  ]])  ]])

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26