The usual way to invoke Bison is as follows:
$ bison file
Here file is the grammar file name, which usually ends in ‘.y’. The parser implementation file’s name is made by replacing the ‘.y’ with ‘.tab.c’ and removing any leading directory. Thus, the ‘bison foo.y’ file name yields foo.tab.c, and the ‘bison hack/foo.y’ file name yields foo.tab.c. It’s also possible, in case you are writing C++ code instead of C in your grammar file, to name it foo.ypp or foo.y++. Then, the output files will take an extension like the given one as input (respectively foo.tab.cpp and foo.tab.c++). This feature takes effect with all options that manipulate file names like -o or -d.
$ bison -d file.yxx
will produce file.tab.cxx and file.tab.hxx, and
$ bison -d -o output.c++ file.y
will produce output.c++ and output.h++.
For compatibility with POSIX, the standard Bison distribution also contains
a shell script called
yacc that invokes Bison with the -y
The exit status of
when there were no errors. Warnings, which are diagnostics about dubious constructs, do not change the exit status, unless they are turned into errors (see -Werror).
when there were errors. No file was generated (except the reports generated by --verbose, etc.). In particular, the output files that possibly existed were not changed.
bison does not meet the version requirements of the grammar
file. See section Require a Version of Bison. No file was generated or changed.
|• Bison Options||All the options described in detail, in alphabetical order by short options.|
|• Option Cross Key||Alphabetical list of long options.|
|• Yacc Library||Yacc-compatible |