Scroll to navigation

BISON(1) User Commands BISON(1)

NAME

bison - GNU Project parser generator (yacc replacement)

SYNOPSIS

bison [OPTION]... FILE

DESCRIPTION

Bison is a parser generator in the style of yacc(1). It should be upwardly compatible with input files designed for yacc.

Input files should follow the yacc convention of ending in .y. Unlike yacc, the generated files do not have fixed names, but instead use the prefix of the input file. Moreover, if you need to put C++ code in the input file, you can end his name by a C++-like extension (.ypp or .y++), then bison will follow your extension to name the output file (.cpp or .c++). For instance, 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.

This description of the options that can be given to bison is adapted from the node Invocation in the bison.texi manual, which should be taken as authoritative.

Bison supports both traditional single-letter options and mnemonic long option names. Long option names are indicated with -- instead of -. Abbreviations for option names are allowed as long as they are unique. When a long option takes an argument, like --file-prefix, connect the option name and the argument with =.

Generate a deterministic LR or generalized LR (GLR) parser employing LALR(1), IELR(1), or canonical LR(1) parser tables.

Mandatory arguments to long options are mandatory for short options too. The same is true for optional arguments.

Operation Modes:

display this help and exit
output version information and exit
output directory containing locale-dependent data and exit
output directory containing skeletons and XSLT and exit
apply fixes to the source grammar file and exit
activate miscellaneous features

FEATURES is a list of comma separated words that can include:

show errors with carets
show machine-readable fixes
do not generate any file
all of the above
disable all of the above

Diagnostics:

report the warnings falling in CATEGORY
whether to colorize the diagnostics
specify the CSS FILE for colorizer diagnostics

Warning categories include:

S/R conflicts (enabled by default)
R/R conflicts (enabled by default)
generate conflict counterexamples
string aliases not attached to a symbol
obsolete constructs
empty rules without %empty
unset or unused midrule values
useless precedence and associativity
incompatibilities with POSIX Yacc
all other warnings (enabled by default)
all the warnings except 'counterexamples', 'dangling-alias' and 'yacc'
turn off warnings in CATEGORY
turn off all the warnings
treat warnings as errors

WHEN can be one of the following:

colorize the output
don't colorize the output
colorize if the output device is a tty

Tuning the Parser:

specify the output programming language
specify the skeleton to use
instrument the parser for tracing same as '-Dparse.trace'
enable location support
similar to '%define NAME VALUE'
override '%define NAME VALUE'
prepend PREFIX to the external symbols deprecated by '-Dapi.prefix={PREFIX}'
don't generate '#line' directives
include a table of token names
emulate POSIX Yacc

Output Files:

also produce a header file
likewise but cannot specify FILE (for POSIX Yacc)
also produce details on the automaton
write report to FILE
same as '--report=state'
specify a PREFIX for output files
leave output to FILE
also output a graph of the automaton
also output an HTML report of the automaton
also output an XML report of the automaton
in output files

THINGS is a list of comma separated words that can include:

describe the states
complete the core item sets with their closure
explicitly associate lookahead tokens to items
describe shift/reduce conflicts solving
generate conflict counterexamples
include all the above information
disable the report

AUTHOR

Written by Robert Corbett and Richard Stallman.

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/>.

Report translation bugs to <https://translationproject.org/team/>.
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.

SEE ALSO

lex(1), flex(1), yacc(1).

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.

October 2021 GNU Bison 3.8.2