1BISON(1) User Commands BISON(1)
2
3
4
6 bison - GNU Project parser generator (yacc replacement)
7
9 bison [OPTION]... FILE
10
12 Bison is a parser generator in the style of yacc(1). It should be up‐
13 wardly compatible with input files designed for yacc.
14
15 Input files should follow the yacc convention of ending in .y. Unlike
16 yacc, the generated files do not have fixed names, but instead use the
17 prefix of the input file. Moreover, if you need to put C++ code in the
18 input file, you can end his name by a C++-like extension (.ypp or
19 .y++), then bison will follow your extension to name the output file
20 (.cpp or .c++). For instance, a grammar description file named
21 parse.yxx would produce the generated parser in a file named
22 parse.tab.cxx, instead of yacc's y.tab.c or old Bison version's
23 parse.tab.c.
24
25 This description of the options that can be given to bison is adapted
26 from the node Invocation in the bison.texi manual, which should be
27 taken as authoritative.
28
29 Bison supports both traditional single-letter options and mnemonic long
30 option names. Long option names are indicated with -- instead of -.
31 Abbreviations for option names are allowed as long as they are unique.
32 When a long option takes an argument, like --file-prefix, connect the
33 option name and the argument with =.
34
35 Generate a deterministic LR or generalized LR (GLR) parser employing
36 LALR(1), IELR(1), or canonical LR(1) parser tables.
37
38 Mandatory arguments to long options are mandatory for short options
39 too. The same is true for optional arguments.
40
41 Operation Modes:
42 -h, --help
43 display this help and exit
44
45 -V, --version
46 output version information and exit
47
48 --print-localedir
49 output directory containing locale-dependent data and exit
50
51 --print-datadir
52 output directory containing skeletons and XSLT and exit
53
54 -u, --update
55 apply fixes to the source grammar file and exit
56
57 -f, --feature[=FEATURES]
58 activate miscellaneous features
59
60 FEATURES is a list of comma separated words that can include:
61 caret, diagnostics-show-caret
62 show errors with carets
63
64 fixit, diagnostics-parseable-fixits
65 show machine-readable fixes
66
67 syntax-only
68 do not generate any file
69
70 all all of the above
71
72 none disable all of the above
73
74 Diagnostics:
75 -W, --warnings[=CATEGORY]
76 report the warnings falling in CATEGORY
77
78 --color[=WHEN]
79 whether to colorize the diagnostics
80
81 --style=FILE
82 specify the CSS FILE for colorizer diagnostics
83
84 Warning categories include:
85 conflicts-sr
86 S/R conflicts (enabled by default)
87
88 conflicts-rr
89 R/R conflicts (enabled by default)
90
91 counterexamples, cex
92 generate conflict counterexamples
93
94 dangling-alias
95 string aliases not attached to a symbol
96
97 deprecated
98 obsolete constructs
99
100 empty-rule
101 empty rules without %empty
102
103 midrule-values
104 unset or unused midrule values
105
106 precedence
107 useless precedence and associativity
108
109 yacc incompatibilities with POSIX Yacc
110
111 other all other warnings (enabled by default)
112
113 all all the warnings except 'counterexamples', 'dangling-alias' and
114 'yacc'
115
116 no-CATEGORY
117 turn off warnings in CATEGORY
118
119 none turn off all the warnings
120
121 error[=CATEGORY]
122 treat warnings as errors
123
124 WHEN can be one of the following:
125 always, yes
126 colorize the output
127
128 never, no
129 don't colorize the output
130
131 auto, tty
132 colorize if the output device is a tty
133
134 Tuning the Parser:
135 -L, --language=LANGUAGE
136 specify the output programming language
137
138 -S, --skeleton=FILE
139 specify the skeleton to use
140
141 -t, --debug
142 instrument the parser for tracing same as '-Dparse.trace'
143
144 --locations
145 enable location support
146
147 -D, --define=NAME[=VALUE]
148 similar to '%define NAME VALUE'
149
150 -F, --force-define=NAME[=VALUE]
151 override '%define NAME VALUE'
152
153 -p, --name-prefix=PREFIX
154 prepend PREFIX to the external symbols deprecated by '-Dapi.pre‐
155 fix={PREFIX}'
156
157 -l, --no-lines
158 don't generate '#line' directives
159
160 -k, --token-table
161 include a table of token names
162
163 -y, --yacc
164 emulate POSIX Yacc
165
166 Output Files:
167 -H, --header=[FILE]
168 also produce a header file
169
170 -d likewise but cannot specify FILE (for POSIX Yacc)
171
172 -r, --report=THINGS
173 also produce details on the automaton
174
175 --report-file=FILE
176 write report to FILE
177
178 -v, --verbose
179 same as '--report=state'
180
181 -b, --file-prefix=PREFIX
182 specify a PREFIX for output files
183
184 -o, --output=FILE
185 leave output to FILE
186
187 -g, --graph[=FILE]
188 also output a graph of the automaton
189
190 --html[=FILE]
191 also output an HTML report of the automaton
192
193 -x, --xml[=FILE]
194 also output an XML report of the automaton
195
196 -M, --file-prefix-map=OLD=NEW replace prefix OLD with NEW when writing
197 file paths
198 in output files
199
200 THINGS is a list of comma separated words that can include:
201 states describe the states
202
203 itemsets
204 complete the core item sets with their closure
205
206 lookaheads
207 explicitly associate lookahead tokens to items
208
209 solved describe shift/reduce conflicts solving
210
211 counterexamples, cex
212 generate conflict counterexamples
213
214 all include all the above information
215
216 none disable the report
217
219 Written by Robert Corbett and Richard Stallman.
220
222 Report bugs to <bug-bison@gnu.org>.
223 GNU Bison home page: <https://www.gnu.org/software/bison/>.
224 General help using GNU software: <https://www.gnu.org/gethelp/>.
225 For complete documentation, run: info bison.
226
228 Copyright © 2021 Free Software Foundation, Inc.
229 This is free software; see the source for copying conditions. There is
230 NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
231 PURPOSE.
232
234 lex(1), flex(1), yacc(1).
235
236 The full documentation for bison is maintained as a Texinfo manual. If
237 the info and bison programs are properly installed at your site, the
238 command
239
240 info bison
241
242 should give you access to the complete manual.
243
244
245
246GNU Bison 3.8.2 September 2021 BISON(1)