1BISON(1)                    General Commands Manual                   BISON(1)
2
3
4

NAME

6       bison - GNU Project parser generator (yacc replacement)
7

SYNOPSIS

9       bison  [  -b  file-prefix  ]  [  --file-prefix=file-prefix  ]  [ -d ] [
10       --defines=defines-file ] [ -g  ]  [  --graph=graph-file  ]  [  -k  ]  [
11       --token-table  ] [ -l ] [ --no-lines ] [ -n ] [ --no-parser ] [ -o out‐
12       file ] [ --output-file=outfile ] [ -p prefix ] [ --name-prefix=prefix ]
13       [  -t  ] [ --debug ] [ -v ] [ --verbose ] [ -V ] [ --version ] [ -y ] [
14       --yacc ] [ -h ] [ --help ] [ --fixed-output-files ] file
15       yacc [ similar options and operands ]
16

DESCRIPTION

18       Bison is a parser generator in the style  of  yacc(1).   It  should  be
19       upwardly compatible with input files designed for yacc.
20
21       Input  files should follow the yacc convention of ending in .y.  Unlike
22       yacc, the generated files do not have fixed names, but instead use  the
23       prefix of the input file.  Moreover, if you need to put C++ code in the
24       input file, you can end his name  by  a  C++-like  extension  (.ypp  or
25       .y++),  then  bison  will follow your extension to name the output file
26       (.cpp or  .c++).   For  instance,  a  grammar  description  file  named
27       parse.yxx   would   produce  the  generated  parser  in  a  file  named
28       parse.tab.cxx,  instead  of  yacc's  y.tab.c  or  old  Bison  version's
29       parse.tab.c.
30
31       This  description  of the options that can be given to bison is adapted
32       from the node Invocation in the bison.texinfo manual, which  should  be
33       taken as authoritative.
34
35       Bison supports both traditional single-letter options and mnemonic long
36       option names.  Long option names are indicated with --  instead  of  -.
37       Abbreviations  for option names are allowed as long as they are unique.
38       When a long option takes an argument, like --file-prefix,  connect  the
39       option name and the argument with =.
40
41   OPTIONS
42       -b file-prefix
43       --file-prefix=file-prefix
44              Specify  a  prefix  to use for all bison output file names.  The
45              names are chosen as if the input file were named file-prefix.c.
46
47       -d
48              Write an extra output file containing macro definitions for  the
49              token  type  names defined in the grammar and the semantic value
50              type YYSTYPE, as well as a few extern variable declarations.
51
52              If the parser output file is named  name.c  then  this  file  is
53              named name.h.
54
55              This  output file is essential if you wish to put the definition
56              of yylex in a separate source file, because yylex  needs  to  be
57              able to refer to token type codes and the variable yylval.
58
59       --defines=defines-file
60              The  behavior of --defines is the same than -d option.  The only
61              difference is that it has an optional argument which is the name
62              of the output filename.
63
64       -g
65              Output  a  VCG  definition of the LALR(1) grammar automaton com‐
66              puted by Bison.  If the grammar file is foo.y , the  VCG  output
67              file will be foo.vcg.
68
69       --graph=graph-file
70              The  behavior  of  --graph is the same than -g option.  The only
71              difference is that it has an optional argument which is the name
72              of the output graph filename.
73
74       -k
75       --token-table
76              This  switch  causes  the name.tab.c output to include a list of
77              token names in order by their token numbers; this is defined  in
78              the  array  yytname.  Also generated are #defines for YYNTOKENS,
79              YYNNTS, YYNRULES, and YYNSTATES.
80
81       -l
82       --no-lines
83              Don't put any #line preprocessor commands in  the  parser  file.
84              Ordinarily bison puts them in the parser file so that the C com‐
85              piler and debuggers will associate errors with your source file,
86              the  grammar  file.  This option causes them to associate errors
87              with the parser file, treating it an independent source file  in
88              its own right.
89
90       -n
91       --no-parser
92              Do  not  generate the parser code into the output; generate only
93              declarations.  The generated name.tab.c file will have only con‐
94              stant  declarations.   In addition, a name.act file is generated
95              containing a switch statement body containing all the translated
96              actions.
97
98       -o outfile
99       --output-file=outfile
100              Specify the name outfile for the parser file.
101
102              The  other  output  files' names are constructed from outfile as
103              described under the -v and -d switches.
104
105       -p prefix
106       --name-prefix=prefix
107              Rename the external symbols used in  the  parser  so  that  they
108              start  with  prefix  instead of yy.  The precise list of symbols
109              renamed is yyparse, yylex, yyerror, yylval, yychar, and yydebug.
110
111              For example, if you use -p c, the names become cparse, clex, and
112              so on.
113
114       -t
115       --debug
116              In  the  parser file, define the macro YYDEBUG to 1 if it is not
117              already defined, so that the debugging facilities are compiled.
118
119       -v
120       --verbose
121              Write an extra output file containing  verbose  descriptions  of
122              the  parser  states and what is done for each type of look-ahead
123              token in that state.
124
125              This file also describes all the conflicts, both those  resolved
126              by operator precedence and the unresolved ones.
127
128              The file's name is made by removing .tab.c or .c from the parser
129              output file name, and adding .output instead.
130
131              Therefore, if the input file is foo.y, then the parser  file  is
132              called foo.tab.c by default.  As a consequence, the verbose out‐
133              put file is called foo.output.
134
135       -V
136       --version
137              Print the version number of bison and exit.
138
139       -h
140       --help Print a summary of the options to bison and exit.
141
142       -y
143       --yacc
144       --fixed-output-files
145              Equivalent to -o y.tab.c;  the  parser  output  file  is  called
146              y.tab.c,  and the other outputs are called y.output and y.tab.h.
147              The purpose of this switch is to imitate yacc's output file name
148              conventions.   Thus,  the  following shell script can substitute
149              for yacc and is often installed as yacc:
150
151              bison -y "$@"
152
153

SEE ALSO

155       yacc(1)
156       The Bison Reference Manual, included as the file bison.texinfo  in  the
157       bison source distribution.
158

DIAGNOSTICS

160       Self explanatory.
161
162
163
164                                     local                            BISON(1)
Impressum