/[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.7 by akim, Sun Jun 30 17:32:47 2002 UTC revision 1.8 by akim, Sun Jun 30 17:33:08 2002 UTC
# Line 174  exp (6) Line 174  exp (6)
174    
175  state 0  state 0
176    
177      $axiom  ->  . exp $   (rule 0)      0 $axiom: . exp $
178      exp  ->  . exp OP exp   (rule 1)      1 exp: . exp OP exp
179      exp  ->  . NUM   (rule 2)      2    | . NUM
180    
181      NUM         shift, and go to state 1      NUM         shift, and go to state 1
182    
# Line 186  state 0 Line 186  state 0
186    
187  state 1  state 1
188    
189      exp  ->  NUM .   (rule 2)      2 exp: NUM .
190    
191      $default    reduce using rule 2 (exp)      $default    reduce using rule 2 (exp)
192    
# Line 194  state 1 Line 194  state 1
194    
195  state 2  state 2
196    
197      $axiom  ->  exp . $   (rule 0)      0 $axiom: exp . $
198      exp  ->  exp . OP exp   (rule 1)      1 exp: exp . OP exp
199    
200      $           shift, and go to state 3      $           shift, and go to state 3
201      OP          shift, and go to state 4      OP          shift, and go to state 4
# Line 204  state 2 Line 204  state 2
204    
205  state 3  state 3
206    
207      $axiom  ->  exp $ .   (rule 0)      0 $axiom: exp $ .
208    
209      $default    accept      $default    accept
210    
211    
212  state 4  state 4
213    
214      exp  ->  . exp OP exp   (rule 1)      1 exp: . exp OP exp
215      exp  ->  exp OP . exp   (rule 1)      1    | exp OP . exp
216      exp  ->  . NUM   (rule 2)      2    | . NUM
217    
218      NUM         shift, and go to state 1      NUM         shift, and go to state 1
219    
# Line 223  state 4 Line 223  state 4
223    
224  state 5  state 5
225    
226      exp  ->  exp . OP exp  [$, OP]   (rule 1)      1 exp: exp . OP exp  [$, OP]
227      exp  ->  exp OP exp .  [$, OP]   (rule 1)      1    | exp OP exp .  [$, OP]
228    
229      OP          shift, and go to state 4      OP          shift, and go to state 4
230    
# Line 238  state 5 Line 238  state 5
238  AT_CLEANUP  AT_CLEANUP
239    
240    
 ## ------------------------- ##  
 ## Unresolved SR Conflicts.  ##  
 ## ------------------------- ##  
241    
242  AT_SETUP([Unresolved SR Conflicts])  ## ----------------------- ##
243    ## Resolved SR Conflicts.  ##
244    ## ----------------------- ##
245    
246    AT_SETUP([Resolved SR Conflicts])
247    
248  AT_KEYWORDS([report])  AT_KEYWORDS([report])
249    
250  AT_DATA([input.y],  AT_DATA([input.y],
251  [[%token NUM OP  [[%token NUM OP
252    %left OP
253  %%  %%
254  exp: exp OP exp | NUM;  exp: exp OP exp | NUM;
255  ]])  ]])
256    
257  AT_CHECK([bison input.y -o input.c --report=all], 0, [],  AT_CHECK([bison input.y -o input.c --report=all])
 [input.y contains 1 shift/reduce conflict.  
 ])  
258    
259  # Check the contents of the report.  # Check the contents of the report.
260  AT_CHECK([cat input.output], [],  AT_CHECK([cat input.output], [],
261  [[State 5 contains 1 shift/reduce conflict.  [[Grammar
   
   
 Grammar  
262    
263      0 $axiom: exp $      0 $axiom: exp $
264    
# Line 287  exp (6) Line 284  exp (6)
284    
285  state 0  state 0
286    
287      $axiom  ->  . exp $   (rule 0)      0 $axiom: . exp $
288      exp  ->  . exp OP exp   (rule 1)      1 exp: . exp OP exp
289      exp  ->  . NUM   (rule 2)      2    | . NUM
290    
291      NUM         shift, and go to state 1      NUM         shift, and go to state 1
292    
# Line 299  state 0 Line 296  state 0
296    
297  state 1  state 1
298    
299      exp  ->  NUM .   (rule 2)      2 exp: NUM .
300    
301      $default    reduce using rule 2 (exp)      $default    reduce using rule 2 (exp)
302    
# Line 307  state 1 Line 304  state 1
304    
305  state 2  state 2
306    
307      $axiom  ->  exp . $   (rule 0)      0 $axiom: exp . $
308      exp  ->  exp . OP exp   (rule 1)      1 exp: exp . OP exp
309    
310      $           shift, and go to state 3      $           shift, and go to state 3
311      OP          shift, and go to state 4      OP          shift, and go to state 4
# Line 317  state 2 Line 314  state 2
314    
315  state 3  state 3
316    
317      $axiom  ->  exp $ .   (rule 0)      0 $axiom: exp $ .
318    
319      $default    accept      $default    accept
320    
321    
322  state 4  state 4
323    
324      exp  ->  . exp OP exp   (rule 1)      1 exp: . exp OP exp
325      exp  ->  exp OP . exp   (rule 1)      1    | exp OP . exp
326      exp  ->  . NUM   (rule 2)      2    | . NUM
327    
328      NUM         shift, and go to state 1      NUM         shift, and go to state 1
329    
# Line 336  state 4 Line 333  state 4
333    
334  state 5  state 5
335    
336      exp  ->  exp . OP exp  [$, OP]   (rule 1)      1 exp: exp . OP exp  [$, OP]
337      exp  ->  exp OP exp .  [$, OP]   (rule 1)      1    | exp OP exp .  [$, OP]
338    
     OP          shift, and go to state 4  
339    
     OP          [reduce using rule 1 (exp)]  
340      $default    reduce using rule 1 (exp)      $default    reduce using rule 1 (exp)
341    
342        Conflict between rule 2 and token OP resolved as shift (%left OP).
343    
344    
345  ]])  ]])
# Line 351  state 5 Line 347  state 5
347  AT_CLEANUP  AT_CLEANUP
348    
349    
   
350  ## -------------------------------- ##  ## -------------------------------- ##
351  ## Defaulted Conflicted Reduction.  ##  ## Defaulted Conflicted Reduction.  ##
352  ## -------------------------------- ##  ## -------------------------------- ##
# Line 430  id (7) Line 425  id (7)
425    
426  state 0  state 0
427    
428      $axiom  ->  . exp $   (rule 0)      0 $axiom: . exp $
429      exp  ->  . num   (rule 1)      1 exp: . num
430      exp  ->  . id   (rule 2)      2    | . id
431      num  ->  . '0'   (rule 3)      3 num: . '0'
432      id  ->  . '0'   (rule 4)      4 id: . '0'
433    
434      '0'         shift, and go to state 1      '0'         shift, and go to state 1
435    
# Line 446  state 0 Line 441  state 0
441    
442  state 1  state 1
443    
444      num  ->  '0' .  [$]   (rule 3)      3 num: '0' .  [$]
445      id  ->  '0' .  [$]   (rule 4)      4 id: '0' .  [$]
446    
447      $           reduce using rule 3 (num)      $           reduce using rule 3 (num)
448      $           [reduce using rule 4 (id)]      $           [reduce using rule 4 (id)]
# Line 457  state 1 Line 452  state 1
452    
453  state 2  state 2
454    
455      $axiom  ->  exp . $   (rule 0)      0 $axiom: exp . $
456    
457      $           shift, and go to state 5      $           shift, and go to state 5
458    
# Line 465  state 2 Line 460  state 2
460    
461  state 3  state 3
462    
463      exp  ->  num .   (rule 1)      1 exp: num .
464    
465      $default    reduce using rule 1 (exp)      $default    reduce using rule 1 (exp)
466    
# Line 473  state 3 Line 468  state 3
468    
469  state 4  state 4
470    
471      exp  ->  id .   (rule 2)      2 exp: id .
472    
473      $default    reduce using rule 2 (exp)      $default    reduce using rule 2 (exp)
474    
# Line 481  state 4 Line 476  state 4
476    
477  state 5  state 5
478    
479      $axiom  ->  exp $ .   (rule 0)      0 $axiom: exp $ .
480    
481      $default    accept      $default    accept
482    

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

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