BISON(1)
๐ NAME ๐
bison โ the GNU Project parser generator, aka the yacc replacement that ate and left no crumbs ๐
โจ SYNOPSIS โจ
bison [OPTION]... FILE
๐ฆ DESCRIPTION ๐ฆ
Okay so bestie, bison is a parser generator in the style of yacc(1). It's designed to be upwardly compatible with input files made for yacc, so if you're migrating, you're fine, you're safe, you're thriving. ๐
Your input files should follow the yacc convention of ending in .y. But here's the glow-up: unlike yacc, the generated files don't have fixed names โ they use the prefix of the input file instead. And if you need to put C++ code in the input file, you can end his name with a C++-like extension (.ypp or .y++), and then bison will follow your extension to name the output file (.cpp or .c++). For example, a grammar description file named parse.yxx would produce the generated parser in a file named parse.tab.cxx, instead of yacc's y.tab.c or old Bison version's parse.tab.c. Iconic behavior honestly. ๐
This description of the options you can give to bison is adapted from the node Invocation in the bison.texi manual, and that manual should be taken as authoritative. No cap. ๐
Bison supports both the traditional single-letter options and the mnemonic long option names. Long option names are indicated with -- instead of -. Abbreviations for option names are allowed as long as they're unique. When a long option takes an argument, like --file-prefix, you connect the option name and the argument with =. Simple as. ๐
It generates a deterministic LR or generalized LR (GLR) parser employing LALR(1), IELR(1), or canonical LR(1) parser tables. Chef's kiss. ๐
Mandatory arguments to long options are mandatory for short options too. The same is true for optional arguments. Periodt.
๐ ๏ธ Operation Modes ๐ ๏ธ
-h,--helpโ display this help and exit (the classic "help meee" button ๐)-V,--versionโ output version information and exit--print-localedirโ output the directory containing locale-dependent data and exit--print-datadirโ output the directory containing skeletons and XSLT and exit-u,--updateโ apply fixes to the source grammar file and exit โจ-f,--feature[=FEATURES]โ activate miscellaneous features
๐ธ FEATURES ๐ธ
FEATURES is a list of comma separated words that can include:
caret,diagnostics-show-caretโ show errors with caretsfixit,diagnostics-parseable-fixitsโ show machine-readable fixessyntax-onlyโ do not generate any fileallโ all of the abovenoneโ disable all of the above
๐ฉบ Diagnostics ๐ฉบ
-W,--warnings[=CATEGORY]โ report the warnings falling in CATEGORY--color[=WHEN]โ whether to colorize the diagnostics--style=FILEโ specify the CSS FILE for colorizer diagnostics
๐ Warning categories include: ๐
conflicts-srโ S/R conflicts (enabled by default)conflicts-rrโ R/R conflicts (enabled by default)counterexamples,cexโ generate conflict counterexamplesdangling-aliasโ string aliases not attached to a symboldeprecatedโ obsolete constructsempty-ruleโ empty rules without%emptymidrule-valuesโ unset or unused midrule valuesprecedenceโ useless precedence and associativityyaccโ incompatibilities with POSIX Yaccotherโ all other warnings (enabled by default)allโ all the warnings except'counterexamples','dangling-alias'and'yacc'no-CATEGORYโ turn off warnings in CATEGORYnoneโ turn off all the warningserror[=CATEGORY]โ treat warnings as errors ๐ค
๐จ WHEN can be one of the following: ๐จ
always,yesโ colorize the outputnever,noโ don't colorize the outputauto,ttyโ colorize if the output device is a tty
๐ Tuning the Parser ๐
-L,--language=LANGUAGEโ specify the output programming language-S,--skeleton=FILEโ specify the skeleton to use-t,--debugโ instrument the parser for tracing, same as'-Dparse.trace'--locationsโ enable location support ๐-D,--define=NAME[=VALUE]โ similar to'%define NAME VALUE'-F,--force-define=NAME[=VALUE]โ override'%define NAME VALUE'-p,--name-prefix=PREFIXโ prepend PREFIX to the external symbols, deprecated by'-Dapi.prefix={PREFIX}'-l,--no-linesโ don't generate'#line'directives-k,--token-tableโ include a table of token names-y,--yaccโ emulate POSIX Yacc
๐ Output Files ๐
-H,--header=[FILE]โ also produce a header file-dโ likewise but cannot specify FILE (for POSIX Yacc)-r,--report=THINGSโ also produce details on the automaton--report-file=FILEโ write report to FILE-v,--verboseโ same as'--report=state'-b,--file-prefix=PREFIXโ specify a PREFIX for output files-o,--output=FILEโ leave output to FILE-g,--graph[=FILE]โ also output a graph of the automaton--html[=FILE]โ also output an HTML report of the automaton-x,--xml[=FILE]โ also output an XML report of the automaton-M,--file-prefix-map=OLD=NEWโ replace prefix OLD with NEW when writing file paths in output files
๐ง THINGS ๐ง
THINGS is a list of comma separated words that can include:
statesโ describe the statesitemsetsโ complete the core item sets with their closurelookaheadsโ explicitly associate lookahead tokens to itemssolvedโ describe shift/reduce conflicts solvingcounterexamples,cexโ generate conflict counterexamplesallโ include all the above informationnoneโ disable the report
๐ซถ AUTHOR ๐ซถ
Written by Robert Corbett and Richard Stallman. Legends, honestly. ๐
๐ REPORTING BUGS ๐
Report bugs to <bug-bison@gnu.org>.
GNU Bison home page: <https://www.gnu.org/software/bison/>.
General help using GNU software: <https://www.gnu.org/gethelp/>.
For complete documentation, run: info bison.
โ๏ธ COPYRIGHT โ๏ธ
Copyright ยฉ 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. (Yes bestie, that's the legal way of saying "no promises, good luck" ๐ญ)
๐ SEE ALSO ๐
The full documentation for bison is maintained as a Texinfo manual. If the info and bison programs are properly installed at your site, the command
info bison
should give you access to the complete manual.
And that's the whole vibe check, bestie โ this was GNU Bison 3.8.2, from September 2021. Go generate some parsers, you absolute icon. Slay. ๐ โจ
๐ฆ where this page comes from
- alpine 3.22: bison-doc 3.8.2-r2 ยท GPL-3.0-or-later
- alpine 3.23: bison-doc 3.8.2-r2 ยท GPL-3.0-or-later
- alpine 3.24: bison-doc 3.8.2-r3 ยท GPL-3.0-or-later
- arch rolling: bison 3.8.2-8 ยท GPL-3.0-or-later
- centos-stream 10: bison 3.8.2-9.el10 ยท GPL-3.0-or-later AND GPL-3.0-or-later WITH Autoconf-exception-generic-3.0 AND GPL-3.0-or-later WITH Bison-exception-2.2 AND GPL-2.0-or-later AND GPL-2.0-or-later WITH Autoconf-exception-generic AND LGPL-3.0-or-later AND LGPL-2.1-or-later AND LGPL-2.0-or-later AND FSFULLR AND GFDL-1.3-or-later AND X11
- fedora 43: bison 3.8.2-11.fc43 ยท GPL-3.0-or-later AND GPL-3.0-or-later WITH Autoconf-exception-generic-3.0 AND GPL-3.0-or-later WITH Bison-exception-2.2 AND GPL-2.0-or-later AND GPL-2.0-or-later WITH Autoconf-exception-generic AND LGPL-3.0-or-later AND LGPL-2.1-or-later AND LGPL-2.0-or-later AND FSFULLR AND GFDL-1.3-or-later AND X11
- fedora 44: bison 3.8.2-15.fc44 ยท GPL-3.0-or-later AND GPL-3.0-or-later WITH Autoconf-exception-generic-3.0 AND GPL-3.0-or-later WITH Bison-exception-2.2 AND GPL-2.0-or-later AND GPL-2.0-or-later WITH Autoconf-exception-generic AND LGPL-3.0-or-later AND LGPL-2.1-or-later AND LGPL-2.0-or-later AND FSFULLR AND GFDL-1.3-or-later AND X11
- nixos 26.05: bison 3.8.2
- nixpkgs unstable: bison 3.8.2
- opensuse-leap 16.0: bison 3.8.2-160000.2.2 ยท GPL-3.0-or-later
- opensuse-leap 16.0: bison 3.8.2-160000.2.2 ยท GPL-3.0-or-later
- opensuse-leap 16.0: bison 3.8.2-160000.2.2 ยท GPL-3.0-or-later
- opensuse-leap 16.0: bison 3.8.2-160000.2.2 ยท GPL-3.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms