manpagez: man pages & more
info bison
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.1 Bison Options

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 ‘=’.

Here is a list of options that can be used with Bison, alphabetized by short option. It is followed by a cross key alphabetized by long option.

Operations modes:

-h
--help

Print a summary of the command-line options to Bison and exit.

-V
--version

Print the version number of Bison and exit.

--print-localedir

Print the name of the directory containing locale-dependent data.

-y
--yacc

Act more like the traditional Yacc command. This can cause different diagnostics to be generated, and may change behavior in other minor ways. Most importantly, imitate Yacc's output file name conventions, so that the parser output file is called ‘y.tab.c’, and the other outputs are called ‘y.output’ and ‘y.tab.h’. Thus, the following shell script can substitute for Yacc, and the Bison distribution contains such a script for compatibility with POSIX:

 
#! /bin/sh
bison -y "$@"

The ‘-y’/‘--yacc’ option is intended for use with traditional Yacc grammars. If your grammar uses a Bison extension like ‘%glr-parser’, Bison might not be Yacc-compatible even if this option is specified.

Tuning the parser:

-S file
--skeleton=file

Specify the skeleton to use. You probably don't need this option unless you are developing Bison.

-t
--debug

In the parser file, define the macro YYDEBUG to 1 if it is not already defined, so that the debugging facilities are compiled. See section Tracing Your Parser.

--locations

Pretend that %locations was specified. See section Bison Declaration Summary.

-p prefix
--name-prefix=prefix

Pretend that %name-prefix="prefix" was specified. See section Bison Declaration Summary.

-l
--no-lines

Don't put any #line preprocessor commands in the parser file. Ordinarily Bison puts them in the parser file so that the C compiler and debuggers will associate errors with your source file, the grammar file. This option causes them to associate errors with the parser file, treating it as an independent source file in its own right.

-n
--no-parser

Pretend that %no-parser was specified. See section Bison Declaration Summary.

-k
--token-table

Pretend that %token-table was specified. See section Bison Declaration Summary.

Adjust the output:

-d
--defines

Pretend that %defines was specified, i.e., write an extra output file containing macro definitions for the token type names defined in the grammar, as well as a few other declarations. See section Bison Declaration Summary.

--defines=defines-file

Same as above, but save in the file defines-file.

-b file-prefix
--file-prefix=prefix

Pretend that %file-prefix was specified, i.e, specify prefix to use for all Bison output file names. See section Bison Declaration Summary.

-r things
--report=things

Write an extra output file containing verbose description of the comma separated list of things among:

state

Description of the grammar, conflicts (resolved and unresolved), and LALR automaton.

look-ahead

Implies state and augments the description of the automaton with each rule's look-ahead set.

itemset

Implies state and augments the description of the automaton with the full set of items for each state, instead of its core only.

-v
--verbose

Pretend that %verbose was specified, i.e, write an extra output file containing verbose descriptions of the grammar and parser. See section Bison Declaration Summary.

-o file
--output=file

Specify the file for the parser file.

The other output files' names are constructed from file as described under the ‘-v’ and ‘-d’ options.

-g

Output a VCG definition of the LALR(1) grammar automaton computed by Bison. If the grammar file is ‘foo.y’, the VCG output file will be ‘foo.vcg’.

--graph=graph-file

The behavior of –graph is the same than ‘-g’. The only difference is that it has an optional argument which is the name of the output graph file.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2025
Individual documents may contain additional copyright information.