X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/2bfc2e2a7dc951d28669c61fd0deb19a5046dd4a..efc6bf1b94135c0b858896ef966aa7eaca4ff3cf:/doc/bison.texinfo diff --git a/doc/bison.texinfo b/doc/bison.texinfo index 225bbaa7..645a5eba 100644 --- a/doc/bison.texinfo +++ b/doc/bison.texinfo @@ -208,6 +208,7 @@ Bison Declarations * Precedence Decl:: Declaring terminals with precedence and associativity. * Union Decl:: Declaring the set of all semantic value types. * Type Decl:: Declaring the choice of type for a nonterminal symbol. +* Destructor Decl:: Declaring how symbols are freed. * Expect Decl:: Suppressing warnings about shift/reduce conflicts. * Start Decl:: Specifying the start symbol. * Pure Decl:: Requesting a reentrant parser. @@ -268,7 +269,6 @@ Invoking Bison * Bison Options:: All the options described in detail, in alphabetical order by short options. * Option Cross Key:: Alphabetical list of long options. -* VMS Invocation:: Bison command syntax on @acronym{VMS}. Frequently Asked Questions @@ -682,7 +682,7 @@ involved, or by performing both actions, and then calling a designated user-defined function on the resulting values to produce an arbitrary merged result. -Let's consider an example, vastly simplified from C++. +Let's consider an example, vastly simplified from a C++ grammar. @example %@{ @@ -706,20 +706,20 @@ stmt : expr ';' %dprec 1 | decl %dprec 2 ; -expr : ID @{ printf ("%s ", $$); @} +expr : ID @{ printf ("%s ", $$); @} | TYPENAME '(' expr ')' - @{ printf ("%s ", $1); @} - | expr '+' expr @{ printf ("+ "); @} - | expr '=' expr @{ printf ("= "); @} + @{ printf ("%s ", $1); @} + | expr '+' expr @{ printf ("+ "); @} + | expr '=' expr @{ printf ("= "); @} ; decl : TYPENAME declarator ';' - @{ printf ("%s ", $1); @} + @{ printf ("%s ", $1); @} | TYPENAME declarator '=' expr ';' - @{ printf ("%s ", $1); @} + @{ printf ("%s ", $1); @} ; -declarator : ID @{ printf ("\"%s\" ", $1); @} +declarator : ID @{ printf ("\"%s\" ", $1); @} | '(' declarator ')' ; @end example @@ -1357,7 +1357,7 @@ here is the definition we will use: #include void -yyerror (const char *s) /* called by yyparse on error */ +yyerror (const char *s) /* Called by yyparse on error. */ @{ printf ("%s\n", s); @} @@ -1852,7 +1852,6 @@ symrec *tptr; /* For returning symbol-table pointers */ %right '^' /* Exponentiation */ /* Grammar follows */ - %% @end smallexample @@ -1929,7 +1928,9 @@ provides for either functions or variables to be placed in the table. @group /* Function type. */ typedef double (*func_t) (double); +@end group +@group /* Data type for links in the chain of symbols. */ struct symrec @{ @@ -1973,7 +1974,7 @@ main (void) @group void -yyerror (const char *s) /* Called by yyparse on error */ +yyerror (const char *s) /* Called by yyparse on error. */ @{ printf ("%s\n", s); @} @@ -2749,11 +2750,11 @@ a-or-b: 'a'|'b' @{ a_or_b_found = 1; @}; @cindex default action If you don't specify an action for a rule, Bison supplies a default: -@w{@code{$$ = $1}.} Thus, the value of the first symbol in the rule becomes -the value of the whole rule. Of course, the default rule is valid only -if the two data types match. There is no meaningful default action for -an empty rule; every empty rule must have an explicit action unless the -rule's value does not matter. +@w{@code{$$ = $1}.} Thus, the value of the first symbol in the rule +becomes the value of the whole rule. Of course, the default action is +valid only if the two data types match. There is no meaningful default +action for an empty rule; every empty rule must have an explicit action +unless the rule's value does not matter. @code{$@var{n}} with @var{n} zero or negative is allowed for reference to tokens and groupings on the stack @emph{before} those that match the @@ -3175,6 +3176,7 @@ Grammars}). * Precedence Decl:: Declaring terminals with precedence and associativity. * Union Decl:: Declaring the set of all semantic value types. * Type Decl:: Declaring the choice of type for a nonterminal symbol. +* Destructor Decl:: Declaring how symbols are freed. * Expect Decl:: Suppressing warnings about shift/reduce conflicts. * Start Decl:: Specifying the start symbol. * Pure Decl:: Requesting a reentrant parser. @@ -3365,6 +3367,71 @@ use the same @code{<@var{type}>} construction in a declaration for the terminal symbol. All kinds of token declarations allow @code{<@var{type}>}. +@node Destructor Decl +@subsection Freeing Discarded Symbols +@cindex freeing discarded symbols +@findex %destructor + +Some symbols can be discarded by the parser, typically during error +recovery (@pxref{Error Recovery}). Basically, during error recovery, +embarrassing symbols already pushed on the stack, and embarrassing +tokens coming from the rest of the file are thrown away until the parser +falls on its feet. If these symbols convey heap based information, this +memory is lost. While this behavior is tolerable for batch parsers, +such as in compilers, it is unacceptable for parsers that can +possibility ``never end'' such as shells, or implementations of +communication protocols. + +The @code{%destructor} directive allows for the definition of code that +is called when a symbol is thrown away. + +@deffn {Directive} %destructor @{ @var{code} @} @var{symbols} +@findex %destructor +Declare that the @var{code} must be invoked for each of the +@var{symbols} that will be discarded by the parser. The @var{code} +should use @code{$$} to designate the semantic value associated to the +@var{symbols}. The additional parser parameters are also avaible +(@pxref{Parser Function, , The Parser Function @code{yyparse}}). + +@strong{Warning:} as of Bison 1.875, this feature is still considered as +experimental, as there was not enough users feedback. In particular, +the syntax might still change. +@end deffn + +For instance: + +@smallexample +%union +@{ + char *string; +@} +%token STRING +%type string +%destructor @{ free ($$); @} STRING string +@end smallexample + +@noindent +guarantees that when a @code{STRING} or a @code{string} will be discarded, +its associated memory will be freed. + +Note that in the future, Bison might also consider that right hand side +members that are not mentioned in the action can be destroyed. For +instance, in: + +@smallexample +comment: "/*" STRING "*/"; +@end smallexample + +@noindent +the parser is entitled to destroy the semantic value of the +@code{string}. Of course, this will not apply to the default action; +compare: + +@smallexample +typeless: string; // $$ = $1 does not apply; $1 is destroyed. +typefull: string; // $$ = $1 applies, $1 is not destroyed. +@end smallexample + @node Expect Decl @subsection Suppressing Conflict Warnings @cindex suppressing conflict warnings @@ -3536,6 +3603,10 @@ This output file is essential if you wish to put the definition of be able to refer to token type codes and the variable @code{yylval}. @xref{Token Values, ,Semantic Values of Tokens}. +@item %destructor +Specifying how the parser should reclaim the memory associated to +discarded symbols. @xref{Destructor Decl, , Freeing Discarded Symbols}. + @item %file-prefix="@var{prefix}" 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}. @@ -3559,10 +3630,11 @@ 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}, @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}. +@code{yylval}, @code{yylloc}, @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 @@ -3634,8 +3706,6 @@ parser states and what is done for each type of look-ahead token in that state. @xref{Understanding, , Understanding Your Parser}, for more information. - - @item %yacc Pretend the option @option{--yacc} was given, i.e., imitate Yacc, including its naming conventions. @xref{Bison Options}, for more. @@ -3659,9 +3729,9 @@ instead of @samp{yy}. You can use this to give each parser distinct names that do not conflict. 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{-p c}, the names become -@code{cparse}, @code{clex}, and so on. +@code{yyerror}, @code{yynerrs}, @code{yylval}, @code{yylloc}, +@code{yychar} and @code{yydebug}. For example, if you use @samp{-p c}, +the names become @code{cparse}, @code{clex}, and so on. @strong{All the other variables and macros associated with Bison are not renamed.} These others are not global; there is no conflict if the same @@ -3706,23 +3776,65 @@ encounters end-of-input or an unrecoverable syntax error. You can also write an action which directs @code{yyparse} to return immediately without reading further. + +@deftypefun int yyparse (void) The value returned by @code{yyparse} is 0 if parsing was successful (return is due to end-of-input). The value is 1 if parsing failed (return is due to a syntax error). +@end deftypefun In an action, you can cause immediate return from @code{yyparse} by using these macros: -@table @code -@item YYACCEPT +@defmac YYACCEPT @findex YYACCEPT Return immediately with value 0 (to report success). +@end defmac -@item YYABORT +@defmac YYABORT @findex YYABORT Return immediately with value 1 (to report failure). -@end table +@end defmac + +If you use a reentrant parser, you can optionally pass additional +parameter information to it in a reentrant way. To do so, use the +declaration @code{%parse-param}: + +@deffn {Directive} %parse-param @var{argument-declaration} @var{argument-name} +@findex %parse-param +Declare that @code{argument-name} is an additional @code{yyparse} +argument. This argument is also passed to @code{yyerror}. The +@var{argument-declaration} is used when declaring functions or +prototypes. +@end deffn + +Here's an example. Write this in the parser: + +@example +%parse-param "int *nastiness" "nastiness" +%parse-param "int *randomness" "randomness" +@end example + +@noindent +Then call the parser like this: + +@example +@{ + int nastiness, randomness; + @dots{} /* @r{Store proper data in @code{nastiness} and @code{randomness}.} */ + value = yyparse (&nastiness, &randomness); + @dots{} +@} +@end example + +@noindent +In the grammar actions, use expressions like this to refer to the data: + +@example +exp: @dots{} @{ @dots{}; *randomness += 1; @dots{} @} +@end example + @node Lexical @section The Lexical Analyzer Function @code{yylex} @@ -3927,85 +4039,47 @@ textual positions, then the type @code{YYLTYPE} will not be defined. In this case, omit the second argument; @code{yylex} will be called with only one argument. -@vindex YYPARSE_PARAM -If you use a reentrant parser, you can optionally pass additional -parameter information to it in a reentrant way. To do so, define the -macro @code{YYPARSE_PARAM} as a variable name. This modifies the -@code{yyparse} function to accept one argument, of type @code{void *}, -with that name. - -When you call @code{yyparse}, pass the address of an object, casting the -address to @code{void *}. The grammar actions can refer to the contents -of the object by casting the pointer value back to its proper type and -then dereferencing it. Here's an example. Write this in the parser: -@example -%@{ -struct parser_control -@{ - int nastiness; - int randomness; -@}; +If you wish to pass the additional parameter data to @code{yylex}, use +@code{%lex-param} just like @code{%parse-param} (@pxref{Parser +Function}). -#define YYPARSE_PARAM parm -%@} -@end example +@deffn {Directive} lex-param @var{argument-declaration} @var{argument-name} +@findex %lex-param +Declare that @code{argument-name} is an additional @code{yylex} +argument. +@end deffn -@noindent -Then call the parser like this: +For instance: @example -struct parser_control -@{ - int nastiness; - int randomness; -@}; - -@dots{} - -@{ - struct parser_control foo; - @dots{} /* @r{Store proper data in @code{foo}.} */ - value = yyparse ((void *) &foo); - @dots{} -@} +%parse-param "int *nastiness" "nastiness" +%lex-param "int *nastiness" "nastiness" +%parse-param "int *randomness" "randomness" @end example @noindent -In the grammar actions, use expressions like this to refer to the data: +results in the following signature: @example -((struct parser_control *) parm)->randomness +int yylex (int *nastiness); +int yyparse (int *nastiness, int *randomness); @end example -@vindex YYLEX_PARAM -If you wish to pass the additional parameter data to @code{yylex}, -define the macro @code{YYLEX_PARAM} just like @code{YYPARSE_PARAM}, as -shown here: +If @code{%pure-parser} is added: @example -%@{ -struct parser_control -@{ - int nastiness; - int randomness; -@}; - -#define YYPARSE_PARAM parm -#define YYLEX_PARAM parm -%@} +int yylex (YYSTYPE *lvalp, int *nastiness); +int yyparse (int *nastiness, int *randomness); @end example -You should then define @code{yylex} to accept one additional -argument---the value of @code{parm}. (This makes either two or three -arguments in total, depending on whether an argument of type -@code{YYLTYPE} is passed.) You can declare the argument as a pointer to -the proper object type, or you can declare it as @code{void *} and -access the contents as shown above. +@noindent +and finally, if both @code{%pure-parser} and @code{%locations} are used: -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. +@example +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp, int *nastiness); +int yyparse (int *nastiness, int *randomness); +@end example @node Error Reporting @section The Error Reporting Function @code{yyerror} @@ -4026,13 +4100,11 @@ called by @code{yyparse} whenever a syntax error is found, and it receives one argument. For a parse error, the string is normally @w{@code{"parse error"}}. -@findex YYERROR_VERBOSE -If you define the macro @code{YYERROR_VERBOSE} in the Bison declarations -section (@pxref{Bison Declarations, ,The Bison Declarations Section}), -then Bison provides a more verbose and specific error message string -instead of just plain @w{@code{"parse error"}}. It doesn't matter what -definition you use for @code{YYERROR_VERBOSE}, just whether you define -it. +@findex %error-verbose +If you invoke the directive @code{%error-verbose} in the Bison +declarations section (@pxref{Bison Declarations, ,The Bison Declarations +Section}), then Bison provides a more verbose and specific error message +string instead of just plain @w{@code{"parse error"}}. The parser can detect one other kind of error: stack overflow. This happens when the input contains constructions that are very deeply @@ -4047,7 +4119,7 @@ The following definition suffices in simple programs: @example @group void -yyerror (char *s) +yyerror (const char *s) @{ @end group @group @@ -4061,6 +4133,57 @@ error recovery if you have written suitable error recovery grammar rules (@pxref{Error Recovery}). If recovery is impossible, @code{yyparse} will immediately return 1. +Obviously, in location tracking pure parsers, @code{yyerror} should have +an access to the current location. This is indeed the case for the GLR +parsers, but not for the Yacc parser, for historical reasons. I.e., if +@samp{%locations %pure-parser} is passed then the prototypes for +@code{yyerror} are: + +@example +void yyerror (const char *msg); /* Yacc parsers. */ +void yyerror (YYLTYPE *locp, const char *msg); /* GLR parsers. */ +@end example + +If @samp{%parse-param "int *nastiness" "nastiness"} is used, then: + +@example +void yyerror (int *randomness, const char *msg); /* Yacc parsers. */ +void yyerror (int *randomness, const char *msg); /* GLR parsers. */ +@end example + +Finally, GLR and Yacc parsers share the same @code{yyerror} calling +convention for absolutely pure parsers, i.e., when the calling +convention of @code{yylex} @emph{and} the calling convention of +@code{%pure-parser} are pure. I.e.: + +@example +/* Location tracking. */ +%locations +/* Pure yylex. */ +%pure-parser +%lex-param "int *nastiness" "nastiness" +/* Pure yyparse. */ +%parse-param "int *nastiness" "nastiness" +%parse-param "int *randomness" "randomness" +@end example + +@noindent +results in the following signatures for all the parser kinds: + +@example +int yylex (YYSTYPE *lvalp, YYLTYPE *llocp, int *nastiness); +int yyparse (int *nastiness, int *randomness); +void yyerror (YYLTYPE *locp, + int *nastiness, int *randomness, + const char *msg); +@end example + +@noindent +Please, note that the prototypes are only indications of how the code +produced by Bison will use @code{yyerror}; you still have freedom on the +exit value, and even on making @code{yyerror} a variadic function. It +is precisely to enable this that the message is always passed last. + @vindex yynerrs The variable @code{yynerrs} contains the number of syntax errors encountered so far. Normally this variable is global; but if you @@ -5016,15 +5139,17 @@ will be tokens to read before the next newline. So the rule is not applicable in the ordinary way. But Bison can force the situation to fit the rule, by discarding part of -the semantic context and part of the input. First it discards states and -objects from the stack until it gets back to a state in which the +the semantic context and part of the input. First it discards states +and objects from the stack until it gets back to a state in which the @code{error} token is acceptable. (This means that the subexpressions -already parsed are discarded, back to the last complete @code{stmnts}.) At -this point the @code{error} token can be shifted. Then, if the old +already parsed are discarded, back to the last complete @code{stmnts}.) +At this point the @code{error} token can be shifted. Then, if the old look-ahead token is not acceptable to be shifted next, the parser reads tokens and discards them until it finds a token which is acceptable. In -this example, Bison reads and discards input until the next newline -so that the fourth rule can apply. +this example, Bison reads and discards input until the next newline so +that the fourth rule can apply. Note that discarded symbols are +possible sources of memory leaks, see @ref{Destructor Decl, , Freeing +Discarded Symbols}, for a means to reclaim this memory. The choice of error rules in the grammar is a choice of strategies for error recovery. A simple and useful strategy is simply to skip the rest of @@ -5450,9 +5575,9 @@ state 0 $accept -> . exp $ (rule 0) - NUM shift, and go to state 1 + NUM shift, and go to state 1 - exp go to state 2 + exp go to state 2 @end example This reads as follows: ``state 0 corresponds to being at the very @@ -5499,7 +5624,7 @@ state 1 exp -> NUM . (rule 5) - $default reduce using rule 5 (exp) + $default reduce using rule 5 (exp) @end example @noindent @@ -5517,11 +5642,11 @@ state 2 exp -> exp . '*' exp (rule 3) exp -> exp . '/' exp (rule 4) - $ shift, and go to state 3 - '+' shift, and go to state 4 - '-' shift, and go to state 5 - '*' shift, and go to state 6 - '/' shift, and go to state 7 + $ shift, and go to state 3 + '+' shift, and go to state 4 + '-' shift, and go to state 5 + '*' shift, and go to state 6 + '/' shift, and go to state 7 @end example @noindent @@ -5540,7 +5665,7 @@ state 3 $accept -> exp $ . (rule 0) - $default accept + $default accept @end example @noindent @@ -5555,33 +5680,33 @@ state 4 exp -> exp '+' . exp (rule 1) - NUM shift, and go to state 1 + NUM shift, and go to state 1 - exp go to state 8 + exp go to state 8 state 5 exp -> exp '-' . exp (rule 2) - NUM shift, and go to state 1 + NUM shift, and go to state 1 - exp go to state 9 + exp go to state 9 state 6 exp -> exp '*' . exp (rule 3) - NUM shift, and go to state 1 + NUM shift, and go to state 1 - exp go to state 10 + exp go to state 10 state 7 exp -> exp '/' . exp (rule 4) - NUM shift, and go to state 1 + NUM shift, and go to state 1 - exp go to state 11 + exp go to state 11 @end example As was announced in beginning of the report, @samp{State 8 contains 1 @@ -5596,11 +5721,11 @@ state 8 exp -> exp . '*' exp (rule 3) exp -> exp . '/' exp (rule 4) - '*' shift, and go to state 6 - '/' shift, and go to state 7 + '*' shift, and go to state 6 + '/' shift, and go to state 7 - '/' [reduce using rule 1 (exp)] - $default reduce using rule 1 (exp) + '/' [reduce using rule 1 (exp)] + $default reduce using rule 1 (exp) @end example Indeed, there are two actions associated to the lookahead @samp{/}: @@ -5657,11 +5782,11 @@ state 9 exp -> exp . '*' exp (rule 3) exp -> exp . '/' exp (rule 4) - '*' shift, and go to state 6 - '/' shift, and go to state 7 + '*' shift, and go to state 6 + '/' shift, and go to state 7 - '/' [reduce using rule 2 (exp)] - $default reduce using rule 2 (exp) + '/' [reduce using rule 2 (exp)] + $default reduce using rule 2 (exp) state 10 @@ -5671,10 +5796,10 @@ state 10 exp -> exp '*' exp . (rule 3) exp -> exp . '/' exp (rule 4) - '/' shift, and go to state 7 + '/' shift, and go to state 7 - '/' [reduce using rule 3 (exp)] - $default reduce using rule 3 (exp) + '/' [reduce using rule 3 (exp)] + $default reduce using rule 3 (exp) state 11 @@ -5684,16 +5809,16 @@ state 11 exp -> exp . '/' exp (rule 4) exp -> exp '/' exp . (rule 4) - '+' shift, and go to state 4 - '-' shift, and go to state 5 - '*' shift, and go to state 6 - '/' shift, and go to state 7 + '+' shift, and go to state 4 + '-' shift, and go to state 5 + '*' shift, and go to state 6 + '/' shift, and go to state 7 - '+' [reduce using rule 4 (exp)] - '-' [reduce using rule 4 (exp)] - '*' [reduce using rule 4 (exp)] - '/' [reduce using rule 4 (exp)] - $default reduce using rule 4 (exp) + '+' [reduce using rule 4 (exp)] + '-' [reduce using rule 4 (exp)] + '*' [reduce using rule 4 (exp)] + '/' [reduce using rule 4 (exp)] + $default reduce using rule 4 (exp) @end example @noindent @@ -5852,7 +5977,6 @@ will produce @file{output.c++} and @file{outfile.h++}. * Bison Options:: All the options described in detail, in alphabetical order by short options. * Option Cross Key:: Alphabetical list of long options. -* VMS Invocation:: Bison command syntax on @acronym{VMS}. @end menu @node Bison Options @@ -6044,34 +6168,6 @@ the corresponding short option. @end example @end ifinfo -@node VMS Invocation -@section Invoking Bison under @acronym{VMS} -@cindex invoking Bison under @acronym{VMS} -@cindex @acronym{VMS} - -The command line syntax for Bison on @acronym{VMS} is a variant of the usual -Bison command syntax---adapted to fit @acronym{VMS} conventions. - -To find the @acronym{VMS} equivalent for any Bison option, start with the long -option, and substitute a @samp{/} for the leading @samp{--}, and -substitute a @samp{_} for each @samp{-} in the name of the long option. -For example, the following invocation under @acronym{VMS}: - -@example -bison /debug/name_prefix=bar foo.y -@end example - -@noindent -is equivalent to the following command under @acronym{POSIX}. - -@example -bison --debug --name-prefix=bar foo.y -@end example - -The @acronym{VMS} file system does not permit filenames such as -@file{foo.tab.c}. In the above example, the output file -would instead be named @file{foo_tab.c}. - @c ================================================= Invoking Bison @node FAQ @@ -6171,18 +6267,21 @@ Macro to pretend that a syntax error has just been detected: call @code{yyparse} return 1. @xref{Error Recovery}. @item YYERROR_VERBOSE -Macro that you define with @code{#define} in the Bison declarations -section to request verbose, specific error message strings when -@code{yyerror} is called. +An obsolete macro that you define with @code{#define} in the Bison +declarations section to request verbose, specific error message strings +when @code{yyerror} is called. It doesn't matter what definition you +use for @code{YYERROR_VERBOSE}, just whether you define it. Using +@code{%error-verbose} is preferred. @item YYINITDEPTH Macro for specifying the initial size of the parser stack. @xref{Stack Overflow}. @item YYLEX_PARAM -Macro for specifying an extra argument (or list of extra arguments) for -@code{yyparse} to pass to @code{yylex}. @xref{Pure Calling,, Calling -Conventions for Pure Parsers}. +An obsolete macro for specifying an extra argument (or list of extra +arguments) for @code{yyparse} to pass to @code{yylex}. he use of this +macro is deprecated, and is supported only for Yacc like parsers. +@xref{Pure Calling,, Calling Conventions for Pure Parsers}. @item YYLTYPE Macro for the data type of @code{yylloc}; a structure with four @@ -6196,8 +6295,10 @@ Macro for specifying the maximum size of the parser stack. @xref{Stack Overflow}. @item YYPARSE_PARAM -Macro for specifying the name of a parameter that @code{yyparse} should -accept. @xref{Pure Calling,, Calling Conventions for Pure Parsers}. +An obsolete macro for specifying the name of a parameter that +@code{yyparse} should accept. The use of this macro is deprecated, and +is supported only for Yacc like parsers. @xref{Pure Calling,, Calling +Conventions for Pure Parsers}. @item YYRECOVERING Macro whose value indicates whether the parser is recovering from a @@ -6273,11 +6374,19 @@ Equip the parser for debugging. @xref{Decl Summary}. Bison declaration to create a header file meant for the scanner. @xref{Decl Summary}. +@item %destructor +Specifying how the parser should reclaim the memory associated to +discarded symbols. @xref{Destructor Decl, , Freeing Discarded Symbols}. + @item %dprec Bison declaration to assign a precedence to a rule that is used at parse time to resolve reduce/reduce conflicts. @xref{GLR Parsers, ,Writing @acronym{GLR} Parsers}. +@item %error-verbose +Bison declaration to request verbose, specific error message strings +when @code{yyerror} is called. + @item %file-prefix="@var{prefix}" Bison declaration to set the prefix of the output files. @xref{Decl Summary}. @@ -6298,6 +6407,11 @@ Parsers, ,Writing @acronym{GLR} Parsers}. Bison declaration to assign left associativity to token(s). @xref{Precedence Decl, ,Operator Precedence}. +@item %lex-param "@var{argument-declaration}" "@var{argument-name}" +Bison declaration to specifying an additional parameter that +@code{yylex} should accept. @xref{Pure Calling,, Calling Conventions +for Pure Parsers}. + @item %merge Bison declaration to assign a merging function to a rule. If there is a reduce/reduce conflict with a rule having the same merging function, the @@ -6319,6 +6433,11 @@ Bison declaration to assign non-associativity to token(s). Bison declaration to set the name of the parser file. @xref{Decl Summary}. +@item %parse-param "@var{argument-declaration}" "@var{argument-name}" +Bison declaration to specifying an additional parameter that +@code{yyparse} should accept. @xref{Parser Function,, The Parser +Function @code{yyparse}}. + @item %prec Bison declaration to assign a precedence to a specific rule. @xref{Contextual Precedence, ,Context-Dependent Precedence}.