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

Diff of /bison/tests/regression.at

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

revision 1.1.2.9 by akim, Mon Nov 12 09:15:03 2001 UTC revision 1.1.2.10 by akim, Mon Nov 12 09:15:25 2001 UTC
# Line 43  AT_CHECK([bison -v duplicate.y -o duplic Line 43  AT_CHECK([bison -v duplicate.y -o duplic
43  AT_CLEANUP([duplicate.*])  AT_CLEANUP([duplicate.*])
44    
45    
46    ## ----------- ##
47    ## Conflicts.  ##
48    ## ----------- ##
49    
50    AT_SETUP([Conflicts])
51    
52    AT_DATA([input.y],
53    [[%token NUM OP
54    %%
55    exp: exp OP exp | NUM;
56    ]])
57    
58    AT_CHECK([bison input.y -o input.c -v], 0, [],
59    [input.y contains 1 shift/reduce conflict.
60    ])
61    
62    # Check the contents of the report.
63    AT_CHECK([cat input.output], [],
64    [[State 4 contains 1 shift/reduce conflict.
65    
66    Grammar
67    
68    rule 1    exp -> exp OP exp
69    rule 2    exp -> NUM
70    
71    Terminals, with rules where they appear
72    
73    $ (-1)
74    error (256)
75    NUM (257) 2
76    OP (258) 1
77    
78    Nonterminals, with rules where they appear
79    
80    exp (5)
81        on left: 1 2, on right: 1
82    
83    
84    state 0
85    
86        NUM         shift, and go to state 1
87    
88        exp         go to state 2
89    
90    
91    
92    state 1
93    
94        exp  ->  NUM .   (rule 2)
95    
96        $default    reduce using rule 2 (exp)
97    
98    
99    
100    state 2
101    
102        exp  ->  exp . OP exp   (rule 1)
103    
104        $           go to state 5
105        OP          shift, and go to state 3
106    
107    
108    
109    state 3
110    
111        exp  ->  exp OP . exp   (rule 1)
112    
113        NUM         shift, and go to state 1
114    
115        exp         go to state 4
116    
117    
118    
119    state 4
120    
121        exp  ->  exp . OP exp   (rule 1)
122        exp  ->  exp OP exp .   (rule 1)
123    
124        OP          shift, and go to state 3
125    
126    
127    
128    state 5
129    
130        $           go to state 6
131    
132    
133    
134    state 6
135    
136        $default    accept
137    ]])
138    
139    AT_CLEANUP(input.c input.output)
140    
141    
142  ## ---------------------- ##  ## ---------------------- ##
143  ## Mixing %token styles.  ##  ## Mixing %token styles.  ##

Legend:
Removed from v.1.1.2.9  
changed lines
  Added in v.1.1.2.10

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