X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/704a47c475e0c9abc2ba8624de6b3e360abd1ad1..cd6a695eb90ec4b9597c0aa843aa54558df43e0c:/doc/bison.texinfo diff --git a/doc/bison.texinfo b/doc/bison.texinfo index ff86f539..7c0b3454 100644 --- a/doc/bison.texinfo +++ b/doc/bison.texinfo @@ -707,8 +707,7 @@ In some cases the Bison parser file includes system headers, and in those cases your code should respect the identifiers reserved by those headers. On some non-@sc{gnu} hosts, @code{}, @code{}, and @code{} are included as needed to -declare memory allocators and related types. In the same situation, -C++ parsers may include @code{} and @code{} instead. +declare memory allocators and related types. Other system headers may be included if you define @code{YYDEBUG} to a nonzero value (@pxref{Debugging, ,Debugging Your Parser}). @@ -3163,7 +3162,7 @@ may override this restriction with the @code{%start} declaration as follows: @subsection A Pure (Reentrant) Parser @cindex reentrant parser @cindex pure parser -@findex %pure_parser +@findex %pure-parser A @dfn{reentrant} program is one which does not alter in the course of execution; in other words, it consists entirely of @dfn{pure} (read-only) @@ -3179,11 +3178,11 @@ statically allocated variables for communication with @code{yylex}, including @code{yylval} and @code{yylloc}.) Alternatively, you can generate a pure, reentrant parser. The Bison -declaration @code{%pure_parser} says that you want the parser to be +declaration @code{%pure-parser} says that you want the parser to be reentrant. It looks like this: @example -%pure_parser +%pure-parser @end example The result is that the communication variables @code{yylval} and @@ -3270,12 +3269,12 @@ be able to refer to token type codes and the variable Specify a prefix to use for all Bison output file names. The names are chosen as if the input file were named @file{@var{prefix}.y}. -@c @item %header_extension +@c @item %header-extension @c Specify the extension of the parser header file generated when @c @code{%define} or @samp{-d} are used. @c @c For example, a grammar file named @file{foo.ypp} and containing a -@c @code{%header_extension .hh} directive will produce a header file +@c @code{%header-extension .hh} directive will produce a header file @c named @file{foo.tab.hh} @item %locations @@ -3289,10 +3288,10 @@ accurate parse error messages. Rename the external symbols used in the parser so that they start with @var{prefix} instead of @samp{yy}. The precise list of symbols renamed is @code{yyparse}, @code{yylex}, @code{yyerror}, @code{yynerrs}, -@code{yylval}, @code{yychar} and @code{yydebug}. For example, if you -use @samp{%name-prefix="c_"}, the names become @code{c_parse}, -@code{c_lex}, and so on. @xref{Multiple Parsers, ,Multiple Parsers in -the Same Program}. +@code{yylval}, @code{yychar}, @code{yydebug}, and possible +@code{yylloc}. For example, if you use @samp{%name-prefix="c_"}, the +names become @code{c_parse}, @code{c_lex}, and so on. @xref{Multiple +Parsers, ,Multiple Parsers in the Same Program}. @item %no-parser Do not include any C code in the parser file; generate tables only. The @@ -3318,14 +3317,14 @@ Specify the @var{filename} for the parser file. Request a pure (reentrant) parser program (@pxref{Pure Decl, ,A Pure (Reentrant) Parser}). -@c @item %source_extension +@c @item %source-extension @c Specify the extension of the parser output file. @c @c For example, a grammar file named @file{foo.yy} and containing a -@c @code{%source_extension .cpp} directive will produce a parser file +@c @code{%source-extension .cpp} directive will produce a parser file @c named @file{foo.tab.cpp} -@item %token_table +@item %token-table Generate an array of token names in the parser file. The name of the array is @code{yytname}; @code{yytname[@var{i}]} is the name of the token whose internal Bison token code number is @var{i}. The first three @@ -3343,7 +3342,7 @@ consists of three characters @samp{*"*}, its string in @code{yytname} contains @samp{"*"*"}. (In C, that would be written as @code{"\"*\"*\""}). -When you specify @code{%token_table}, Bison also generates macro +When you specify @code{%token-table}, Bison also generates macro definitions for macros @code{YYNTOKENS}, @code{YYNNTS}, and @code{YYNRULES}, and @code{YYNSTATES}: @@ -3374,7 +3373,6 @@ called @file{foo.tab.c} by default. As a consequence, the verbose output file is called @file{foo.output}.@refill @item %yacc -@itemx %fixed-output-files Pretend the option @option{--yacc} was given, i.e., imitate Yacc, including its naming conventions. @xref{Bison Options}, for more. @end table @@ -3565,7 +3563,7 @@ for (i = 0; i < YYNTOKENS; i++) @end smallexample The @code{yytname} table is generated only if you use the -@code{%token_table} declaration. @xref{Decl Summary}. +@code{%token-table} declaration. @xref{Decl Summary}. @end itemize @node Token Values @@ -3639,7 +3637,7 @@ The data type of @code{yylloc} has the name @code{YYLTYPE}. @node Pure Calling @subsection Calling Conventions for Pure Parsers -When you use the Bison declaration @code{%pure_parser} to request a +When you use the Bison declaration @code{%pure-parser} to request a pure, reentrant parser, the global communication variables @code{yylval} and @code{yylloc} cannot be used. (@xref{Pure Decl, ,A Pure (Reentrant) Parser}.) In such parsers the two global variables are replaced by @@ -3739,7 +3737,7 @@ arguments in total, depending on whether an argument of type the proper object type, or you can declare it as @code{void *} and access the contents as shown above. -You can use @samp{%pure_parser} to request a reentrant parser without +You can use @samp{%pure-parser} to request a reentrant parser without also using @code{YYPARSE_PARAM}. Then you should call @code{yyparse} with no arguments, as usual. @@ -4951,13 +4949,11 @@ Summary}). We suggest that you always define @code{YYDEBUG} so that debugging is always possible. The trace facility outputs messages with macro calls of the form -@code{YYFPRINTF (YYSTDERR, @var{format}, @var{args})} where +@code{YYFPRINTF (stderr, @var{format}, @var{args})} where @var{format} and @var{args} are the usual @code{printf} format and arguments. If you define @code{YYDEBUG} to a nonzero value but do not define @code{YYFPRINTF}, @code{} is automatically included -and the macros are defined to @code{fprintf} and @code{stderr}. In -the same situation, C++ parsers include @code{} instead, and -use @code{std::fprintf} and @code{std::stderr}. +and @code{YYPRINTF} is defined to @code{fprintf}. Once you have compiled the program with trace facilities, the way to request a trace is to store a nonzero value in the variable @code{yydebug}. @@ -5096,7 +5092,6 @@ Print the version number of Bison and exit. @need 1750 @item -y @itemx --yacc -@itemx --fixed-output-files Equivalent to @samp{-o y.tab.c}; the parser output file is called @file{y.tab.c}, and the other outputs are called @file{y.output} and @file{y.tab.h}. The purpose of this option is to imitate Yacc's output @@ -5209,7 +5204,7 @@ would like to direct Bison to use a different copy, setting the environment variable @code{BISON_SIMPLE} to the path of the file will cause Bison to use that copy instead. -When the @samp{%semantic_parser} declaration is used, Bison copies from +When the @samp{%semantic-parser} declaration is used, Bison copies from a file called @file{bison.hairy} instead. The location of this file can also be specified or overridden in a similar fashion, with the @code{BISON_HAIRY} environment variable. @@ -5229,7 +5224,6 @@ the corresponding short option. \line{ --debug \leaderfill -t} \line{ --defines \leaderfill -d} \line{ --file-prefix \leaderfill -b} -\line{ --fixed-output-files \leaderfill -y} \line{ --graph \leaderfill -g} \line{ --help \leaderfill -h} \line{ --name-prefix \leaderfill -p} @@ -5248,7 +5242,6 @@ the corresponding short option. --debug -t --defines=@var{defines-file} -d --file-prefix=@var{prefix} -b @var{file-prefix} ---fixed-output-files --yacc -y --graph=@var{graph-file} -d --help -h --name-prefix=@var{prefix} -p @var{name-prefix} @@ -5258,6 +5251,7 @@ the corresponding short option. --token-table -k --verbose -v --version -V +--yacc -y @end example @end ifinfo @@ -5433,11 +5427,11 @@ Bison declaration to create a header file meant for the scanner. Bison declaration to set tge prefix of the output files. @xref{Decl Summary}. -@c @item %source_extension +@c @item %source-extension @c Bison declaration to specify the generated parser output file extension. @c @xref{Decl Summary}. @c -@c @item %header_extension +@c @item %header-extension @c Bison declaration to specify the generated parser header file extension @c if required. @xref{Decl Summary}.