samples, additional @group/@end group, GCS in samples.
Use @deffn instead of simple @table to define the directives,
macros, variables etc.
+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>
Fix some bugs reported by Albert Chin-A-Young in
<http://mail.gnu.org/pipermail/bug-bison/2002-November/001881.html>.
2002-11-13 Paul Eggert <eggert@twinsun.com>
Fix some bugs reported by Albert Chin-A-Young in
<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
-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".
* 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.
Instead, invoke "cc -c a.c -o a.o; cc -c b.c -o b.o; cc a.o b.o -o c".
responsibility to #define it away, just like 'const'.
This fixes one of the bugs reported by Nelson H.F. Beebe in
<http://mail.gnu.org/pipermail/bug-bison/2002-November/001873.html>.
responsibility to #define it away, just like 'const'.
This fixes one of the bugs reported by Nelson H.F. Beebe in
<http://mail.gnu.org/pipermail/bug-bison/2002-November/001873.html>.
* Makefile.maint (po-check): Scan .l and .y files instead of the
.c and the .h files that they generate. This fixes the bug
reported by Tim Van Holder in:
* Makefile.maint (po-check): Scan .l and .y files instead of the
.c and the .h files that they generate. This fixes the bug
reported by Tim Van Holder in:
- | exp '\n' @{ printf ("\t%.10g\n", $1); @}
+ | exp '\n' @{ printf ("\t%.10g\n", $1); @}
-exp: NUM @{ $$ = $1; @}
- | exp exp '+' @{ $$ = $1 + $2; @}
- | exp exp '-' @{ $$ = $1 - $2; @}
- | exp exp '*' @{ $$ = $1 * $2; @}
- | exp exp '/' @{ $$ = $1 / $2; @}
- /* Exponentiation */
- | exp exp '^' @{ $$ = pow ($1, $2); @}
- /* Unary minus */
- | exp 'n' @{ $$ = -$1; @}
+exp: NUM @{ $$ = $1; @}
+ | exp exp '+' @{ $$ = $1 + $2; @}
+ | exp exp '-' @{ $$ = $1 - $2; @}
+ | exp exp '*' @{ $$ = $1 * $2; @}
+ | exp exp '/' @{ $$ = $1 / $2; @}
+ /* Exponentiation */
+ | exp exp '^' @{ $$ = pow ($1, $2); @}
+ /* Unary minus */
+ | exp 'n' @{ $$ = -$1; @}
/* Skip white space. */
while ((c = getchar ()) == ' ' || c == '\t')
++yylloc.last_column;
/* Skip white space. */
while ((c = getchar ()) == ' ' || c == '\t')
++yylloc.last_column;
/* Step. */
yylloc.first_line = yylloc.last_line;
yylloc.first_column = yylloc.last_column;
/* Step. */
yylloc.first_line = yylloc.last_line;
yylloc.first_column = yylloc.last_column;
Here are the C and Bison declarations for the multi-function calculator.
@smallexample
Here are the C and Bison declarations for the multi-function calculator.
@smallexample
%@{
#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' */
-double val; /* For returning numbers. */
-symrec *tptr; /* For returning symbol-table pointers */
+ double val; /* For returning numbers. */
+ symrec *tptr; /* For returning symbol-table pointers. */
-
-%token <val> NUM /* Simple double precision number */
-%token <tptr> VAR FNCT /* Variable and Function */
+@end group
+%token <val> NUM /* Simple double precision number. */
+%token <tptr> VAR FNCT /* Variable and Function. */
%right '='
%left '-' '+'
%left '*' '/'
%left NEG /* Negation--unary minus */
%right '^' /* Exponentiation */
%right '='
%left '-' '+'
%left '*' '/'
%left NEG /* Negation--unary minus */
%right '^' /* Exponentiation */
/* Grammar follows */
%%
@end smallexample
/* Grammar follows */
%%
@end smallexample
those which mention @code{VAR} or @code{FNCT}, are new.
@smallexample
those which mention @code{VAR} or @code{FNCT}, are new.
@smallexample
input: /* empty */
| input line
;
input: /* empty */
| input line
;
line:
'\n'
| exp '\n' @{ printf ("\t%.10g\n", $1); @}
| error '\n' @{ yyerrok; @}
;
line:
'\n'
| exp '\n' @{ printf ("\t%.10g\n", $1); @}
| error '\n' @{ yyerrok; @}
;
exp: NUM @{ $$ = $1; @}
| VAR @{ $$ = $1->value.var; @}
| VAR '=' exp @{ $$ = $3; $1->value.var = $3; @}
exp: NUM @{ $$ = $1; @}
| VAR @{ $$ = $1->value.var; @}
| VAR '=' exp @{ $$ = $3; $1->value.var = $3; @}
| exp '^' exp @{ $$ = pow ($1, $3); @}
| '(' exp ')' @{ $$ = $2; @}
;
| exp '^' exp @{ $$ = pow ($1, $3); @}
| '(' exp ')' @{ $$ = $2; @}
;
/* End of grammar */
%%
@end smallexample
/* End of grammar */
%%
@end smallexample
@code{init_table} as well:
@smallexample
@code{init_table} as well:
@smallexample
@{
printf ("%s\n", s);
@}
@{
printf ("%s\n", s);
@}
struct init
@{
char *fname;
struct init
@{
char *fname;
/* The symbol table: a chain of `struct symrec'. */
symrec *sym_table = (symrec *) 0;
@end group
/* The symbol table: a chain of `struct symrec'. */
symrec *sym_table = (symrec *) 0;
@end group
@smallexample
@group
#include <ctype.h>
@smallexample
@group
#include <ctype.h>
if (i == length)
@{
length *= 2;
if (i == length)
@{
length *= 2;
- symbuf = (char *)realloc (symbuf, length + 1);
+ symbuf = (char *) realloc (symbuf, length + 1);
@}
/* Add this character to the buffer. */
symbuf[i++] = c;
@}
/* Add this character to the buffer. */
symbuf[i++] = c;
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
-@item %union
+@deffn {Directive} %union
Declare the collection of data types that semantic values may have
(@pxref{Union Decl, ,The Collection of Value Types}).
Declare the collection of data types that semantic values may have
(@pxref{Union Decl, ,The Collection of Value Types}).
+@deffn {Directive} %token
Declare a terminal symbol (token type name) with no precedence
or associativity specified (@pxref{Token Decl, ,Token Type Names}).
Declare a terminal symbol (token type name) with no precedence
or associativity specified (@pxref{Token Decl, ,Token Type Names}).
+@deffn {Directive} %right
Declare a terminal symbol (token type name) that is right-associative
(@pxref{Precedence Decl, ,Operator Precedence}).
Declare a terminal symbol (token type name) that is right-associative
(@pxref{Precedence Decl, ,Operator Precedence}).
+@deffn {Directive} %left
Declare a terminal symbol (token type name) that is left-associative
(@pxref{Precedence Decl, ,Operator Precedence}).
Declare a terminal symbol (token type name) that is left-associative
(@pxref{Precedence Decl, ,Operator Precedence}).
+@deffn {Directive} %nonassoc
Declare a terminal symbol (token type name) that is nonassociative
(using it in a way that would be associative is a syntax error)
Declare a terminal symbol (token type name) that is nonassociative
(using it in a way that would be associative is a syntax error)
(@pxref{Precedence Decl, ,Operator Precedence}).
(@pxref{Precedence Decl, ,Operator Precedence}).
+@deffn {Directive} %type
Declare the type of semantic values for a nonterminal symbol
(@pxref{Type Decl, ,Nonterminal Symbols}).
Declare the type of semantic values for a nonterminal symbol
(@pxref{Type Decl, ,Nonterminal Symbols}).
+@deffn {Directive} %start
Specify the grammar's start symbol (@pxref{Start Decl, ,The
Start-Symbol}).
Specify the grammar's start symbol (@pxref{Start Decl, ,The
Start-Symbol}).
+@deffn {Directive} %expect
Declare the expected number of shift-reduce conflicts
(@pxref{Expect Decl, ,Suppressing Conflict Warnings}).
Declare the expected number of shift-reduce conflicts
(@pxref{Expect Decl, ,Suppressing Conflict Warnings}).
@sp 1
@noindent
In order to change the behavior of @command{bison}, use the following
directives:
@sp 1
@noindent
In order to change the behavior of @command{bison}, use the following
directives:
-@table @code
-@item %debug
+@deffn {Directive} %debug
In the parser file, define the macro @code{YYDEBUG} to 1 if it is not
already defined, so that the debugging facilities are compiled.
In the parser file, define the macro @code{YYDEBUG} to 1 if it is not
already defined, so that the debugging facilities are compiled.
@xref{Tracing, ,Tracing Your Parser}.
@xref{Tracing, ,Tracing Your Parser}.
+@deffn {Directive} %defines
Write an extra output file containing macro definitions for the token
type names defined in the grammar and the semantic value type
@code{YYSTYPE}, as well as a few @code{extern} variable declarations.
Write an extra output file containing macro definitions for the token
type names defined in the grammar and the semantic value type
@code{YYSTYPE}, as well as a few @code{extern} variable declarations.
@code{yylex} in a separate source file, because @code{yylex} needs to
be able to refer to token type codes and the variable
@code{yylval}. @xref{Token Values, ,Semantic Values of Tokens}.
@code{yylex} in a separate source file, because @code{yylex} needs to
be able to refer to token type codes and the variable
@code{yylval}. @xref{Token Values, ,Semantic Values of Tokens}.
+@deffn {Directive} %destructor
Specifying how the parser should reclaim the memory associated to
discarded symbols. @xref{Destructor Decl, , Freeing Discarded Symbols}.
Specifying how the parser should reclaim the memory associated to
discarded symbols. @xref{Destructor Decl, , Freeing Discarded Symbols}.
-@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
chosen as if the input file were named @file{@var{prefix}.y}.
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 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
+@deffn {Directive} %locations
Generate the code processing the locations (@pxref{Action Features,
,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
grammar does not use it, using @samp{%locations} allows for more
accurate parse error messages.
Generate the code processing the locations (@pxref{Action Features,
,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
grammar does not use it, using @samp{%locations} allows for more
accurate parse error messages.
-@item %name-prefix="@var{prefix}"
+@deffn {Directive} %name-prefix="@var{prefix}"
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},
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},
@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}.
@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}.
+@deffn {Directive} %no-parser
Do not include any C code in the parser file; generate tables only. The
parser file contains just @code{#define} directives and static variable
declarations.
Do not include any C code in the parser file; generate tables only. The
parser file contains just @code{#define} directives and static variable
declarations.
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
brace-surrounded body fit for a @code{switch} statement.
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
brace-surrounded body fit for a @code{switch} statement.
+@deffn {Directive} %no-lines
Don't generate any @code{#line} preprocessor commands in the parser
file. Ordinarily Bison writes these commands in the parser file so that
the C compiler and debuggers will associate errors and object code with
your source file (the grammar file). This directive causes them to
associate errors with the parser file, treating it an independent source
file in its own right.
Don't generate any @code{#line} preprocessor commands in the parser
file. Ordinarily Bison writes these commands in the parser file so that
the C compiler and debuggers will associate errors and object code with
your source file (the grammar file). This directive causes them to
associate errors with the parser file, treating it an independent source
file in its own right.
-@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.
+@deffn {Directive} %pure-parser
Request a pure (reentrant) parser program (@pxref{Pure Decl, ,A Pure
(Reentrant) Parser}).
Request a pure (reentrant) parser program (@pxref{Pure Decl, ,A Pure
(Reentrant) Parser}).
-@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 named @file{foo.tab.cpp}
-
-@item %token-table
+@deffn {Directive} %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
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
@item YYNSTATES
The number of parser states (@pxref{Parser States}).
@end table
@item YYNSTATES
The number of parser states (@pxref{Parser States}).
@end table
+@deffn {Directive} %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
that state. @xref{Understanding, , Understanding Your Parser}, for more
information.
Write an extra output file containing verbose descriptions of the
parser states and what is done for each type of look-ahead token in
that state. @xref{Understanding, , Understanding Your Parser}, for more
information.
+@deffn {Directive} %yacc
Pretend the option @option{--yacc} was given, i.e., imitate Yacc,
including its naming conventions. @xref{Bison Options}, for more.
Pretend the option @option{--yacc} was given, i.e., imitate Yacc,
including its naming conventions. @xref{Bison Options}, for more.
Here is a table of Bison constructs, variables and macros that
are useful in actions.
Here is a table of Bison constructs, variables and macros that
are useful in actions.
Acts like a variable that contains the semantic value for the
grouping made by the current rule. @xref{Actions}.
Acts like a variable that contains the semantic value for the
grouping made by the current rule. @xref{Actions}.
+@deffn {Variable} $@var{n}
Acts like a variable that contains the semantic value for the
@var{n}th component of the current rule. @xref{Actions}.
Acts like a variable that contains the semantic value for the
@var{n}th component of the current rule. @xref{Actions}.
+@deffn {Variable} $<@var{typealt}>$
Like @code{$$} but specifies alternative @var{typealt} in the union
specified by the @code{%union} declaration. @xref{Action Types, ,Data
Types of Values in Actions}.
Like @code{$$} but specifies alternative @var{typealt} in the union
specified by the @code{%union} declaration. @xref{Action Types, ,Data
Types of Values in Actions}.
-@item $<@var{typealt}>@var{n}
+@deffn {Variable} $<@var{typealt}>@var{n}
Like @code{$@var{n}} but specifies alternative @var{typealt} in the
union specified by the @code{%union} declaration.
@xref{Action Types, ,Data Types of Values in Actions}.
Like @code{$@var{n}} but specifies alternative @var{typealt} in the
union specified by the @code{%union} declaration.
@xref{Action Types, ,Data Types of Values in Actions}.
Return immediately from @code{yyparse}, indicating failure.
@xref{Parser Function, ,The Parser Function @code{yyparse}}.
Return immediately from @code{yyparse}, indicating failure.
@xref{Parser Function, ,The Parser Function @code{yyparse}}.
+@deffn {Macro} YYACCEPT;
Return immediately from @code{yyparse}, indicating success.
@xref{Parser Function, ,The Parser Function @code{yyparse}}.
Return immediately from @code{yyparse}, indicating success.
@xref{Parser Function, ,The Parser Function @code{yyparse}}.
-@item YYBACKUP (@var{token}, @var{value});
+@deffn {Macro} YYBACKUP (@var{token}, @var{value});
@findex YYBACKUP
Unshift a token. This macro is allowed only for rules that reduce
a single value, and only when there is no look-ahead token.
@findex YYBACKUP
Unshift a token. This macro is allowed only for rules that reduce
a single value, and only when there is no look-ahead token.
recovery.
In either case, the rest of the action is not executed.
recovery.
In either case, the rest of the action is not executed.
@vindex YYEMPTY
Value stored in @code{yychar} when there is no look-ahead token.
@vindex YYEMPTY
Value stored in @code{yychar} when there is no look-ahead token.
@findex YYERROR
Cause an immediate syntax error. This statement initiates error
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
want to print an error message, call @code{yyerror} explicitly before
the @samp{YYERROR;} statement. @xref{Error Recovery}.
@findex YYERROR
Cause an immediate syntax error. This statement initiates error
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
want to print an error message, call @code{yyerror} explicitly before
the @samp{YYERROR;} statement. @xref{Error Recovery}.
+@deffn {Macro} YYRECOVERING
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.
@xref{Error Recovery}.
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.
@xref{Error Recovery}.
+@deffn {Variable} yychar
Variable containing the current look-ahead token. (In a pure parser,
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.
@xref{Look-Ahead, ,Look-Ahead Tokens}.
Variable containing the current look-ahead token. (In a pure parser,
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.
@xref{Look-Ahead, ,Look-Ahead Tokens}.
+@deffn {Macro} yyclearin;
Discard the current look-ahead token. This is useful primarily in
error rules. @xref{Error Recovery}.
Discard the current look-ahead token. This is useful primarily in
error rules. @xref{Error Recovery}.
Resume generating error messages immediately for subsequent syntax
errors. This is useful primarily in error rules.
@xref{Error Recovery}.
Resume generating error messages immediately for subsequent syntax
errors. This is useful primarily in error rules.
@xref{Error Recovery}.
@findex @@$
Acts like a structure variable containing information on the textual position
of the grouping made by the current rule. @xref{Locations, ,
@findex @@$
Acts like a structure variable containing information on the textual position
of the grouping made by the current rule. @xref{Locations, ,
@c those members.
@c The use of this feature makes the parser noticeably slower.
@c those members.
@c The use of this feature makes the parser noticeably slower.
+@deffn {Value} @@@var{n}
@findex @@@var{n}
Acts like a structure variable containing information on the textual position
of the @var{n}th component of the current rule. @xref{Locations, ,
Tracking Locations}.
@findex @@@var{n}
Acts like a structure variable containing information on the textual position
of the @var{n}th component of the current rule. @xref{Locations, ,
Tracking Locations}.
@node Algorithm
@chapter The Bison Parser Algorithm
@node Algorithm
@chapter The Bison Parser Algorithm
@cindex Bison symbols, table of
@cindex symbols in Bison, table of
@cindex Bison symbols, table of
@cindex symbols in Bison, table of
In an action, the location of the left-hand side of the rule.
@xref{Locations, , Locations Overview}.
In an action, the location of the left-hand side of the rule.
@xref{Locations, , Locations Overview}.
+@deffn {Variable} @@@var{n}
In an action, the location of the @var{n}-th symbol of the right-hand
side of the rule. @xref{Locations, , Locations Overview}.
In an action, the location of the @var{n}-th symbol of the right-hand
side of the rule. @xref{Locations, , Locations Overview}.
In an action, the semantic value of the left-hand side of the rule.
@xref{Actions}.
In an action, the semantic value of the left-hand side of the rule.
@xref{Actions}.
+@deffn {Variable} $@var{n}
In an action, the semantic value of the @var{n}-th symbol of the
right-hand side of the rule. @xref{Actions}.
In an action, the semantic value of the @var{n}-th symbol of the
right-hand side of the rule. @xref{Actions}.
The predefined nonterminal whose only rule is @samp{$accept: @var{start}
$end}, where @var{start} is the start symbol. @xref{Start Decl, , The
Start-Symbol}. It cannot be used in the grammar.
The predefined nonterminal whose only rule is @samp{$accept: @var{start}
$end}, where @var{start} is the start symbol. @xref{Start Decl, , The
Start-Symbol}. It cannot be used in the grammar.
The predefined token marking the end of the token stream. It cannot be
used in the grammar.
The predefined token marking the end of the token stream. It cannot be
used in the grammar.
+@deffn {Symbol} $undefined
The predefined token onto which all undefined values returned by
@code{yylex} are mapped. It cannot be used in the grammar, rather, use
@code{error}.
The predefined token onto which all undefined values returned by
@code{yylex} are mapped. It cannot be used in the grammar, rather, use
@code{error}.
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
the grammar without halting the process. In effect, a sentence
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
the grammar without halting the process. In effect, a sentence
corresponding to @code{error} are then executed, and the look-ahead
token is reset to the token that originally caused the violation.
@xref{Error Recovery}.
corresponding to @code{error} are then executed, and the look-ahead
token is reset to the token that originally caused the violation.
@xref{Error Recovery}.
Macro to pretend that an unrecoverable syntax error has occurred, by
making @code{yyparse} return 1 immediately. The error reporting
function @code{yyerror} is not called. @xref{Parser Function, ,The
Parser Function @code{yyparse}}.
Macro to pretend that an unrecoverable syntax error has occurred, by
making @code{yyparse} return 1 immediately. The error reporting
function @code{yyerror} is not called. @xref{Parser Function, ,The
Parser Function @code{yyparse}}.
Macro to pretend that a complete utterance of the language has been
read, by making @code{yyparse} return 0 immediately.
@xref{Parser Function, ,The Parser Function @code{yyparse}}.
Macro to pretend that a complete utterance of the language has been
read, by making @code{yyparse} return 0 immediately.
@xref{Parser Function, ,The Parser Function @code{yyparse}}.
Macro to discard a value from the parser stack and fake a look-ahead
token. @xref{Action Features, ,Special Features for Use in Actions}.
Macro to discard a value from the parser stack and fake a look-ahead
token. @xref{Action Features, ,Special Features for Use in Actions}.
Macro to define to equip the parser with tracing code. @xref{Tracing,
,Tracing Your Parser}.
Macro to define to equip the parser with tracing code. @xref{Tracing,
,Tracing Your Parser}.
Macro to pretend that a syntax error has just been detected: call
@code{yyerror} and then perform normal error recovery if possible
(@pxref{Error Recovery}), or (if recovery is impossible) make
@code{yyparse} return 1. @xref{Error Recovery}.
Macro to pretend that a syntax error has just been detected: call
@code{yyerror} and then perform normal error recovery if possible
(@pxref{Error Recovery}), or (if recovery is impossible) make
@code{yyparse} return 1. @xref{Error Recovery}.
+@deffn {Macro} YYERROR_VERBOSE
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.
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.
+@deffn {Macro} YYINITDEPTH
Macro for specifying the initial size of the parser stack.
@xref{Stack Overflow}.
Macro for specifying the initial size of the parser stack.
@xref{Stack Overflow}.
+@deffn {Macro} YYLEX_PARAM
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}.
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}.
Macro for the data type of @code{yylloc}; a structure with four
members. @xref{Location Type, , Data Types of Locations}.
Macro for the data type of @code{yylloc}; a structure with four
members. @xref{Location Type, , Data Types of Locations}.
Default value for YYLTYPE.
Default value for YYLTYPE.
-@item YYMAXDEPTH
-Macro for specifying the maximum size of the parser stack.
-@xref{Stack Overflow}.
+@deffn {Macro} YYMAXDEPTH
+Macro for specifying the maximum size of the parser stack. @xref{Stack
+Overflow}.
+@end deffn
+@deffn {Macro} YYPARSE_PARAM
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}.
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}.
+@deffn {Macro} YYRECOVERING
Macro whose value indicates whether the parser is recovering from a
syntax error. @xref{Action Features, ,Special Features for Use in Actions}.
Macro whose value indicates whether the parser is recovering from a
syntax error. @xref{Action Features, ,Special Features for Use in Actions}.
-@item YYSTACK_USE_ALLOCA
+@deffn {Macro} YYSTACK_USE_ALLOCA
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
grow its internal stacks. Do @emph{not} define @code{YYSTACK_USE_ALLOCA}
to anything else.
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
grow its internal stacks. Do @emph{not} define @code{YYSTACK_USE_ALLOCA}
to anything else.
Macro for the data type of semantic values; @code{int} by default.
@xref{Value Type, ,Data Types of Semantic Values}.
Macro for the data type of semantic values; @code{int} by default.
@xref{Value Type, ,Data Types of Semantic Values}.
+@deffn {Variable} yychar
External integer variable that contains the integer value of the current
look-ahead token. (In a pure parser, it is a local variable within
@code{yyparse}.) Error-recovery rule actions may examine this variable.
@xref{Action Features, ,Special Features for Use in Actions}.
External integer variable that contains the integer value of the current
look-ahead token. (In a pure parser, it is a local variable within
@code{yyparse}.) Error-recovery rule actions may examine this variable.
@xref{Action Features, ,Special Features for Use in Actions}.
+@deffn {Variable} yyclearin
Macro used in error-recovery rule actions. It clears the previous
look-ahead token. @xref{Error Recovery}.
Macro used in error-recovery rule actions. It clears the previous
look-ahead token. @xref{Error Recovery}.
+@deffn {Variable} yydebug
External integer variable set to zero by default. If @code{yydebug}
is given a nonzero value, the parser will output information on input
symbols and parser action. @xref{Tracing, ,Tracing Your Parser}.
External integer variable set to zero by default. If @code{yydebug}
is given a nonzero value, the parser will output information on input
symbols and parser action. @xref{Tracing, ,Tracing Your Parser}.
Macro to cause parser to recover immediately to its normal mode
after a parse error. @xref{Error Recovery}.
Macro to cause parser to recover immediately to its normal mode
after a parse error. @xref{Error Recovery}.
+@deffn {Function} yyerror
User-supplied function to be called by @code{yyparse} on error. The
function receives one argument, a pointer to a character string
containing an error message. @xref{Error Reporting, ,The Error
Reporting Function @code{yyerror}}.
User-supplied function to be called by @code{yyparse} on error. The
function receives one argument, a pointer to a character string
containing an error message. @xref{Error Reporting, ,The Error
Reporting Function @code{yyerror}}.
User-supplied lexical analyzer function, called with no arguments to get
the next token. @xref{Lexical, ,The Lexical Analyzer Function
@code{yylex}}.
User-supplied lexical analyzer function, called with no arguments to get
the next token. @xref{Lexical, ,The Lexical Analyzer Function
@code{yylex}}.
+@deffn {Variable} yylval
External variable in which @code{yylex} should place the semantic
value associated with a token. (In a pure parser, it is a local
variable within @code{yyparse}, and its address is passed to
@code{yylex}.) @xref{Token Values, ,Semantic Values of Tokens}.
External variable in which @code{yylex} should place the semantic
value associated with a token. (In a pure parser, it is a local
variable within @code{yyparse}, and its address is passed to
@code{yylex}.) @xref{Token Values, ,Semantic Values of Tokens}.
+@deffn {Variable} yylloc
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
variable within @code{yyparse}, and its address is passed to
@code{yylex}.) You can ignore this variable if you don't use the
@samp{@@} feature in the grammar actions. @xref{Token Positions,
,Textual Positions of Tokens}.
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
variable within @code{yyparse}, and its address is passed to
@code{yylex}.) You can ignore this variable if you don't use the
@samp{@@} feature in the grammar actions. @xref{Token Positions,
,Textual Positions of Tokens}.
+@deffn {Variable} yynerrs
Global variable which Bison increments each time there is a parse error.
(In a pure parser, it is a local variable within @code{yyparse}.)
@xref{Error Reporting, ,The Error Reporting Function @code{yyerror}}.
Global variable which Bison increments each time there is a parse error.
(In a pure parser, it is a local variable within @code{yyparse}.)
@xref{Error Reporting, ,The Error Reporting Function @code{yyerror}}.
+@deffn {Function} yyparse
The parser function produced by Bison; call this function to start
parsing. @xref{Parser Function, ,The Parser Function @code{yyparse}}.
The parser function produced by Bison; call this function to start
parsing. @xref{Parser Function, ,The Parser Function @code{yyparse}}.
+@deffn {Directive} %debug
Equip the parser for debugging. @xref{Decl Summary}.
Equip the parser for debugging. @xref{Decl Summary}.
+@deffn {Directive} %defines
Bison declaration to create a header file meant for the scanner.
@xref{Decl Summary}.
Bison declaration to create a header file meant for the scanner.
@xref{Decl Summary}.
+@deffn {Directive} %destructor
Specifying how the parser should reclaim the memory associated to
discarded symbols. @xref{Destructor Decl, , Freeing Discarded Symbols}.
Specifying how the parser should reclaim the memory associated to
discarded symbols. @xref{Destructor Decl, , Freeing Discarded Symbols}.
+@deffn {Directive} %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}.
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}.
+@deffn {Directive} %error-verbose
Bison declaration to request verbose, specific error message strings
when @code{yyerror} is called.
Bison declaration to request verbose, specific error message strings
when @code{yyerror} is called.
-@item %file-prefix="@var{prefix}"
+@deffn {Directive} %file-prefix="@var{prefix}"
Bison declaration to set the prefix of the output files. @xref{Decl
Summary}.
Bison declaration to set the prefix of the output files. @xref{Decl
Summary}.
+@deffn {Directive} %glr-parser
Bison declaration to produce a @acronym{GLR} parser. @xref{GLR
Parsers, ,Writing @acronym{GLR} Parsers}.
Bison declaration to produce a @acronym{GLR} parser. @xref{GLR
Parsers, ,Writing @acronym{GLR} Parsers}.
-@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 Bison declaration to specify the generated parser header file extension
-@c if required. @xref{Decl Summary}.
-
-@item %left
+@deffn {Directive} %left
Bison declaration to assign left associativity to token(s).
@xref{Precedence Decl, ,Operator Precedence}.
Bison declaration to assign left associativity to token(s).
@xref{Precedence Decl, ,Operator Precedence}.
-@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
@code{yylex} should accept. @xref{Pure Calling,, Calling Conventions
for Pure Parsers}.
Bison declaration to specifying an additional parameter that
@code{yylex} should accept. @xref{Pure Calling,, Calling Conventions
for Pure Parsers}.
+@deffn {Directive} %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
function is applied to the two semantic values to get a single result.
@xref{GLR Parsers, ,Writing @acronym{GLR} Parsers}.
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
function is applied to the two semantic values to get a single result.
@xref{GLR Parsers, ,Writing @acronym{GLR} Parsers}.
-@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}.
+@deffn {Directive} %no-lines
Bison declaration to avoid generating @code{#line} directives in the
parser file. @xref{Decl Summary}.
Bison declaration to avoid generating @code{#line} directives in the
parser file. @xref{Decl Summary}.
+@deffn {Directive} %nonassoc
Bison declaration to assign non-associativity to token(s).
@xref{Precedence Decl, ,Operator Precedence}.
Bison declaration to assign non-associativity to token(s).
@xref{Precedence Decl, ,Operator Precedence}.
-@item %output="@var{filename}"
+@deffn {Directive} %output="@var{filename}"
Bison declaration to set the name of the parser file. @xref{Decl
Summary}.
Bison declaration to set the name of the parser file. @xref{Decl
Summary}.
-@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
@code{yyparse} should accept. @xref{Parser Function,, The Parser
Function @code{yyparse}}.
Bison declaration to specifying an additional parameter that
@code{yyparse} should accept. @xref{Parser Function,, The Parser
Function @code{yyparse}}.
+@deffn {Directive} %prec
Bison declaration to assign a precedence to a specific rule.
@xref{Contextual Precedence, ,Context-Dependent Precedence}.
Bison declaration to assign a precedence to a specific rule.
@xref{Contextual Precedence, ,Context-Dependent Precedence}.
+@deffn {Directive} %pure-parser
Bison declaration to request a pure (reentrant) parser.
@xref{Pure Decl, ,A Pure (Reentrant) Parser}.
Bison declaration to request a pure (reentrant) parser.
@xref{Pure Decl, ,A Pure (Reentrant) Parser}.
+@deffn {Directive} %right
Bison declaration to assign right associativity to token(s).
@xref{Precedence Decl, ,Operator Precedence}.
Bison declaration to assign right associativity to token(s).
@xref{Precedence Decl, ,Operator Precedence}.
+@deffn {Directive} %start
Bison declaration to specify the start symbol. @xref{Start Decl, ,The
Start-Symbol}.
Bison declaration to specify the start symbol. @xref{Start Decl, ,The
Start-Symbol}.
+@deffn {Directive} %token
Bison declaration to declare token(s) without specifying precedence.
@xref{Token Decl, ,Token Type Names}.
Bison declaration to declare token(s) without specifying precedence.
@xref{Token Decl, ,Token Type Names}.
+@deffn {Directive} %token-table
Bison declaration to include a token name table in the parser file.
@xref{Decl Summary}.
Bison declaration to include a token name table in the parser file.
@xref{Decl Summary}.
+@deffn {Directive} %type
Bison declaration to declare nonterminals. @xref{Type Decl,
,Nonterminal Symbols}.
Bison declaration to declare nonterminals. @xref{Type Decl,
,Nonterminal Symbols}.
+@deffn {Directive} %union
Bison declaration to specify several possible data types for semantic
values. @xref{Union Decl, ,The Collection of Value Types}.
Bison declaration to specify several possible data types for semantic
values. @xref{Union Decl, ,The Collection of Value Types}.
@sp 1
These are the punctuation and delimiters used in Bison input:
@sp 1
These are the punctuation and delimiters used in Bison input:
Delimiter used to separate the grammar rule section from the
Bison declarations section or the epilogue.
@xref{Grammar Layout, ,The Overall Layout of a Bison Grammar}.
Delimiter used to separate the grammar rule section from the
Bison declarations section or the epilogue.
@xref{Grammar Layout, ,The Overall Layout of a Bison Grammar}.
+@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
the output file uninterpreted. Such code forms the prologue of the input
file. @xref{Grammar Outline, ,Outline of a Bison
Grammar}.
All code listed between @samp{%@{} and @samp{%@}} is copied directly to
the output file uninterpreted. Such code forms the prologue of the input
file. @xref{Grammar Outline, ,Outline of a Bison
Grammar}.
+@deffn {Construct} /*@dots{}*/
Comment delimiters, as in C.
Comment delimiters, as in C.
Separates a rule's result from its components. @xref{Rules, ,Syntax of
Grammar Rules}.
Separates a rule's result from its components. @xref{Rules, ,Syntax of
Grammar Rules}.
Terminates a rule. @xref{Rules, ,Syntax of Grammar Rules}.
Terminates a rule. @xref{Rules, ,Syntax of Grammar Rules}.
Separates alternate rules for the same result nonterminal.
@xref{Rules, ,Syntax of Grammar Rules}.
Separates alternate rules for the same result nonterminal.
@xref{Rules, ,Syntax of Grammar Rules}.
@node Glossary
@appendix Glossary
@node Glossary
@appendix Glossary