* doc/bison.texinfo: Various formatting changes (alignments in

samples, additional @group/@end group, GCS in samples.
Use @deffn instead of simple @table to define the directives,
macros, variables etc.
This commit is contained in:
Akim Demaille
2002-11-14 08:32:10 +00:00
parent daa33def28
commit 18b519c0d6
2 changed files with 248 additions and 156 deletions

View File

@@ -1,8 +1,15 @@
2002-11-14 Akim Demaille <akim@epita.fr>
* doc/bison.texinfo: Various formatting changes (alignments in
samples, additional @group/@end group, GCS in samples.
Use @deffn instead of simple @table to define the directives,
macros, variables etc.
2002-11-13 Paul Eggert <eggert@twinsun.com> 2002-11-13 Paul Eggert <eggert@twinsun.com>
Fix some bugs reported by Albert Chin-A-Young in Fix some bugs reported by Albert Chin-A-Young in
<http://mail.gnu.org/pipermail/bug-bison/2002-November/001881.html>. <http://mail.gnu.org/pipermail/bug-bison/2002-November/001881.html>.
* tests/input.at (Torturing the Scanner): Don't invoke "cc a.c b.c * tests/input.at (Torturing the Scanner): Don't invoke "cc a.c b.c
-o c"; the HP-UX 11i C compiler chatters during compilation. -o c"; the HP-UX 11i C compiler chatters during compilation.
Instead, invoke "cc -c a.c -o a.o; cc -c b.c -o b.o; cc a.o b.o -o c". Instead, invoke "cc -c a.c -o a.o; cc -c b.c -o b.o; cc a.o b.o -o c".
@@ -42,7 +49,7 @@
responsibility to #define it away, just like 'const'. responsibility to #define it away, just like 'const'.
This fixes one of the bugs reported by Nelson H.F. Beebe in This fixes one of the bugs reported by Nelson H.F. Beebe in
<http://mail.gnu.org/pipermail/bug-bison/2002-November/001873.html>. <http://mail.gnu.org/pipermail/bug-bison/2002-November/001873.html>.
* Makefile.maint (po-check): Scan .l and .y files instead of the * Makefile.maint (po-check): Scan .l and .y files instead of the
.c and the .h files that they generate. This fixes the bug .c and the .h files that they generate. This fixes the bug
reported by Tim Van Holder in: reported by Tim Van Holder in:

View File

@@ -1088,18 +1088,18 @@ input: /* empty */
; ;
line: '\n' line: '\n'
| exp '\n' @{ printf ("\t%.10g\n", $1); @} | exp '\n' @{ printf ("\t%.10g\n", $1); @}
; ;
exp: NUM @{ $$ = $1; @} exp: NUM @{ $$ = $1; @}
| exp exp '+' @{ $$ = $1 + $2; @} | exp exp '+' @{ $$ = $1 + $2; @}
| exp exp '-' @{ $$ = $1 - $2; @} | exp exp '-' @{ $$ = $1 - $2; @}
| exp exp '*' @{ $$ = $1 * $2; @} | exp exp '*' @{ $$ = $1 * $2; @}
| exp exp '/' @{ $$ = $1 / $2; @} | exp exp '/' @{ $$ = $1 / $2; @}
/* Exponentiation */ /* Exponentiation */
| exp exp '^' @{ $$ = pow ($1, $2); @} | exp exp '^' @{ $$ = pow ($1, $2); @}
/* Unary minus */ /* Unary minus */
| exp 'n' @{ $$ = -$1; @} | exp 'n' @{ $$ = -$1; @}
; ;
%% %%
@end example @end example
@@ -1706,11 +1706,15 @@ int
yylex (void) yylex (void)
@{ @{
int c; int c;
@end group
@group
/* Skip white space. */ /* Skip white space. */
while ((c = getchar ()) == ' ' || c == '\t') while ((c = getchar ()) == ' ' || c == '\t')
++yylloc.last_column; ++yylloc.last_column;
@end group
@group
/* Step. */ /* Step. */
yylloc.first_line = yylloc.last_line; yylloc.first_line = yylloc.last_line;
yylloc.first_column = yylloc.last_column; yylloc.first_column = yylloc.last_column;
@@ -1832,25 +1836,29 @@ Note that multiple assignment and nested function calls are permitted.
Here are the C and Bison declarations for the multi-function calculator. Here are the C and Bison declarations for the multi-function calculator.
@smallexample @smallexample
@group
%@{ %@{
#include <math.h> /* For math functions, cos(), sin(), etc. */ #include <math.h> /* For math functions, cos(), sin(), etc. */
#include "calc.h" /* Contains definition of `symrec' */ #include "calc.h" /* Contains definition of `symrec' */
%@} %@}
@end group
@group
%union @{ %union @{
double val; /* For returning numbers. */ double val; /* For returning numbers. */
symrec *tptr; /* For returning symbol-table pointers */ symrec *tptr; /* For returning symbol-table pointers. */
@} @}
@end group
%token <val> NUM /* Simple double precision number */ %token <val> NUM /* Simple double precision number. */
%token <tptr> VAR FNCT /* Variable and Function */ %token <tptr> VAR FNCT /* Variable and Function. */
%type <val> exp %type <val> exp
@group
%right '=' %right '='
%left '-' '+' %left '-' '+'
%left '*' '/' %left '*' '/'
%left NEG /* Negation--unary minus */ %left NEG /* Negation--unary minus */
%right '^' /* Exponentiation */ %right '^' /* Exponentiation */
@end group
/* Grammar follows */ /* Grammar follows */
%% %%
@end smallexample @end smallexample
@@ -1885,16 +1893,21 @@ Most of them are copied directly from @code{calc}; three rules,
those which mention @code{VAR} or @code{FNCT}, are new. those which mention @code{VAR} or @code{FNCT}, are new.
@smallexample @smallexample
@group
input: /* empty */ input: /* empty */
| input line | input line
; ;
@end group
@group
line: line:
'\n' '\n'
| exp '\n' @{ printf ("\t%.10g\n", $1); @} | exp '\n' @{ printf ("\t%.10g\n", $1); @}
| error '\n' @{ yyerrok; @} | error '\n' @{ yyerrok; @}
; ;
@end group
@group
exp: NUM @{ $$ = $1; @} exp: NUM @{ $$ = $1; @}
| VAR @{ $$ = $1->value.var; @} | VAR @{ $$ = $1->value.var; @}
| VAR '=' exp @{ $$ = $3; $1->value.var = $3; @} | VAR '=' exp @{ $$ = $3; $1->value.var = $3; @}
@@ -1907,6 +1920,7 @@ exp: NUM @{ $$ = $1; @}
| exp '^' exp @{ $$ = pow ($1, $3); @} | exp '^' exp @{ $$ = pow ($1, $3); @}
| '(' exp ')' @{ $$ = $2; @} | '(' exp ')' @{ $$ = $2; @}
; ;
@end group
/* End of grammar */ /* End of grammar */
%% %%
@end smallexample @end smallexample
@@ -1961,9 +1975,9 @@ function that initializes the symbol table. Here it is, and
@code{init_table} as well: @code{init_table} as well:
@smallexample @smallexample
@group
#include <stdio.h> #include <stdio.h>
@group
int int
main (void) main (void)
@{ @{
@@ -1978,7 +1992,9 @@ yyerror (const char *s) /* Called by yyparse on error. */
@{ @{
printf ("%s\n", s); printf ("%s\n", s);
@} @}
@end group
@group
struct init struct init
@{ @{
char *fname; char *fname;
@@ -1997,7 +2013,9 @@ struct init arith_fncts[] =
"sqrt", sqrt, "sqrt", sqrt,
0, 0 0, 0
@}; @};
@end group
@group
/* The symbol table: a chain of `struct symrec'. */ /* The symbol table: a chain of `struct symrec'. */
symrec *sym_table = (symrec *) 0; symrec *sym_table = (symrec *) 0;
@end group @end group
@@ -2073,7 +2091,9 @@ operators in @code{yylex}.
@smallexample @smallexample
@group @group
#include <ctype.h> #include <ctype.h>
@end group
@group
int int
yylex (void) yylex (void)
@{ @{
@@ -2121,7 +2141,7 @@ yylex (void)
if (i == length) if (i == length)
@{ @{
length *= 2; length *= 2;
symbuf = (char *)realloc (symbuf, length + 1); symbuf = (char *) realloc (symbuf, length + 1);
@} @}
/* Add this character to the buffer. */ /* Add this character to the buffer. */
symbuf[i++] = c; symbuf[i++] = c;
@@ -3544,53 +3564,60 @@ valid grammar.
Here is a summary of the declarations used to define a grammar: Here is a summary of the declarations used to define a grammar:
@table @code @deffn {Directive} %union
@item %union
Declare the collection of data types that semantic values may have Declare the collection of data types that semantic values may have
(@pxref{Union Decl, ,The Collection of Value Types}). (@pxref{Union Decl, ,The Collection of Value Types}).
@end deffn
@item %token @deffn {Directive} %token
Declare a terminal symbol (token type name) with no precedence Declare a terminal symbol (token type name) with no precedence
or associativity specified (@pxref{Token Decl, ,Token Type Names}). or associativity specified (@pxref{Token Decl, ,Token Type Names}).
@end deffn
@item %right @deffn {Directive} %right
Declare a terminal symbol (token type name) that is right-associative Declare a terminal symbol (token type name) that is right-associative
(@pxref{Precedence Decl, ,Operator Precedence}). (@pxref{Precedence Decl, ,Operator Precedence}).
@end deffn
@item %left @deffn {Directive} %left
Declare a terminal symbol (token type name) that is left-associative Declare a terminal symbol (token type name) that is left-associative
(@pxref{Precedence Decl, ,Operator Precedence}). (@pxref{Precedence Decl, ,Operator Precedence}).
@end deffn
@item %nonassoc @deffn {Directive} %nonassoc
Declare a terminal symbol (token type name) that is nonassociative Declare a terminal symbol (token type name) that is nonassociative
(using it in a way that would be associative is a syntax error) (using it in a way that would be associative is a syntax error)
@end deffn
(@pxref{Precedence Decl, ,Operator Precedence}). (@pxref{Precedence Decl, ,Operator Precedence}).
@item %type @deffn {Directive} %type
Declare the type of semantic values for a nonterminal symbol Declare the type of semantic values for a nonterminal symbol
(@pxref{Type Decl, ,Nonterminal Symbols}). (@pxref{Type Decl, ,Nonterminal Symbols}).
@end deffn
@item %start @deffn {Directive} %start
Specify the grammar's start symbol (@pxref{Start Decl, ,The Specify the grammar's start symbol (@pxref{Start Decl, ,The
Start-Symbol}). Start-Symbol}).
@end deffn
@item %expect @deffn {Directive} %expect
Declare the expected number of shift-reduce conflicts Declare the expected number of shift-reduce conflicts
(@pxref{Expect Decl, ,Suppressing Conflict Warnings}). (@pxref{Expect Decl, ,Suppressing Conflict Warnings}).
@end table @end deffn
@sp 1 @sp 1
@noindent @noindent
In order to change the behavior of @command{bison}, use the following In order to change the behavior of @command{bison}, use the following
directives: directives:
@table @code @deffn {Directive} %debug
@item %debug
In the parser file, define the macro @code{YYDEBUG} to 1 if it is not In the parser file, define the macro @code{YYDEBUG} to 1 if it is not
already defined, so that the debugging facilities are compiled. already defined, so that the debugging facilities are compiled.
@end deffn
@xref{Tracing, ,Tracing Your Parser}. @xref{Tracing, ,Tracing Your Parser}.
@item %defines @deffn {Directive} %defines
Write an extra output file containing macro definitions for the token Write an extra output file containing macro definitions for the token
type names defined in the grammar and the semantic value type type names defined in the grammar and the semantic value type
@code{YYSTYPE}, as well as a few @code{extern} variable declarations. @code{YYSTYPE}, as well as a few @code{extern} variable declarations.
@@ -3602,31 +3629,27 @@ This output file is essential if you wish to put the definition of
@code{yylex} in a separate source file, because @code{yylex} needs to @code{yylex} in a separate source file, because @code{yylex} needs to
be able to refer to token type codes and the variable be able to refer to token type codes and the variable
@code{yylval}. @xref{Token Values, ,Semantic Values of Tokens}. @code{yylval}. @xref{Token Values, ,Semantic Values of Tokens}.
@end deffn
@item %destructor @deffn {Directive} %destructor
Specifying how the parser should reclaim the memory associated to Specifying how the parser should reclaim the memory associated to
discarded symbols. @xref{Destructor Decl, , Freeing Discarded Symbols}. discarded symbols. @xref{Destructor Decl, , Freeing Discarded Symbols}.
@end deffn
@item %file-prefix="@var{prefix}" @deffn {Directive} %file-prefix="@var{prefix}"
Specify a prefix to use for all Bison output file names. The names are 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}. chosen as if the input file were named @file{@var{prefix}.y}.
@end deffn
@c @item %header-extension @deffn {Directive} %locations
@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 named @file{foo.tab.hh}
@item %locations
Generate the code processing the locations (@pxref{Action Features, Generate the code processing the locations (@pxref{Action Features,
,Special Features for Use in Actions}). This mode is enabled as soon as ,Special Features for Use in Actions}). This mode is enabled as soon as
the grammar uses the special @samp{@@@var{n}} tokens, but if your the grammar uses the special @samp{@@@var{n}} tokens, but if your
grammar does not use it, using @samp{%locations} allows for more grammar does not use it, using @samp{%locations} allows for more
accurate parse error messages. accurate parse error messages.
@end deffn
@item %name-prefix="@var{prefix}" @deffn {Directive} %name-prefix="@var{prefix}"
Rename the external symbols used in the parser so that they start with 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 @var{prefix} instead of @samp{yy}. The precise list of symbols renamed
is @code{yyparse}, @code{yylex}, @code{yyerror}, @code{yynerrs}, is @code{yyparse}, @code{yylex}, @code{yyerror}, @code{yynerrs},
@@ -3635,8 +3658,9 @@ possible @code{yylloc}. For example, if you use
@samp{%name-prefix="c_"}, the names become @code{c_parse}, @code{c_lex}, @samp{%name-prefix="c_"}, the names become @code{c_parse}, @code{c_lex},
and so on. @xref{Multiple Parsers, ,Multiple Parsers in the Same and so on. @xref{Multiple Parsers, ,Multiple Parsers in the Same
Program}. Program}.
@end deffn
@item %no-parser @deffn {Directive} %no-parser
Do not include any C code in the parser file; generate tables only. The Do not include any C code in the parser file; generate tables only. The
parser file contains just @code{#define} directives and static variable parser file contains just @code{#define} directives and static variable
declarations. declarations.
@@ -3644,30 +3668,27 @@ declarations.
This option also tells Bison to write the C code for the grammar actions This option also tells Bison to write the C code for the grammar actions
into a file named @file{@var{filename}.act}, in the form of a into a file named @file{@var{filename}.act}, in the form of a
brace-surrounded body fit for a @code{switch} statement. brace-surrounded body fit for a @code{switch} statement.
@end deffn
@item %no-lines @deffn {Directive} %no-lines
Don't generate any @code{#line} preprocessor commands in the parser Don't generate any @code{#line} preprocessor commands in the parser
file. Ordinarily Bison writes these commands in the parser file so that file. Ordinarily Bison writes these commands in the parser file so that
the C compiler and debuggers will associate errors and object code with the C compiler and debuggers will associate errors and object code with
your source file (the grammar file). This directive causes them to your source file (the grammar file). This directive causes them to
associate errors with the parser file, treating it an independent source associate errors with the parser file, treating it an independent source
file in its own right. file in its own right.
@end deffn
@item %output="@var{filename}" @deffn {Directive} %output="@var{filename}"
Specify the @var{filename} for the parser file. Specify the @var{filename} for the parser file.
@end deffn
@item %pure-parser @deffn {Directive} %pure-parser
Request a pure (reentrant) parser program (@pxref{Pure Decl, ,A Pure Request a pure (reentrant) parser program (@pxref{Pure Decl, ,A Pure
(Reentrant) Parser}). (Reentrant) Parser}).
@end deffn
@c @item %source-extension @deffn {Directive} %token-table
@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 named @file{foo.tab.cpp}
@item %token-table
Generate an array of token names in the parser file. The name of the 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 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 token whose internal Bison token code number is @var{i}. The first
@@ -3699,19 +3720,19 @@ The number of grammar rules,
@item YYNSTATES @item YYNSTATES
The number of parser states (@pxref{Parser States}). The number of parser states (@pxref{Parser States}).
@end table @end table
@end deffn
@item %verbose @deffn {Directive} %verbose
Write an extra output file containing verbose descriptions of the 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 look-ahead token in
that state. @xref{Understanding, , Understanding Your Parser}, for more that state. @xref{Understanding, , Understanding Your Parser}, for more
information. information.
@end deffn
@item %yacc @deffn {Directive} %yacc
Pretend the option @option{--yacc} was given, i.e., imitate Yacc, Pretend the option @option{--yacc} was given, i.e., imitate Yacc,
including its naming conventions. @xref{Bison Options}, for more. including its naming conventions. @xref{Bison Options}, for more.
@end table @end deffn
@node Multiple Parsers @node Multiple Parsers
@@ -4198,34 +4219,39 @@ then it is a local variable which only the actions can access.
Here is a table of Bison constructs, variables and macros that Here is a table of Bison constructs, variables and macros that
are useful in actions. are useful in actions.
@table @samp @deffn {Variable} $$
@item $$
Acts like a variable that contains the semantic value for the Acts like a variable that contains the semantic value for the
grouping made by the current rule. @xref{Actions}. grouping made by the current rule. @xref{Actions}.
@end deffn
@item $@var{n} @deffn {Variable} $@var{n}
Acts like a variable that contains the semantic value for the Acts like a variable that contains the semantic value for the
@var{n}th component of the current rule. @xref{Actions}. @var{n}th component of the current rule. @xref{Actions}.
@end deffn
@item $<@var{typealt}>$ @deffn {Variable} $<@var{typealt}>$
Like @code{$$} but specifies alternative @var{typealt} in the union Like @code{$$} but specifies alternative @var{typealt} in the union
specified by the @code{%union} declaration. @xref{Action Types, ,Data specified by the @code{%union} declaration. @xref{Action Types, ,Data
Types of Values in Actions}. Types of Values in Actions}.
@end deffn
@item $<@var{typealt}>@var{n} @deffn {Variable} $<@var{typealt}>@var{n}
Like @code{$@var{n}} but specifies alternative @var{typealt} in the Like @code{$@var{n}} but specifies alternative @var{typealt} in the
union specified by the @code{%union} declaration. union specified by the @code{%union} declaration.
@xref{Action Types, ,Data Types of Values in Actions}. @xref{Action Types, ,Data Types of Values in Actions}.
@end deffn
@item YYABORT; @deffn {Macro} YYABORT;
Return immediately from @code{yyparse}, indicating failure. Return immediately from @code{yyparse}, indicating failure.
@xref{Parser Function, ,The Parser Function @code{yyparse}}. @xref{Parser Function, ,The Parser Function @code{yyparse}}.
@end deffn
@item YYACCEPT; @deffn {Macro} YYACCEPT;
Return immediately from @code{yyparse}, indicating success. Return immediately from @code{yyparse}, indicating success.
@xref{Parser Function, ,The Parser Function @code{yyparse}}. @xref{Parser Function, ,The Parser Function @code{yyparse}}.
@end deffn
@item YYBACKUP (@var{token}, @var{value}); @deffn {Macro} YYBACKUP (@var{token}, @var{value});
@findex YYBACKUP @findex YYBACKUP
Unshift a token. This macro is allowed only for rules that reduce Unshift a token. This macro is allowed only for rules that reduce
a single value, and only when there is no look-ahead token. a single value, and only when there is no look-ahead token.
@@ -4240,40 +4266,47 @@ a message @samp{cannot back up} and performs ordinary error
recovery. recovery.
In either case, the rest of the action is not executed. In either case, the rest of the action is not executed.
@end deffn
@item YYEMPTY @deffn {Macro} YYEMPTY
@vindex YYEMPTY @vindex YYEMPTY
Value stored in @code{yychar} when there is no look-ahead token. Value stored in @code{yychar} when there is no look-ahead token.
@end deffn
@item YYERROR; @deffn {Macro} YYERROR;
@findex YYERROR @findex YYERROR
Cause an immediate syntax error. This statement initiates error Cause an immediate syntax error. This statement initiates error
recovery just as if the parser itself had detected an error; however, it recovery just as if the parser itself had detected an error; however, it
does not call @code{yyerror}, and does not print any message. If you does not call @code{yyerror}, and does not print any message. If you
want to print an error message, call @code{yyerror} explicitly before want to print an error message, call @code{yyerror} explicitly before
the @samp{YYERROR;} statement. @xref{Error Recovery}. the @samp{YYERROR;} statement. @xref{Error Recovery}.
@end deffn
@item YYRECOVERING @deffn {Macro} YYRECOVERING
This macro stands for an expression that has the value 1 when the parser This macro stands for an expression that has the value 1 when the parser
is recovering from a syntax error, and 0 the rest of the time. is recovering from a syntax error, and 0 the rest of the time.
@xref{Error Recovery}. @xref{Error Recovery}.
@end deffn
@item yychar @deffn {Variable} yychar
Variable containing the current look-ahead token. (In a pure parser, Variable containing the current look-ahead token. (In a pure parser,
this is actually a local variable within @code{yyparse}.) When there is this is actually a local variable within @code{yyparse}.) When there is
no look-ahead token, the value @code{YYEMPTY} is stored in the variable. no look-ahead token, the value @code{YYEMPTY} is stored in the variable.
@xref{Look-Ahead, ,Look-Ahead Tokens}. @xref{Look-Ahead, ,Look-Ahead Tokens}.
@end deffn
@item yyclearin; @deffn {Macro} yyclearin;
Discard the current look-ahead token. This is useful primarily in Discard the current look-ahead token. This is useful primarily in
error rules. @xref{Error Recovery}. error rules. @xref{Error Recovery}.
@end deffn
@item yyerrok; @deffn {Macro} yyerrok;
Resume generating error messages immediately for subsequent syntax Resume generating error messages immediately for subsequent syntax
errors. This is useful primarily in error rules. errors. This is useful primarily in error rules.
@xref{Error Recovery}. @xref{Error Recovery}.
@end deffn
@item @@$ @deffn {Value} @@$
@findex @@$ @findex @@$
Acts like a structure variable containing information on the textual position Acts like a structure variable containing information on the textual position
of the grouping made by the current rule. @xref{Locations, , of the grouping made by the current rule. @xref{Locations, ,
@@ -4297,14 +4330,15 @@ Tracking Locations}.
@c those members. @c those members.
@c The use of this feature makes the parser noticeably slower. @c The use of this feature makes the parser noticeably slower.
@end deffn
@item @@@var{n} @deffn {Value} @@@var{n}
@findex @@@var{n} @findex @@@var{n}
Acts like a structure variable containing information on the textual position Acts like a structure variable containing information on the textual position
of the @var{n}th component of the current rule. @xref{Locations, , of the @var{n}th component of the current rule. @xref{Locations, ,
Tracking Locations}. Tracking Locations}.
@end deffn
@end table
@node Algorithm @node Algorithm
@chapter The Bison Parser Algorithm @chapter The Bison Parser Algorithm
@@ -6200,38 +6234,44 @@ This question is already addressed elsewhere, @xref{Recursion,
@cindex Bison symbols, table of @cindex Bison symbols, table of
@cindex symbols in Bison, table of @cindex symbols in Bison, table of
@table @code @deffn {Variable} @@$
@item @@$
In an action, the location of the left-hand side of the rule. In an action, the location of the left-hand side of the rule.
@xref{Locations, , Locations Overview}. @xref{Locations, , Locations Overview}.
@end deffn
@item @@@var{n} @deffn {Variable} @@@var{n}
In an action, the location of the @var{n}-th symbol of the right-hand In an action, the location of the @var{n}-th symbol of the right-hand
side of the rule. @xref{Locations, , Locations Overview}. side of the rule. @xref{Locations, , Locations Overview}.
@end deffn
@item $$ @deffn {Variable} $$
In an action, the semantic value of the left-hand side of the rule. In an action, the semantic value of the left-hand side of the rule.
@xref{Actions}. @xref{Actions}.
@end deffn
@item $@var{n} @deffn {Variable} $@var{n}
In an action, the semantic value of the @var{n}-th symbol of the In an action, the semantic value of the @var{n}-th symbol of the
right-hand side of the rule. @xref{Actions}. right-hand side of the rule. @xref{Actions}.
@end deffn
@item $accept @deffn {Symbol} $accept
The predefined nonterminal whose only rule is @samp{$accept: @var{start} The predefined nonterminal whose only rule is @samp{$accept: @var{start}
$end}, where @var{start} is the start symbol. @xref{Start Decl, , The $end}, where @var{start} is the start symbol. @xref{Start Decl, , The
Start-Symbol}. It cannot be used in the grammar. Start-Symbol}. It cannot be used in the grammar.
@end deffn
@item $end @deffn {Symbol} $end
The predefined token marking the end of the token stream. It cannot be The predefined token marking the end of the token stream. It cannot be
used in the grammar. used in the grammar.
@end deffn
@item $undefined @deffn {Symbol} $undefined
The predefined token onto which all undefined values returned by The predefined token onto which all undefined values returned by
@code{yylex} are mapped. It cannot be used in the grammar, rather, use @code{yylex} are mapped. It cannot be used in the grammar, rather, use
@code{error}. @code{error}.
@end deffn
@item error @deffn {Symbol} error
A token name reserved for error recovery. This token may be used in A token name reserved for error recovery. This token may be used in
grammar rules so as to allow the Bison parser to recognize an error in grammar rules so as to allow the Bison parser to recognize an error in
the grammar without halting the process. In effect, a sentence the grammar without halting the process. In effect, a sentence
@@ -6240,267 +6280,312 @@ token @code{error} becomes the current look-ahead token. Actions
corresponding to @code{error} are then executed, and the look-ahead corresponding to @code{error} are then executed, and the look-ahead
token is reset to the token that originally caused the violation. token is reset to the token that originally caused the violation.
@xref{Error Recovery}. @xref{Error Recovery}.
@end deffn
@item YYABORT @deffn {Macro} YYABORT
Macro to pretend that an unrecoverable syntax error has occurred, by Macro to pretend that an unrecoverable syntax error has occurred, by
making @code{yyparse} return 1 immediately. The error reporting making @code{yyparse} return 1 immediately. The error reporting
function @code{yyerror} is not called. @xref{Parser Function, ,The function @code{yyerror} is not called. @xref{Parser Function, ,The
Parser Function @code{yyparse}}. Parser Function @code{yyparse}}.
@end deffn
@item YYACCEPT @deffn {Macro} YYACCEPT
Macro to pretend that a complete utterance of the language has been Macro to pretend that a complete utterance of the language has been
read, by making @code{yyparse} return 0 immediately. read, by making @code{yyparse} return 0 immediately.
@xref{Parser Function, ,The Parser Function @code{yyparse}}. @xref{Parser Function, ,The Parser Function @code{yyparse}}.
@end deffn
@item YYBACKUP @deffn {Macro} YYBACKUP
Macro to discard a value from the parser stack and fake a look-ahead Macro to discard a value from the parser stack and fake a look-ahead
token. @xref{Action Features, ,Special Features for Use in Actions}. token. @xref{Action Features, ,Special Features for Use in Actions}.
@end deffn
@item YYDEBUG @deffn {Macro} YYDEBUG
Macro to define to equip the parser with tracing code. @xref{Tracing, Macro to define to equip the parser with tracing code. @xref{Tracing,
,Tracing Your Parser}. ,Tracing Your Parser}.
@end deffn
@item YYERROR @deffn {Macro} YYERROR
Macro to pretend that a syntax error has just been detected: call Macro to pretend that a syntax error has just been detected: call
@code{yyerror} and then perform normal error recovery if possible @code{yyerror} and then perform normal error recovery if possible
(@pxref{Error Recovery}), or (if recovery is impossible) make (@pxref{Error Recovery}), or (if recovery is impossible) make
@code{yyparse} return 1. @xref{Error Recovery}. @code{yyparse} return 1. @xref{Error Recovery}.
@end deffn
@item YYERROR_VERBOSE @deffn {Macro} YYERROR_VERBOSE
An obsolete macro that you define with @code{#define} in the Bison An obsolete macro that you define with @code{#define} in the Bison
declarations section to request verbose, specific error message strings declarations section to request verbose, specific error message strings
when @code{yyerror} is called. It doesn't matter what definition you when @code{yyerror} is called. It doesn't matter what definition you
use for @code{YYERROR_VERBOSE}, just whether you define it. Using use for @code{YYERROR_VERBOSE}, just whether you define it. Using
@code{%error-verbose} is preferred. @code{%error-verbose} is preferred.
@end deffn
@item YYINITDEPTH @deffn {Macro} YYINITDEPTH
Macro for specifying the initial size of the parser stack. Macro for specifying the initial size of the parser stack.
@xref{Stack Overflow}. @xref{Stack Overflow}.
@end deffn
@item YYLEX_PARAM @deffn {Macro} YYLEX_PARAM
An obsolete macro for specifying an extra argument (or list of extra 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 arguments) for @code{yyparse} to pass to @code{yylex}. he use of this
macro is deprecated, and is supported only for Yacc like parsers. macro is deprecated, and is supported only for Yacc like parsers.
@xref{Pure Calling,, Calling Conventions for Pure Parsers}. @xref{Pure Calling,, Calling Conventions for Pure Parsers}.
@end deffn
@item YYLTYPE @deffn {Macro} YYLTYPE
Macro for the data type of @code{yylloc}; a structure with four Macro for the data type of @code{yylloc}; a structure with four
members. @xref{Location Type, , Data Types of Locations}. members. @xref{Location Type, , Data Types of Locations}.
@end deffn
@item yyltype @deffn {Type} yyltype
Default value for YYLTYPE. Default value for YYLTYPE.
@end deffn
@item YYMAXDEPTH @deffn {Macro} YYMAXDEPTH
Macro for specifying the maximum size of the parser stack. Macro for specifying the maximum size of the parser stack. @xref{Stack
@xref{Stack Overflow}. Overflow}.
@end deffn
@item YYPARSE_PARAM @deffn {Macro} YYPARSE_PARAM
An obsolete macro for specifying the name of a parameter that An obsolete macro for specifying the name of a parameter that
@code{yyparse} should accept. The use of this macro is deprecated, and @code{yyparse} should accept. The use of this macro is deprecated, and
is supported only for Yacc like parsers. @xref{Pure Calling,, Calling is supported only for Yacc like parsers. @xref{Pure Calling,, Calling
Conventions for Pure Parsers}. Conventions for Pure Parsers}.
@end deffn
@item YYRECOVERING @deffn {Macro} YYRECOVERING
Macro whose value indicates whether the parser is recovering from a Macro whose value indicates whether the parser is recovering from a
syntax error. @xref{Action Features, ,Special Features for Use in Actions}. syntax error. @xref{Action Features, ,Special Features for Use in Actions}.
@end deffn
@item YYSTACK_USE_ALLOCA @deffn {Macro} YYSTACK_USE_ALLOCA
Macro used to control the use of @code{alloca}. If defined to @samp{0}, Macro used to control the use of @code{alloca}. If defined to @samp{0},
the parser will not use @code{alloca} but @code{malloc} when trying to the parser will not use @code{alloca} but @code{malloc} when trying to
grow its internal stacks. Do @emph{not} define @code{YYSTACK_USE_ALLOCA} grow its internal stacks. Do @emph{not} define @code{YYSTACK_USE_ALLOCA}
to anything else. to anything else.
@end deffn
@item YYSTYPE @deffn {Macro} YYSTYPE
Macro for the data type of semantic values; @code{int} by default. Macro for the data type of semantic values; @code{int} by default.
@xref{Value Type, ,Data Types of Semantic Values}. @xref{Value Type, ,Data Types of Semantic Values}.
@end deffn
@item yychar @deffn {Variable} yychar
External integer variable that contains the integer value of the current External integer variable that contains the integer value of the current
look-ahead token. (In a pure parser, it is a local variable within look-ahead token. (In a pure parser, it is a local variable within
@code{yyparse}.) Error-recovery rule actions may examine this variable. @code{yyparse}.) Error-recovery rule actions may examine this variable.
@xref{Action Features, ,Special Features for Use in Actions}. @xref{Action Features, ,Special Features for Use in Actions}.
@end deffn
@item yyclearin @deffn {Variable} yyclearin
Macro used in error-recovery rule actions. It clears the previous Macro used in error-recovery rule actions. It clears the previous
look-ahead token. @xref{Error Recovery}. look-ahead token. @xref{Error Recovery}.
@end deffn
@item yydebug @deffn {Variable} yydebug
External integer variable set to zero by default. If @code{yydebug} External integer variable set to zero by default. If @code{yydebug}
is given a nonzero value, the parser will output information on input is given a nonzero value, the parser will output information on input
symbols and parser action. @xref{Tracing, ,Tracing Your Parser}. symbols and parser action. @xref{Tracing, ,Tracing Your Parser}.
@end deffn
@item yyerrok @deffn {Macro} yyerrok
Macro to cause parser to recover immediately to its normal mode Macro to cause parser to recover immediately to its normal mode
after a parse error. @xref{Error Recovery}. after a parse error. @xref{Error Recovery}.
@end deffn
@item yyerror @deffn {Function} yyerror
User-supplied function to be called by @code{yyparse} on error. The User-supplied function to be called by @code{yyparse} on error. The
function receives one argument, a pointer to a character string function receives one argument, a pointer to a character string
containing an error message. @xref{Error Reporting, ,The Error containing an error message. @xref{Error Reporting, ,The Error
Reporting Function @code{yyerror}}. Reporting Function @code{yyerror}}.
@end deffn
@item yylex @deffn {Function} yylex
User-supplied lexical analyzer function, called with no arguments to get User-supplied lexical analyzer function, called with no arguments to get
the next token. @xref{Lexical, ,The Lexical Analyzer Function the next token. @xref{Lexical, ,The Lexical Analyzer Function
@code{yylex}}. @code{yylex}}.
@end deffn
@item yylval @deffn {Variable} yylval
External variable in which @code{yylex} should place the semantic External variable in which @code{yylex} should place the semantic
value associated with a token. (In a pure parser, it is a local value associated with a token. (In a pure parser, it is a local
variable within @code{yyparse}, and its address is passed to variable within @code{yyparse}, and its address is passed to
@code{yylex}.) @xref{Token Values, ,Semantic Values of Tokens}. @code{yylex}.) @xref{Token Values, ,Semantic Values of Tokens}.
@end deffn
@item yylloc @deffn {Variable} yylloc
External variable in which @code{yylex} should place the line and column External variable in which @code{yylex} should place the line and column
numbers associated with a token. (In a pure parser, it is a local numbers associated with a token. (In a pure parser, it is a local
variable within @code{yyparse}, and its address is passed to variable within @code{yyparse}, and its address is passed to
@code{yylex}.) You can ignore this variable if you don't use the @code{yylex}.) You can ignore this variable if you don't use the
@samp{@@} feature in the grammar actions. @xref{Token Positions, @samp{@@} feature in the grammar actions. @xref{Token Positions,
,Textual Positions of Tokens}. ,Textual Positions of Tokens}.
@end deffn
@item yynerrs @deffn {Variable} yynerrs
Global variable which Bison increments each time there is a parse error. Global variable which Bison increments each time there is a parse error.
(In a pure parser, it is a local variable within @code{yyparse}.) (In a pure parser, it is a local variable within @code{yyparse}.)
@xref{Error Reporting, ,The Error Reporting Function @code{yyerror}}. @xref{Error Reporting, ,The Error Reporting Function @code{yyerror}}.
@end deffn
@item yyparse @deffn {Function} yyparse
The parser function produced by Bison; call this function to start The parser function produced by Bison; call this function to start
parsing. @xref{Parser Function, ,The Parser Function @code{yyparse}}. parsing. @xref{Parser Function, ,The Parser Function @code{yyparse}}.
@end deffn
@item %debug @deffn {Directive} %debug
Equip the parser for debugging. @xref{Decl Summary}. Equip the parser for debugging. @xref{Decl Summary}.
@end deffn
@item %defines @deffn {Directive} %defines
Bison declaration to create a header file meant for the scanner. Bison declaration to create a header file meant for the scanner.
@xref{Decl Summary}. @xref{Decl Summary}.
@end deffn
@item %destructor @deffn {Directive} %destructor
Specifying how the parser should reclaim the memory associated to Specifying how the parser should reclaim the memory associated to
discarded symbols. @xref{Destructor Decl, , Freeing Discarded Symbols}. discarded symbols. @xref{Destructor Decl, , Freeing Discarded Symbols}.
@end deffn
@item %dprec @deffn {Directive} %dprec
Bison declaration to assign a precedence to a rule that is used at parse Bison declaration to assign a precedence to a rule that is used at parse
time to resolve reduce/reduce conflicts. @xref{GLR Parsers, ,Writing time to resolve reduce/reduce conflicts. @xref{GLR Parsers, ,Writing
@acronym{GLR} Parsers}. @acronym{GLR} Parsers}.
@end deffn
@item %error-verbose @deffn {Directive} %error-verbose
Bison declaration to request verbose, specific error message strings Bison declaration to request verbose, specific error message strings
when @code{yyerror} is called. when @code{yyerror} is called.
@end deffn
@item %file-prefix="@var{prefix}" @deffn {Directive} %file-prefix="@var{prefix}"
Bison declaration to set the prefix of the output files. @xref{Decl Bison declaration to set the prefix of the output files. @xref{Decl
Summary}. Summary}.
@end deffn
@item %glr-parser @deffn {Directive} %glr-parser
Bison declaration to produce a @acronym{GLR} parser. @xref{GLR Bison declaration to produce a @acronym{GLR} parser. @xref{GLR
Parsers, ,Writing @acronym{GLR} Parsers}. Parsers, ,Writing @acronym{GLR} Parsers}.
@end deffn
@c @item %source-extension @deffn {Directive} %left
@c Bison declaration to specify the generated parser output file extension.
@c @xref{Decl Summary}.
@c
@c @item %header-extension
@c Bison declaration to specify the generated parser header file extension
@c if required. @xref{Decl Summary}.
@item %left
Bison declaration to assign left associativity to token(s). Bison declaration to assign left associativity to token(s).
@xref{Precedence Decl, ,Operator Precedence}. @xref{Precedence Decl, ,Operator Precedence}.
@end deffn
@item %lex-param "@var{argument-declaration}" "@var{argument-name}" @deffn {Directive} %lex-param "@var{argument-declaration}" "@var{argument-name}"
Bison declaration to specifying an additional parameter that Bison declaration to specifying an additional parameter that
@code{yylex} should accept. @xref{Pure Calling,, Calling Conventions @code{yylex} should accept. @xref{Pure Calling,, Calling Conventions
for Pure Parsers}. for Pure Parsers}.
@end deffn
@item %merge @deffn {Directive} %merge
Bison declaration to assign a merging function to a rule. If there is a 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 reduce/reduce conflict with a rule having the same merging function, the
function is applied to the two semantic values to get a single result. function is applied to the two semantic values to get a single result.
@xref{GLR Parsers, ,Writing @acronym{GLR} Parsers}. @xref{GLR Parsers, ,Writing @acronym{GLR} Parsers}.
@end deffn
@item %name-prefix="@var{prefix}" @deffn {Directive} %name-prefix="@var{prefix}"
Bison declaration to rename the external symbols. @xref{Decl Summary}. Bison declaration to rename the external symbols. @xref{Decl Summary}.
@end deffn
@item %no-lines @deffn {Directive} %no-lines
Bison declaration to avoid generating @code{#line} directives in the Bison declaration to avoid generating @code{#line} directives in the
parser file. @xref{Decl Summary}. parser file. @xref{Decl Summary}.
@end deffn
@item %nonassoc @deffn {Directive} %nonassoc
Bison declaration to assign non-associativity to token(s). Bison declaration to assign non-associativity to token(s).
@xref{Precedence Decl, ,Operator Precedence}. @xref{Precedence Decl, ,Operator Precedence}.
@end deffn
@item %output="@var{filename}" @deffn {Directive} %output="@var{filename}"
Bison declaration to set the name of the parser file. @xref{Decl Bison declaration to set the name of the parser file. @xref{Decl
Summary}. Summary}.
@end deffn
@item %parse-param "@var{argument-declaration}" "@var{argument-name}" @deffn {Directive} %parse-param "@var{argument-declaration}" "@var{argument-name}"
Bison declaration to specifying an additional parameter that Bison declaration to specifying an additional parameter that
@code{yyparse} should accept. @xref{Parser Function,, The Parser @code{yyparse} should accept. @xref{Parser Function,, The Parser
Function @code{yyparse}}. Function @code{yyparse}}.
@end deffn
@item %prec @deffn {Directive} %prec
Bison declaration to assign a precedence to a specific rule. Bison declaration to assign a precedence to a specific rule.
@xref{Contextual Precedence, ,Context-Dependent Precedence}. @xref{Contextual Precedence, ,Context-Dependent Precedence}.
@end deffn
@item %pure-parser @deffn {Directive} %pure-parser
Bison declaration to request a pure (reentrant) parser. Bison declaration to request a pure (reentrant) parser.
@xref{Pure Decl, ,A Pure (Reentrant) Parser}. @xref{Pure Decl, ,A Pure (Reentrant) Parser}.
@end deffn
@item %right @deffn {Directive} %right
Bison declaration to assign right associativity to token(s). Bison declaration to assign right associativity to token(s).
@xref{Precedence Decl, ,Operator Precedence}. @xref{Precedence Decl, ,Operator Precedence}.
@end deffn
@item %start @deffn {Directive} %start
Bison declaration to specify the start symbol. @xref{Start Decl, ,The Bison declaration to specify the start symbol. @xref{Start Decl, ,The
Start-Symbol}. Start-Symbol}.
@end deffn
@item %token @deffn {Directive} %token
Bison declaration to declare token(s) without specifying precedence. Bison declaration to declare token(s) without specifying precedence.
@xref{Token Decl, ,Token Type Names}. @xref{Token Decl, ,Token Type Names}.
@end deffn
@item %token-table @deffn {Directive} %token-table
Bison declaration to include a token name table in the parser file. Bison declaration to include a token name table in the parser file.
@xref{Decl Summary}. @xref{Decl Summary}.
@end deffn
@item %type @deffn {Directive} %type
Bison declaration to declare nonterminals. @xref{Type Decl, Bison declaration to declare nonterminals. @xref{Type Decl,
,Nonterminal Symbols}. ,Nonterminal Symbols}.
@end deffn
@item %union @deffn {Directive} %union
Bison declaration to specify several possible data types for semantic Bison declaration to specify several possible data types for semantic
values. @xref{Union Decl, ,The Collection of Value Types}. values. @xref{Union Decl, ,The Collection of Value Types}.
@end table @end deffn
@sp 1 @sp 1
These are the punctuation and delimiters used in Bison input: These are the punctuation and delimiters used in Bison input:
@table @samp @deffn {Delimiter} %%
@item %%
Delimiter used to separate the grammar rule section from the Delimiter used to separate the grammar rule section from the
Bison declarations section or the epilogue. Bison declarations section or the epilogue.
@xref{Grammar Layout, ,The Overall Layout of a Bison Grammar}. @xref{Grammar Layout, ,The Overall Layout of a Bison Grammar}.
@end deffn
@item %@{ %@} @c Don't insert spaces, or check the DVI output.
@deffn {Delimiter} %@{@var{code}%@}
All code listed between @samp{%@{} and @samp{%@}} is copied directly to All code listed between @samp{%@{} and @samp{%@}} is copied directly to
the output file uninterpreted. Such code forms the prologue of the input the output file uninterpreted. Such code forms the prologue of the input
file. @xref{Grammar Outline, ,Outline of a Bison file. @xref{Grammar Outline, ,Outline of a Bison
Grammar}. Grammar}.
@end deffn
@item /*@dots{}*/ @deffn {Construct} /*@dots{}*/
Comment delimiters, as in C. Comment delimiters, as in C.
@end deffn
@item : @deffn {Delimiter} :
Separates a rule's result from its components. @xref{Rules, ,Syntax of Separates a rule's result from its components. @xref{Rules, ,Syntax of
Grammar Rules}. Grammar Rules}.
@end deffn
@item ; @deffn {Delimiter} ;
Terminates a rule. @xref{Rules, ,Syntax of Grammar Rules}. Terminates a rule. @xref{Rules, ,Syntax of Grammar Rules}.
@end deffn
@item | @deffn {Delimiter} |
Separates alternate rules for the same result nonterminal. Separates alternate rules for the same result nonterminal.
@xref{Rules, ,Syntax of Grammar Rules}. @xref{Rules, ,Syntax of Grammar Rules}.
@end table @end deffn
@node Glossary @node Glossary
@appendix Glossary @appendix Glossary