X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/a641b0dac18e4b29020b5373ea90384a50465953..c373bf8bb8da68ed12b1e73aaa2d777f6c701e46:/doc/bison.1 diff --git a/doc/bison.1 b/doc/bison.1 index ec8d979a..62c1721e 100644 --- a/doc/bison.1 +++ b/doc/bison.1 @@ -10,7 +10,15 @@ bison \- GNU Project parser generator (yacc replacement) ] [ .B \-d ] [ -.B \-\-defines +.BI \-\-defines= defines-file +] [ +.B \-g +] [ +.BI \-\-graph= graph-file +] [ +.B \-k +] [ +.B \-\-token-table ] [ .B \-l ] [ @@ -47,6 +55,11 @@ bison \- GNU Project parser generator (yacc replacement) .B \-\-fixed-output-files ] file +.br +.B yacc +[ +.I "similar options and operands" +] .SH DESCRIPTION .I Bison is a parser generator in the style of @@ -63,13 +76,22 @@ Unlike .IR yacc , the generated files do not have fixed names, but instead use the prefix of the input file. +Moreover, if you need to put +.I 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 -.B parse.y +.B parse.yxx would produce the generated parser in a file named -.BR parse.tab.c , +.BR parse.tab.cxx , instead of .IR yacc 's -.BR y.tab.c . +.B y.tab.c +or old +.I Bison +version's +.BR parse.tab.c . .PP This description of the options that can be given to .I bison @@ -101,13 +123,11 @@ Specify a prefix to use for all .I bison output file names. The names are chosen as if the input file were named -\fIfile-prefix\fB.c\fR. +\fIfile-prefix\fP\fB.c\fP. .TP .B \-d .br .ns -.TP -.B \-\-defines Write an extra output file containing macro definitions for the token type names defined in the grammar and the semantic value type .BR YYSTYPE , @@ -116,10 +136,10 @@ as well as a few variable declarations. .sp If the parser output file is named -\fIname\fB.c\fR +.IB name .c then this file is named -\fIname\fB.h\fR. +\fIname\fP\fB.h\fP. .sp This output file is essential if you wish to put the definition of .B yylex @@ -128,6 +148,50 @@ in a separate source file, because needs to be able to refer to token type codes and the variable .BR yylval . .TP +.BI \-\-defines= defines-file +The behavior of +.B \-\-defines +is the same than +.B \-d +option. +The only difference is that it has an optional argument which is +the name of the output filename. +.TP +.BI \-g +.br +.ns +Output a graph of the grammar automaton computed by +Bison. If the grammar file is +.BR foo.y +, the output file will be +.BR foo.dot . +.TP +.BI \-\-graph= graph-file +The behavior of +.BI \-\-graph +is the same than +.BI \-g +option. The only difference is that it has an optional argument which +is the name of the output graph filename. +.TP +.B \-k +.br +.ns +.TP +.B \-\-token-table +This switch causes the +.IB name .tab.c +output to include a list of +token names in order by their token numbers; this is defined in the array +.IR yytname . +Also generated +are #defines for +.IR YYNTOKENS , +.IR YYNNTS , +.IR YYNRULES , +and +.IR YYNSTATES . +.TP .B \-l .br .ns @@ -174,7 +238,7 @@ The precise list of symbols renamed is .BR yylex , .BR yyerror , .BR yylval , -.BR yychar , +.BR yychar , and .BR yydebug . .sp @@ -190,9 +254,9 @@ and so on. .ns .TP .B \-\-debug -Output a definition of the macro -.B YYDEBUG -into the parser file, +In the parser file, define the macro +.B YYDEBUG +to 1 if it is not already defined, so that the debugging facilities are compiled. .TP .B \-v @@ -201,7 +265,7 @@ so that the debugging facilities are compiled. .TP .B \-\-verbose Write an extra output file containing verbose descriptions of the -parser states and what is done for each type of look-ahead token in +parser states and what is done for each type of lookahead token in that state. .sp This file also describes all the conflicts, both those resolved by @@ -235,6 +299,7 @@ and exit. .B \-h .br .ns +.TP .B \-\-help Print a summary of the options to .I bison @@ -261,22 +326,16 @@ The purpose of this switch is to imitate .IR yacc 's output file name conventions. Thus, the following shell script can substitute for +.I yacc +and is often installed as .IR yacc : .sp .RS .ft B -bison \-y $* +bison \-y "$@" .ft R .sp .RE -.PP -The long-named options can be introduced with `+' as well as `\-\-', -for compatibility with previous releases. Eventually support for `+' -will be removed, because it is incompatible with the POSIX.2 standard. -.SH FILES -/usr/local/lib/bison.simple simple parser -.br -/usr/local/lib/bison.hairy complicated parser .SH SEE ALSO .IR yacc (1) .br @@ -289,4 +348,9 @@ in the source distribution. .SH DIAGNOSTICS Self explanatory. - +.SH COPYRIGHT +Copyright \(co 2006 Free Software Foundation, Inc. +.br +This is free software. You may redistribute copies of it under the terms of +the GNU General Public License . +There is NO WARRANTY, to the extent permitted by law.