version 2, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
BISON |
|
|
2 |
!!!BISON |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
FILES |
|
|
7 |
ENVIRONMENT VARIABLES |
|
|
8 |
SEE ALSO |
|
|
9 |
DIAGNOSTICS |
|
|
10 |
---- |
|
|
11 |
!!NAME |
|
|
12 |
|
|
|
13 |
|
|
|
14 |
bison - GNU Project parser generator (yacc replacement) |
|
|
15 |
!!SYNOPSIS |
|
|
16 |
|
|
|
17 |
|
|
|
18 |
__bison__ [[ __-b__ ''file-prefix'' ] [[ |
|
|
19 |
__--file-prefix=__''file-prefix'' ] [[ __-d__ ] [[ |
|
|
20 |
__--defines=__''defines-file'' ] [[ __-g__ ] [[ |
|
|
21 |
__--graph=__''graph-file'' ] [[ __-k__ ] [[ |
|
|
22 |
__--token-table__ ] [[ __-l__ ] [[ __--no-lines__ ] [[ |
|
|
23 |
__-n__ ] [[ __--no-parser__ ] [[ __-o__ |
|
|
24 |
''outfile'' ] [[ __--output-file=__''outfile'' ] [[ |
|
|
25 |
__-p__ ''prefix'' ] [[ |
|
|
26 |
__--name-prefix=__''prefix'' ] [[ __-t__ ] [[ |
|
|
27 |
__--debug__ ] [[ __-v__ ] [[ __--verbose__ ] [[ |
|
|
28 |
__-V__ ] [[ __--version__ ] [[ __-y__ ] [[ |
|
|
29 |
__--yacc__ ] [[ __-h__ ] [[ __--help__ ] [[ |
|
|
30 |
__--fixed-output-files__ ] file |
|
|
31 |
!!DESCRIPTION |
|
|
32 |
|
|
|
33 |
|
|
|
34 |
''Bison'' is a parser generator in the style of |
|
|
35 |
yacc(1). It should be upwardly compatible with input |
|
|
36 |
files designed for ''yacc''. |
|
|
37 |
|
|
|
38 |
|
|
|
39 |
Input files should follow the ''yacc'' convention of |
|
|
40 |
ending in __.y__. Unlike ''yacc'', the generated files |
|
|
41 |
do not have fixed names, but instead use the prefix of the |
|
|
42 |
input file. Moreover, if you need to put ''C++'' code in |
|
|
43 |
the input file, you can end his name by a C++-like extension |
|
|
44 |
(.ypp or .y++), then bison will follow your extension to |
|
|
45 |
name the output file (.cpp or .c++). For instance, a grammar |
|
|
46 |
description file named __parse.yxx__ would produce the |
|
|
47 |
generated parser in a file named __parse.tab.cxx__, |
|
|
48 |
instead of ''yacc'''s __y.tab.c__ or old ''Bison'' |
|
|
49 |
versions __parse.tab.c__. |
|
|
50 |
|
|
|
51 |
|
|
|
52 |
This description of the options that can be given to |
|
|
53 |
''bison'' is adapted from the node __Invocation__ in |
|
|
54 |
the __bison.texinfo__ manual, which should be taken as |
|
|
55 |
authoritative. |
|
|
56 |
|
|
|
57 |
|
|
|
58 |
''Bison'' supports both traditional single-letter options |
|
|
59 |
and mnemonic long option names. Long option names are |
|
|
60 |
indicated with __--__ instead of __-__. Abbreviations |
|
|
61 |
for option names are allowed as long as they are unique. |
|
|
62 |
When a long option takes an argument, like |
|
|
63 |
__--file-prefix__, connect the option name and the |
|
|
64 |
argument with __=__. |
|
|
65 |
|
|
|
66 |
|
|
|
67 |
__OPTIONS__ |
|
|
68 |
|
|
|
69 |
|
|
|
70 |
__-b__ ''file-prefix'' |
|
|
71 |
|
|
|
72 |
|
|
|
73 |
__--file-prefix=__''file-prefix'' |
|
|
74 |
|
|
|
75 |
|
|
|
76 |
Specify a prefix to use for all ''bison'' output file |
|
|
77 |
names. The names are chosen as if the input file were named |
|
|
78 |
''file-prefix''__.c__. |
|
|
79 |
|
|
|
80 |
|
|
|
81 |
__-d__ |
|
|
82 |
|
|
|
83 |
|
|
|
84 |
Write an extra output file containing macro definitions for |
|
|
85 |
the token type names defined in the grammar and the semantic |
|
|
86 |
value type __YYSTYPE__, as well as a few __extern__ |
|
|
87 |
variable declarations. |
|
|
88 |
|
|
|
89 |
|
|
|
90 |
If the parser output file is named ''name''__.c__ then |
|
|
91 |
this file is named ''name''__.h__. |
|
|
92 |
|
|
|
93 |
|
|
|
94 |
This output file is essential if you wish to put the |
|
|
95 |
definition of __yylex__ in a separate source file, |
|
|
96 |
because __yylex__ needs to be able to refer to token type |
|
|
97 |
codes and the variable __yylval__. |
|
|
98 |
|
|
|
99 |
|
|
|
100 |
__--defines=__''defines-file'' |
|
|
101 |
|
|
|
102 |
|
|
|
103 |
The behaviour of __--defines__ is the same than __-d__ |
|
|
104 |
option. The only difference is that it has an optionnal |
|
|
105 |
argument which is the name of the output |
|
|
106 |
filename. |
|
|
107 |
|
|
|
108 |
|
|
|
109 |
__-g__ |
|
|
110 |
|
|
|
111 |
|
2 |
AristotlePagaltzis |
112 |
Output a VCG definition of the !LALR(1) grammar automaton |
1 |
perry |
113 |
computed by Bison. If the grammar file is __foo.y__ , the |
|
|
114 |
VCG output file will be __foo.vcg__. |
|
|
115 |
|
|
|
116 |
|
|
|
117 |
__--graph=__''graph-file'' |
|
|
118 |
|
|
|
119 |
|
|
|
120 |
The behaviour of __--graph__ is the same than __-g__ |
|
|
121 |
option. The only difference is that it has an optionnal |
|
|
122 |
argument which is the name of the output graph |
|
|
123 |
filename. |
|
|
124 |
|
|
|
125 |
|
|
|
126 |
__-k__ |
|
|
127 |
|
|
|
128 |
|
|
|
129 |
__--token-table__ |
|
|
130 |
|
|
|
131 |
|
|
|
132 |
This switch causes the ''name''__.tab.c__ output to |
|
|
133 |
include a list of token names in order by their token |
|
|
134 |
numbers; this is defined in the array ''yytname''. Also |
|
|
135 |
generated are #defines for ''YYNTOKENS'', ''YYNNTS'', |
|
|
136 |
''YYNRULES'', and ''YYNSTATES''. |
|
|
137 |
|
|
|
138 |
|
|
|
139 |
__-l__ |
|
|
140 |
|
|
|
141 |
|
|
|
142 |
__--no-lines__ |
|
|
143 |
|
|
|
144 |
|
|
|
145 |
Don't put any __#line__ preprocessor commands in the |
|
|
146 |
parser file. Ordinarily ''bison'' puts them in the parser |
|
|
147 |
file so that the C compiler and debuggers will associate |
|
|
148 |
errors with your source file, the grammar file. This option |
|
|
149 |
causes them to associate errors with the parser file, |
|
|
150 |
treating it an independent source file in its own |
|
|
151 |
right. |
|
|
152 |
|
|
|
153 |
|
|
|
154 |
__-n__ |
|
|
155 |
|
|
|
156 |
|
|
|
157 |
__--no-parser__ |
|
|
158 |
|
|
|
159 |
|
|
|
160 |
Do not generate the parser code into the output; generate |
|
|
161 |
only declarations. The generated ''name''__.tab.c__ |
|
|
162 |
file will have only constant declarations. In addition, a |
|
|
163 |
''name''__.act__ file is generated containing a switch |
|
|
164 |
statement body containing all the translated |
|
|
165 |
actions. |
|
|
166 |
|
|
|
167 |
|
|
|
168 |
__-o__ ''outfile'' |
|
|
169 |
|
|
|
170 |
|
|
|
171 |
__--output-file=__''outfile'' |
|
|
172 |
|
|
|
173 |
|
|
|
174 |
Specify the name ''outfile'' for the parser |
|
|
175 |
file. |
|
|
176 |
|
|
|
177 |
|
|
|
178 |
The other output files' names are constructed from |
|
|
179 |
''outfile'' as described under the __-v__ and |
|
|
180 |
__-d__ switches. |
|
|
181 |
|
|
|
182 |
|
|
|
183 |
__-p__ ''prefix'' |
|
|
184 |
|
|
|
185 |
|
|
|
186 |
__--name-prefix=__''prefix'' |
|
|
187 |
|
|
|
188 |
|
|
|
189 |
Rename the external symbols used in the parser so that they |
|
|
190 |
start with ''prefix'' instead of __yy__. The precise |
|
|
191 |
list of symbols renamed is __yyparse__, __yylex__, |
|
|
192 |
__yyerror__, __yylval__, __yychar__, and |
|
|
193 |
__yydebug__. |
|
|
194 |
|
|
|
195 |
|
|
|
196 |
For example, if you use __-p c__, the names become |
|
|
197 |
__cparse__, __clex__, and so on. |
|
|
198 |
|
|
|
199 |
|
|
|
200 |
__-t__ |
|
|
201 |
|
|
|
202 |
|
|
|
203 |
__--debug__ |
|
|
204 |
|
|
|
205 |
|
|
|
206 |
In the parser file, define the macro __YYDEBUG__ to 1 if |
|
|
207 |
it is not already defined, so that the debugging facilities |
|
|
208 |
are compiled. |
|
|
209 |
|
|
|
210 |
|
|
|
211 |
__-v__ |
|
|
212 |
|
|
|
213 |
|
|
|
214 |
__--verbose__ |
|
|
215 |
|
|
|
216 |
|
|
|
217 |
Write an extra output file containing verbose descriptions |
|
|
218 |
of the parser states and what is done for each type of |
|
|
219 |
look-ahead token in that state. |
|
|
220 |
|
|
|
221 |
|
|
|
222 |
This file also describes all the conflicts, both those |
|
|
223 |
resolved by operator precedence and the unresolved |
|
|
224 |
ones. |
|
|
225 |
|
|
|
226 |
|
|
|
227 |
The file's name is made by removing __.tab.c__ or |
|
|
228 |
__.c__ from the parser output file name, and adding |
|
|
229 |
__.output__ instead. |
|
|
230 |
|
|
|
231 |
|
|
|
232 |
Therefore, if the input file is __foo.y__, then the |
|
|
233 |
parser file is called __foo.tab.c__ by default. As a |
|
|
234 |
consequence, the verbose output file is called |
|
|
235 |
__foo.output__. |
|
|
236 |
|
|
|
237 |
|
|
|
238 |
__-V__ |
|
|
239 |
|
|
|
240 |
|
|
|
241 |
__--version__ |
|
|
242 |
|
|
|
243 |
|
|
|
244 |
Print the version number of ''bison'' and |
|
|
245 |
exit. |
|
|
246 |
|
|
|
247 |
|
|
|
248 |
__-h__ |
|
|
249 |
|
|
|
250 |
|
|
|
251 |
__--help__ |
|
|
252 |
|
|
|
253 |
|
|
|
254 |
Print a summary of the options to ''bison'' and |
|
|
255 |
exit. |
|
|
256 |
|
|
|
257 |
|
|
|
258 |
__-y__ |
|
|
259 |
|
|
|
260 |
|
|
|
261 |
__--yacc__ |
|
|
262 |
|
|
|
263 |
|
|
|
264 |
__--fixed-output-files__ |
|
|
265 |
|
|
|
266 |
|
|
|
267 |
Equivalent to __-o y.tab.c__; the parser output file is |
|
|
268 |
called __y.tab.c__, and the other outputs are called |
|
|
269 |
__y.output__ and __y.tab.h__. The purpose of this |
|
|
270 |
switch is to imitate ''yacc'''s output file name |
|
|
271 |
conventions. Thus, the following shell script can substitute |
|
|
272 |
for ''yacc'': |
|
|
273 |
|
|
|
274 |
|
|
|
275 |
__bison -y $*__ |
|
|
276 |
!!FILES |
|
|
277 |
|
|
|
278 |
|
|
|
279 |
/usr/local/share/bison/bison.simple simple parser |
|
|
280 |
/usr/local/share/bison/bison.hairy complicated |
|
|
281 |
parser |
|
|
282 |
!!ENVIRONMENT VARIABLES |
|
|
283 |
|
|
|
284 |
|
|
|
285 |
BISON_SIMPLE |
|
|
286 |
|
|
|
287 |
|
|
|
288 |
If this is set, it specifies the location in which the |
|
|
289 |
__bison.simple__ parser can be found. |
|
|
290 |
|
|
|
291 |
|
|
|
292 |
BISON_HAIRY |
|
|
293 |
|
|
|
294 |
|
|
|
295 |
If this is set, it specifies the location in which the |
|
|
296 |
__bison.hairy__ parser can be found. |
|
|
297 |
!!SEE ALSO |
|
|
298 |
|
|
|
299 |
|
|
|
300 |
yacc(1) |
|
|
301 |
The ''Bison Reference Manual'', included as the file |
|
|
302 |
__bison.texinfo__ in the ''bison'' source |
|
|
303 |
distribution. |
|
|
304 |
!!DIAGNOSTICS |
|
|
305 |
|
|
|
306 |
|
|
|
307 |
Self explanatory. |
|
|
308 |
---- |