bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: begin cleaning up the manual for 2.5


From: Joel E. Denny
Subject: Re: begin cleaning up the manual for 2.5
Date: Sun, 13 Feb 2011 12:19:23 -0500 (EST)
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)

On Sat, 12 Feb 2011, Joel E. Denny wrote:

> Below is a series of patches that begin to clean up the manual.  I wrote 
> them for branch-2.5.  I haven't pushed yet.  I still need to prepare 
> similar patches for master.

Here are the patches for master.  There are only a few differences from 
the branch-2.5 patches, and I've added another patch that's specific to 
master.  I haven't pushed any of it yet.

>From af28d414f3672ee94a85612e49930d40624bc33d Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Sun, 6 Feb 2011 08:52:09 -0500
Subject: [PATCH 1/7] doc: document experimental features better.

* doc/bison.texinfo (Introduction): Say that IELR(1) and canonical
LR(1) are experimental.  Mention Java.  Normally experimental
features probably shouldn't be mentioned in the introduction.
However, if Bison's limitations to LALR(1), C, and C++ are so
important that they should be mentioned here, then it's important
to point out that Bison is beginning to escape those limitations.
Moreover, these particular experimental features have very little
chance of being removed.
* src/getargs.c (usage): Say that IELR(1) and canonical LR(1) are
experimental.
(cherry picked from commit d89e48b3c9e857aa6d34f0bc66c9d9ac305f1b0c)
---
 ChangeLog         |   14 ++++++++++++++
 doc/bison.texinfo |   36 +++++++++++++++++++-----------------
 src/getargs.c     |    3 ++-
 3 files changed, 35 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3249635..ad3fcec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2011-02-06  Joel E. Denny  <address@hidden>
+
+       doc: document experimental features better.
+       * doc/bison.texinfo (Introduction): Say that IELR(1) and canonical
+       LR(1) are experimental.  Mention Java.  Normally experimental
+       features probably shouldn't be mentioned in the introduction.
+       However, if Bison's limitations to LALR(1), C, and C++ are so
+       important that they should be mentioned here, then it's important
+       to point out that Bison is beginning to escape those limitations.
+       Moreover, these particular experimental features have very little
+       chance of being removed.
+       * src/getargs.c (usage): Say that IELR(1) and canonical LR(1) are
+       experimental.
+
 2011-01-29  Joel E. Denny  <address@hidden>
 
        Do not allow identifiers that start with a dash.
diff --git a/doc/bison.texinfo b/doc/bison.texinfo
index 8b96ad9..5c75a12 100644
--- a/doc/bison.texinfo
+++ b/doc/bison.texinfo
@@ -353,23 +353,25 @@ Copying This Manual
 @cindex introduction
 
 @dfn{Bison} is a general-purpose parser generator that converts an
-annotated context-free grammar into a deterministic LR or
-generalized LR (GLR) parser employing
-LALR(1), IELR(1), or canonical LR(1)
-parser tables.
-Once you are proficient with Bison, you can use it to develop a wide
-range of language parsers, from those used in simple desk calculators to
-complex programming languages.
-
-Bison is upward compatible with Yacc: all properly-written Yacc grammars
-ought to work with Bison with no change.  Anyone familiar with Yacc
-should be able to use Bison with little trouble.  You need to be fluent in
-C or C++ programming in order to use Bison or to understand this manual.
-
-We begin with tutorial chapters that explain the basic concepts of using
-Bison and show three explained examples, each building on the last.  If you
-don't know Bison or Yacc, start by reading these chapters.  Reference
-chapters follow which describe specific aspects of Bison in detail.
+annotated context-free grammar into a deterministic LR or generalized
+LR (GLR) parser employing LALR(1) parser tables.  As an experimental
+feature, Bison can also generate IELR(1) or canonical LR(1) parser
+tables.  Once you are proficient with Bison, you can use it to develop
+a wide range of language parsers, from those used in simple desk
+calculators to complex programming languages.
+
+Bison is upward compatible with Yacc: all properly-written Yacc
+grammars ought to work with Bison with no change.  Anyone familiar
+with Yacc should be able to use Bison with little trouble.  You need
+to be fluent in C or C++ programming in order to use Bison or to
+understand this manual.  Java is also supported as an experimental
+feature.
+
+We begin with tutorial chapters that explain the basic concepts of
+using Bison and show three explained examples, each building on the
+last.  If you don't know Bison or Yacc, start by reading these
+chapters.  Reference chapters follow, which describe specific aspects
+of Bison in detail.
 
 Bison was written primarily by Robert Corbett; Richard Stallman made it
 Yacc-compatible.  Wilfred Hansen of Carnegie Mellon University added
diff --git a/src/getargs.c b/src/getargs.c
index ab9a2b5..35b6a2a 100644
--- a/src/getargs.c
+++ b/src/getargs.c
@@ -263,7 +263,8 @@ usage (int status)
       printf (_("Usage: %s [OPTION]... FILE\n"), program_name);
       fputs (_("\
 Generate a deterministic LR or generalized LR (GLR) parser employing\n\
-LALR(1), IELR(1), or canonical LR(1) parser tables.\n\
+LALR(1), IELR(1), or canonical LR(1) parser tables.  IELR(1) and\n\
+canonical LR(1) support is experimental.\n\
 \n\
 "), stdout);
 
-- 
1.7.0.4


>From 679e9935fd9f28545e3dfaa222f99ed294291171 Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Sun, 6 Feb 2011 08:59:05 -0500
Subject: [PATCH 2/7] doc: give credit to more of Bison's developers.

* doc/bison.texinfo (Introduction): Don't imply that only Robert
Corbett, Richard Stallman, and Wilfred Hansen have contributed to
Bison.  However, I don't have time to write a full history, so
just point readers to THANKS and ChangeLog.
(cherry picked from commit 840341d67d779107373c42d879ea14518751d7df)
---
 ChangeLog         |    8 ++++++++
 doc/bison.texinfo |   12 ++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ad3fcec..0dcd1ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2011-02-06  Joel E. Denny  <address@hidden>
 
+       doc: give credit to more of Bison's developers.
+       * doc/bison.texinfo (Introduction): Don't imply that only Robert
+       Corbett, Richard Stallman, and Wilfred Hansen have contributed to
+       Bison.  However, I don't have time to write a full history, so
+       just point readers to THANKS and ChangeLog.
+
+2011-02-06  Joel E. Denny  <address@hidden>
+
        doc: document experimental features better.
        * doc/bison.texinfo (Introduction): Say that IELR(1) and canonical
        LR(1) are experimental.  Mention Java.  Normally experimental
diff --git a/doc/bison.texinfo b/doc/bison.texinfo
index 5c75a12..0d46fab 100644
--- a/doc/bison.texinfo
+++ b/doc/bison.texinfo
@@ -373,9 +373,13 @@ last.  If you don't know Bison or Yacc, start by reading 
these
 chapters.  Reference chapters follow, which describe specific aspects
 of Bison in detail.
 
-Bison was written primarily by Robert Corbett; Richard Stallman made it
-Yacc-compatible.  Wilfred Hansen of Carnegie Mellon University added
-multi-character string literals and other features.
+Bison was written originally by Robert Corbett.  Richard Stallman made
+it Yacc-compatible.  Wilfred Hansen of Carnegie Mellon University
+added multi-character string literals and other features.  Since then,
+Bison has grown more robust and evolved many other new features thanks
+to the hard work of a long list of volunteers.  For details, see the
address@hidden and @file{ChangeLog} files included in the Bison
+distribution.
 
 This edition corresponds to version @value{VERSION} of Bison.
 
@@ -11525,7 +11529,7 @@ grammatically indivisible.  The piece of text it 
represents is a token.
 @c LocalWords: superclasses boolean getErrorVerbose setErrorVerbose deftypecv
 @c LocalWords: getDebugStream setDebugStream getDebugLevel setDebugLevel url
 @c LocalWords: bisonVersion deftypecvx bisonSkeleton getStartPos getEndPos
address@hidden LocalWords: getLVal defvar deftypefn deftypefnx gotos msgfmt
address@hidden LocalWords: getLVal defvar deftypefn deftypefnx gotos msgfmt 
Corbett
 @c LocalWords: subdirectory Solaris nonassociativity
 
 @c Local Variables:
-- 
1.7.0.4


>From ff7571c04d7462a90c32b219db97313e0584cc3e Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Sun, 6 Feb 2011 11:08:27 -0500
Subject: [PATCH 3/7] doc: clean up naming of various Bison files.

The Bison manual's names for various files associated with a Bison
parser has devolved into inconsistency.  This patch makes the
naming consistent for the most important files.  First, it chooses
"grammar file" over "input file".  The former appears to be more
traditional in the Bison manual, and Bison has other input
files (skeletons).  Second, it chooses "parser implementation
file" over names like "parser file", "parser source file", "parser
source code file", and "parser output file".  The new name makes
it clearer where Bison generates the main parser implementation,
and it is easily distinguishable from "parser header file".
* doc/bison.texinfo: Implement throughout.
(cherry picked from commit 9913d6e45af4106cae7bb3a978eb1ee2501f1168)

Conflicts:

        doc/bison.texinfo
---
 ChangeLog         |   15 ++
 doc/bison.texinfo |  612 +++++++++++++++++++++++++++--------------------------
 2 files changed, 326 insertions(+), 301 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0dcd1ed..e19e959 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
 2011-02-06  Joel E. Denny  <address@hidden>
 
+       doc: clean up naming of various Bison files.
+       The Bison manual's names for various files associated with a Bison
+       parser has devolved into inconsistency.  This patch makes the
+       naming consistent for the most important files.  First, it chooses
+       "grammar file" over "input file".  The former appears to be more
+       traditional in the Bison manual, and Bison has other input
+       files (skeletons).  Second, it chooses "parser implementation
+       file" over names like "parser file", "parser source file", "parser
+       source code file", and "parser output file".  The new name makes
+       it clearer where Bison generates the main parser implementation,
+       and it is easily distinguishable from "parser header file".
+       * doc/bison.texinfo: Implement throughout.
+
+2011-02-06  Joel E. Denny  <address@hidden>
+
        doc: give credit to more of Bison's developers.
        * doc/bison.texinfo (Introduction): Don't imply that only Robert
        Corbett, Richard Stallman, and Wilfred Hansen have contributed to
diff --git a/doc/bison.texinfo b/doc/bison.texinfo
index 0d46fab..c816160 100644
--- a/doc/bison.texinfo
+++ b/doc/bison.texinfo
@@ -103,7 +103,7 @@ Reference sections:
 * Context Dependency::  What to do if your language syntax is too
                           messy for Bison to handle straightforwardly.
 * Debugging::           Understanding or debugging Bison parsers.
-* Invocation::          How to run Bison (to produce the parser source file).
+* Invocation::          How to run Bison (to produce the parser 
implementation).
 * Other Languages::     Creating C++ and Java parsers.
 * FAQ::                 Frequently Asked Questions
 * Table of Symbols::    All the keywords of the Bison language are explained.
@@ -399,12 +399,12 @@ software.  The reason Bison was different was not due to 
a special
 policy decision; it resulted from applying the usual General Public
 License to all of the Bison source code.
 
-The output of the Bison utility---the Bison parser file---contains a
-verbatim copy of a sizable piece of Bison, which is the code for the
-parser's implementation.  (The actions from your grammar are inserted
-into this implementation at one point, but most of the rest of the
-implementation is not changed.)  When we applied the GPL
-terms to the skeleton code for the parser's implementation,
+The main output of the Bison utility---the Bison parser implementation
+file---contains a verbatim copy of a sizable piece of Bison, which is
+the code for the parser's implementation.  (The actions from your
+grammar are inserted into this implementation at one point, but most
+of the rest of the implementation is not changed.)  When we applied
+the GPL terms to the skeleton code for the parser's implementation,
 the effect was to restrict the use of Bison output to free software.
 
 We didn't change the terms because of sympathy for people who want to
@@ -922,8 +922,8 @@ type t = (a) .. b;
 @end example
 
 The parser can be turned into a GLR parser, while also telling Bison
-to be silent about the one known reduce/reduce conflict, by
-adding these two declarations to the Bison input file (before the first
+to be silent about the one known reduce/reduce conflict, by adding
+these two declarations to the Bison grammar file (before the first
 @samp{%%}):
 
 @example
@@ -1299,18 +1299,20 @@ grouping, the default behavior of the output parser is 
to take the beginning
 of the first symbol, and the end of the last symbol.
 
 @node Bison Parser
address@hidden Bison Output: the Parser File
address@hidden Bison Output: the Parser Implementation File
 @cindex Bison parser
 @cindex Bison utility
 @cindex lexical analyzer, purpose
 @cindex parser
 
-When you run Bison, you give it a Bison grammar file as input.  The output
-is a C source file that parses the language described by the grammar.
-This file is called a @dfn{Bison parser}.  Keep in mind that the Bison
-utility and the Bison parser are two distinct programs: the Bison utility
-is a program whose output is the Bison parser that becomes part of your
-program.
+When you run Bison, you give it a Bison grammar file as input.  The
+most important output is a C source file that implements a parser for
+the language described by the grammar.  This parser is called a
address@hidden parser}, and this file is called a @dfn{Bison parser
+implementation file}.  Keep in mind that the Bison utility and the
+Bison parser are two distinct programs: the Bison utility is a program
+whose output is the Bison parser implementation file that becomes part
+of your program.
 
 The job of the Bison parser is to group tokens into groupings according to
 the grammar rules---for example, to build identifiers and operators into
@@ -1325,36 +1327,37 @@ may reflect this).  Typically the lexical analyzer 
makes the tokens by
 parsing characters of text, but Bison does not depend on this.
 @xref{Lexical, ,The Lexical Analyzer Function @code{yylex}}.
 
-The Bison parser file is C code which defines a function named
address@hidden which implements that grammar.  This function does not make
-a complete C program: you must supply some additional functions.  One is
-the lexical analyzer.  Another is an error-reporting function which the
-parser calls to report an error.  In addition, a complete C program must
-start with a function called @code{main}; you have to provide this, and
-arrange for it to call @code{yyparse} or the parser will never run.
address@hidden, ,Parser C-Language Interface}.
+The Bison parser implementation file is C code which defines a
+function named @code{yyparse} which implements that grammar.  This
+function does not make a complete C program: you must supply some
+additional functions.  One is the lexical analyzer.  Another is an
+error-reporting function which the parser calls to report an error.
+In addition, a complete C program must start with a function called
address@hidden; you have to provide this, and arrange for it to call
address@hidden or the parser will never run.  @xref{Interface, ,Parser
+C-Language Interface}.
 
 Aside from the token type names and the symbols in the actions you
-write, all symbols defined in the Bison parser file itself
-begin with @samp{yy} or @samp{YY}.  This includes interface functions
-such as the lexical analyzer function @code{yylex}, the error reporting
-function @code{yyerror} and the parser function @code{yyparse} itself.
-This also includes numerous identifiers used for internal purposes.
-Therefore, you should avoid using C identifiers starting with @samp{yy}
-or @samp{YY} in the Bison grammar file except for the ones defined in
-this manual.  Also, you should avoid using the C identifiers
address@hidden and @samp{free} for anything other than their usual
-meanings.
-
-In some cases the Bison parser file includes system headers, and in
-those cases your code should respect the identifiers reserved by those
-headers.  On some non-GNU hosts, @code{<alloca.h>}, @code{<malloc.h>},
address@hidden<stddef.h>}, and @code{<stdlib.h>} are included as needed to
-declare memory allocators and related types.  @code{<libintl.h>} is
-included if message translation is in use
-(@pxref{Internationalization}).  Other system headers may
-be included if you define @code{YYDEBUG} to a nonzero value
-(@pxref{Tracing, ,Tracing Your Parser}).
+write, all symbols defined in the Bison parser implementation file
+itself begin with @samp{yy} or @samp{YY}.  This includes interface
+functions such as the lexical analyzer function @code{yylex}, the
+error reporting function @code{yyerror} and the parser function
address@hidden itself.  This also includes numerous identifiers used
+for internal purposes.  Therefore, you should avoid using C
+identifiers starting with @samp{yy} or @samp{YY} in the Bison grammar
+file except for the ones defined in this manual.  Also, you should
+avoid using the C identifiers @samp{malloc} and @samp{free} for
+anything other than their usual meanings.
+
+In some cases the Bison parser implementation file includes system
+headers, and in those cases your code should respect the identifiers
+reserved by those headers.  On some non-GNU hosts, @code{<alloca.h>},
address@hidden<malloc.h>}, @code{<stddef.h>}, and @code{<stdlib.h>} are
+included as needed to declare memory allocators and related types.
address@hidden<libintl.h>} is included if message translation is in use
+(@pxref{Internationalization}).  Other system headers may be included
+if you define @code{YYDEBUG} to a nonzero value (@pxref{Tracing,
+,Tracing Your Parser}).
 
 @node Stages
 @section Stages in Using Bison
@@ -1484,7 +1487,7 @@ provides a good starting point, since operator precedence 
is not an issue.
 The second example will illustrate how operator precedence is handled.
 
 The source code for this calculator is named @file{rpcalc.y}.  The
address@hidden extension is a convention used for Bison input files.
address@hidden extension is a convention used for Bison grammar files.
 
 @menu
 * Rpcalc Declarations::    Prologue (declarations) for rpcalc.
@@ -1848,34 +1851,35 @@ real calculator, but it is adequate for the first 
example.
 
 Before running Bison to produce a parser, we need to decide how to
 arrange all the source code in one or more source files.  For such a
-simple example, the easiest thing is to put everything in one file.  The
-definitions of @code{yylex}, @code{yyerror} and @code{main} go at the
-end, in the epilogue of the file
+simple example, the easiest thing is to put everything in one file,
+the grammar file.  The definitions of @code{yylex}, @code{yyerror} and
address@hidden go at the end, in the epilogue of the grammar file
 (@pxref{Grammar Layout, ,The Overall Layout of a Bison Grammar}).
 
 For a large project, you would probably have several source files, and use
 @code{make} to arrange to recompile them.
 
-With all the source in a single file, you use the following command to
-convert it into a parser file:
+With all the source in the grammar file, you use the following command
+to convert it into a parser implementation file:
 
 @example
 bison @var{file}.y
 @end example
 
 @noindent
-In this example the file was called @file{rpcalc.y} (for ``Reverse Polish
address@hidden'').  Bison produces a file named @address@hidden,
-removing the @samp{.y} from the original file name.  The file output by
-Bison contains the source code for @code{yyparse}.  The additional
-functions in the input file (@code{yylex}, @code{yyerror} and @code{main})
-are copied verbatim to the output.
+In this example, the grammar file is called @file{rpcalc.y} (for
+``Reverse Polish @sc{calc}ulator'').  Bison produces a parser
+implementation file named @address@hidden, removing the
address@hidden from the grammar file name.  The parser implementation file
+contains the source code for @code{yyparse}.  The additional functions
+in the grammar file (@code{yylex}, @code{yyerror} and @code{main}) are
+copied verbatim to the parser implementation file.
 
 @node Rpcalc Compile
address@hidden Compiling the Parser File
address@hidden Compiling the Parser Implementation File
 @cindex compiling the parser
 
-Here is how to compile and run the parser file:
+Here is how to compile and run the parser implementation file:
 
 @example
 @group
@@ -2678,7 +2682,7 @@ uninitialized variable in any way except to store a value 
in it.
 Bison takes as input a context-free grammar specification and produces a
 C-language function that recognizes correct instances of the grammar.
 
-The Bison grammar input file conventionally has a name ending in @samp{.y}.
+The Bison grammar file conventionally has a name ending in @samp{.y}.
 @xref{Invocation, ,Invoking Bison}.
 
 @menu
@@ -2732,10 +2736,10 @@ continues until end of line.
 
 The @var{Prologue} section contains macro definitions and declarations
 of functions and variables that are used in the actions in the grammar
-rules.  These are copied to the beginning of the parser file so that
-they precede the definition of @code{yyparse}.  You can use
address@hidden to get the declarations from a header file.  If you
-don't need any C declarations, you may omit the @address@hidden and
+rules.  These are copied to the beginning of the parser implementation
+file so that they precede the definition of @code{yyparse}.  You can
+use @samp{#include} to get the declarations from a header file.  If
+you don't need any C declarations, you may omit the @address@hidden and
 @address@hidden delimiters that bracket this section.
 
 The @var{Prologue} section is terminated by the first occurrence
@@ -2787,13 +2791,12 @@ feature test macros can affect the behavior of 
Bison-generated
 @findex %code top
 
 The functionality of @var{Prologue} sections can often be subtle and
-inflexible.
-As an alternative, Bison provides a %code directive with an explicit qualifier
-field, which identifies the purpose of the code and thus the location(s) where
-Bison should generate it.
-For C/C++, the qualifier can be omitted for the default location, or it can be
-one of @code{requires}, @code{provides}, @code{top}.
address@hidden Summary,,%code}.
+inflexible.  As an alternative, Bison provides a @code{%code}
+directive with an explicit qualifier field, which identifies the
+purpose of the code and thus the location(s) where Bison should
+generate it.  For C/C++, the qualifier can be omitted for the default
+location, or it can be one of @code{requires}, @code{provides},
address@hidden  @xref{Decl Summary,,%code}.
 
 Look again at the example of the previous section:
 
@@ -2818,17 +2821,16 @@ Look again at the example of the previous section:
 @end smallexample
 
 @noindent
-Notice that there are two @var{Prologue} sections here, but there's a subtle
-distinction between their functionality.
-For example, if you decide to override Bison's default definition for
address@hidden, in which @var{Prologue} section should you write your new
-definition?
-You should write it in the first since Bison will insert that code into the
-parser source code file @emph{before} the default @code{YYLTYPE} definition.
-In which @var{Prologue} section should you prototype an internal function,
address@hidden, that accepts @code{YYLTYPE} and @code{yytokentype} as
-arguments?
-You should prototype it in the second since Bison will insert that code
+Notice that there are two @var{Prologue} sections here, but there's a
+subtle distinction between their functionality.  For example, if you
+decide to override Bison's default definition for @code{YYLTYPE}, in
+which @var{Prologue} section should you write your new definition?
+You should write it in the first since Bison will insert that code
+into the parser implementation file @emph{before} the default
address@hidden definition.  In which @var{Prologue} section should you
+prototype an internal function, @code{trace_token}, that accepts
address@hidden and @code{yytokentype} as arguments?  You should
+prototype it in the second since Bison will insert that code
 @emph{after} the @code{YYLTYPE} and @code{yytokentype} definitions.
 
 This distinction in functionality between the two @var{Prologue} sections is
@@ -2885,16 +2887,16 @@ functionality as the two kinds of @var{Prologue} 
sections, but it's always
 explicit which kind you intend.
 Moreover, both kinds are always available even in the absence of @code{%union}.
 
-The @code{%code top} block above logically contains two parts.
-The first two lines before the warning need to appear near the top of the
-parser source code file.
-The first line after the warning is required by @code{YYSTYPE} and thus also
-needs to appear in the parser source code file.
-However, if you've instructed Bison to generate a parser header file
-(@pxref{Decl Summary, ,%defines}), you probably want that line to appear before
-the @code{YYSTYPE} definition in that header file as well.
-The @code{YYLTYPE} definition should also appear in the parser header file to
-override the default @code{YYLTYPE} definition there.
+The @code{%code top} block above logically contains two parts.  The
+first two lines before the warning need to appear near the top of the
+parser implementation file.  The first line after the warning is
+required by @code{YYSTYPE} and thus also needs to appear in the parser
+implementation file.  However, if you've instructed Bison to generate
+a parser header file (@pxref{Decl Summary, ,%defines}), you probably
+want that line to appear before the @code{YYSTYPE} definition in that
+header file as well.  The @code{YYLTYPE} definition should also appear
+in the parser header file to override the default @code{YYLTYPE}
+definition there.
 
 In other words, in the @code{%code top} block above, all but the first two
 lines are dependency code required by the @code{YYSTYPE} and @code{YYLTYPE}
@@ -2937,35 +2939,36 @@ Thus, they belong in one or more @code{%code requires}:
 @end smallexample
 
 @noindent
-Now Bison will insert @code{#include "ptypes.h"} and the new @code{YYLTYPE}
-definition before the Bison-generated @code{YYSTYPE} and @code{YYLTYPE}
-definitions in both the parser source code file and the parser header file.
-(By the same reasoning, @code{%code requires} would also be the appropriate
-place to write your own definition for @code{YYSTYPE}.)
-
-When you are writing dependency code for @code{YYSTYPE} and @code{YYLTYPE}, you
-should prefer @code{%code requires} over @code{%code top} regardless of whether
-you instruct Bison to generate a parser header file.
-When you are writing code that you need Bison to insert only into the parser
-source code file and that has no special need to appear at the top of that
-file, you should prefer the unqualified @code{%code} over @code{%code top}.
-These practices will make the purpose of each block of your code explicit to
-Bison and to other developers reading your grammar file.
-Following these practices, we expect the unqualified @code{%code} and
address@hidden requires} to be the most important of the four @var{Prologue}
+Now Bison will insert @code{#include "ptypes.h"} and the new
address@hidden definition before the Bison-generated @code{YYSTYPE}
+and @code{YYLTYPE} definitions in both the parser implementation file
+and the parser header file.  (By the same reasoning, @code{%code
+requires} would also be the appropriate place to write your own
+definition for @code{YYSTYPE}.)
+
+When you are writing dependency code for @code{YYSTYPE} and
address@hidden, you should prefer @code{%code requires} over
address@hidden top} regardless of whether you instruct Bison to generate
+a parser header file.  When you are writing code that you need Bison
+to insert only into the parser implementation file and that has no
+special need to appear at the top of that file, you should prefer the
+unqualified @code{%code} over @code{%code top}.  These practices will
+make the purpose of each block of your code explicit to Bison and to
+other developers reading your grammar file.  Following these
+practices, we expect the unqualified @code{%code} and @code{%code
+requires} to be the most important of the four @var{Prologue}
 alternatives.
 
-At some point while developing your parser, you might decide to provide
address@hidden to modules that are external to your parser.
-Thus, you might wish for Bison to insert the prototype into both the parser
-header file and the parser source code file.
-Since this function is not a dependency required by @code{YYSTYPE} or
+At some point while developing your parser, you might decide to
+provide @code{trace_token} to modules that are external to your
+parser.  Thus, you might wish for Bison to insert the prototype into
+both the parser header file and the parser implementation file.  Since
+this function is not a dependency required by @code{YYSTYPE} or
 @code{YYLTYPE}, it doesn't make sense to move its prototype to a
address@hidden requires}.
-More importantly, since it depends upon @code{YYLTYPE} and @code{yytokentype},
address@hidden requires} is not sufficient.
-Instead, move its prototype from the unqualified @code{%code} to a
address@hidden provides}:
address@hidden requires}.  More importantly, since it depends upon
address@hidden and @code{yytokentype}, @code{%code requires} is not
+sufficient.  Instead, move its prototype from the unqualified
address@hidden to a @code{%code provides}:
 
 @smallexample
 %code top @{
@@ -3006,17 +3009,18 @@ Instead, move its prototype from the unqualified 
@code{%code} to a
 @end smallexample
 
 @noindent
-Bison will insert the @code{trace_token} prototype into both the parser header
-file and the parser source code file after the definitions for
address@hidden, @code{YYLTYPE}, and @code{YYSTYPE}.
+Bison will insert the @code{trace_token} prototype into both the
+parser header file and the parser implementation file after the
+definitions for @code{yytokentype}, @code{YYLTYPE}, and
address@hidden
 
-The above examples are careful to write directives in an order that reflects
-the layout of the generated parser source code and header files:
address@hidden top}, @code{%code requires}, @code{%code provides}, and then
address@hidden
-While your grammar files may generally be easier to read if you also follow
-this order, Bison does not require it.
-Instead, Bison lets you choose an organization that makes sense to you.
+The above examples are careful to write directives in an order that
+reflects the layout of the generated parser implementation and header
+files: @code{%code top}, @code{%code requires}, @code{%code provides},
+and then @code{%code}.  While your grammar files may generally be
+easier to read if you also follow this order, Bison does not require
+it.  Instead, Bison lets you choose an organization that makes sense
+to you.
 
 You may declare any of these directives multiple times in the grammar file.
 In that case, Bison concatenates the contained code in declaration order.
@@ -3089,15 +3093,16 @@ if it is the first thing in the file.
 @cindex epilogue
 @cindex C code, section for additional
 
-The @var{Epilogue} is copied verbatim to the end of the parser file, just as
-the @var{Prologue} is copied to the beginning.  This is the most convenient
-place to put anything that you want to have in the parser file but which need
-not come before the definition of @code{yyparse}.  For example, the
-definitions of @code{yylex} and @code{yyerror} often go here.  Because
-C requires functions to be declared before being used, you often need
-to declare functions like @code{yylex} and @code{yyerror} in the Prologue,
-even if you define them in the Epilogue.
address@hidden, ,Parser C-Language Interface}.
+The @var{Epilogue} is copied verbatim to the end of the parser
+implementation file, just as the @var{Prologue} is copied to the
+beginning.  This is the most convenient place to put anything that you
+want to have in the parser implementation file but which need not come
+before the definition of @code{yyparse}.  For example, the definitions
+of @code{yylex} and @code{yyerror} often go here.  Because C requires
+functions to be declared before being used, you often need to declare
+functions like @code{yylex} and @code{yyerror} in the Prologue, even
+if you define them in the Epilogue.  @xref{Interface, ,Parser
+C-Language Interface}.
 
 If the last section is empty, you may omit the @samp{%%} that separates it
 from the grammar rules.
@@ -3216,10 +3221,10 @@ for a character token type is simply the positive 
numeric code of the
 character, so @code{yylex} can use the identical value to generate the
 requisite code, though you may need to convert it to @code{unsigned
 char} to avoid sign-extension on hosts where @code{char} is signed.
-Each named token type becomes a C macro in
-the parser file, so @code{yylex} can use the name to stand for the code.
-(This is why periods don't make sense in terminal symbols.)
address@hidden Convention, ,Calling Convention for @code{yylex}}.
+Each named token type becomes a C macro in the parser implementation
+file, so @code{yylex} can use the name to stand for the code.  (This
+is why periods don't make sense in terminal symbols.)  @xref{Calling
+Convention, ,Calling Convention for @code{yylex}}.
 
 If @code{yylex} is defined in a separate file, you need to arrange for the
 token-type macro definitions to be available there.  Use the @samp{-d}
@@ -3304,7 +3309,8 @@ This is an example of @dfn{braced code}, that is, C code 
surrounded by
 braces, much like a compound statement in address@hidden  Braced code can 
contain
 any sequence of C tokens, so long as its braces are balanced.  Bison
 does not check the braced code for correctness directly; it merely
-copies the code to the output file, where the C compiler can check it.
+copies the code to the parser implementation file, where the C
+compiler can check it.
 
 Within braced code, the balanced-brace count is not affected by braces
 within comments, string literals, or character constants, but it is
@@ -3524,16 +3530,17 @@ end of the rule, following all the components.  Actions 
in the middle of
 a rule are tricky and used only for special purposes (@pxref{Mid-Rule
 Actions, ,Actions in Mid-Rule}).
 
-The C code in an action can refer to the semantic values of the components
-matched by the rule with the construct @address@hidden, which stands for
-the value of the @var{n}th component.  The semantic value for the grouping
-being constructed is @code{$$}.  In addition, the semantic values of
-symbols can be accessed with the named references construct
address@hidden@var{name}} or @address@hidden  Bison translates both of these
-constructs into expressions of the appropriate type when it copies the
-actions into the parser file.  @code{$$} (or @address@hidden, when it
-stands for the current grouping) is translated to a modifiable
-lvalue, so it can be assigned to.
+The C code in an action can refer to the semantic values of the
+components matched by the rule with the construct @address@hidden,
+which stands for the value of the @var{n}th component.  The semantic
+value for the grouping being constructed is @code{$$}.  In addition,
+the semantic values of symbols can be accessed with the named
+references construct @address@hidden or @address@hidden
+Bison translates both of these constructs into expressions of the
+appropriate type when it copies the actions into the parser
+implementation file.  @code{$$} (or @address@hidden, when it stands
+for the current grouping) is translated to a modifiable lvalue, so it
+can be assigned to.
 
 Here is a typical example:
 
@@ -4173,10 +4180,10 @@ All token type names (but not single-character literal 
tokens such as
 declared if you need to specify which data type to use for the semantic
 value (@pxref{Multiple Types, ,More Than One Value Type}).
 
-The first rule in the file also specifies the start symbol, by default.
-If you want some other symbol to be the start symbol, you must declare
-it explicitly (@pxref{Language and Grammar, ,Languages and Context-Free
-Grammars}).
+The first rule in the grammar file also specifies the start symbol, by
+default.  If you want some other symbol to be the start symbol, you
+must declare it explicitly (@pxref{Language and Grammar, ,Languages
+and Context-Free Grammars}).
 
 @menu
 * Require Decl::      Requiring a Bison version.
@@ -4941,11 +4948,11 @@ address@hidden default location is actually 
skeleton-dependent;
   consistently with the behavior of the standard Bison skeletons.}.
 
 @cindex Prologue
-For C/C++, the default location is the parser source code
-file after the usual contents of the parser header file.
-Thus, @code{%code} replaces the traditional Yacc prologue,
address@hidden@address@hidden@}}, for most purposes.
-For a detailed discussion, see @ref{Prologue Alternatives}.
+For C/C++, the default location is the parser implementation file
+after the usual contents of the parser header file.  Thus,
address@hidden replaces the traditional Yacc prologue,
address@hidden@address@hidden@}}, for most purposes.  For a detailed
+discussion, see @ref{Prologue Alternatives}.
 
 For Java, the default location is inside the parser class.
 @end deffn
@@ -4975,8 +4982,9 @@ In other words, it's the best place to define types 
referenced in @code{%union}
 directives, and it's the best place to override Bison's default @code{YYSTYPE}
 and @code{YYLTYPE} definitions.
 
address@hidden Location(s): The parser header file and the parser source code 
file
-before the Bison-generated @code{YYSTYPE} and @code{YYLTYPE} definitions.
address@hidden Location(s): The parser header file and the parser 
implementation file
+before the Bison-generated @code{YYSTYPE} and @code{YYLTYPE}
+definitions.
 @end itemize
 
 @item provides
@@ -4988,8 +4996,9 @@ before the Bison-generated @code{YYSTYPE} and 
@code{YYLTYPE} definitions.
 @item Purpose: This is the best place to write additional definitions and
 declarations that should be provided to other modules.
 
address@hidden Location(s): The parser header file and the parser source code 
file after
-the Bison-generated @code{YYSTYPE}, @code{YYLTYPE}, and token definitions.
address@hidden Location(s): The parser header file and the parser implementation
+file after the Bison-generated @code{YYSTYPE}, @code{YYLTYPE}, and
+token definitions.
 @end itemize
 
 @item top
@@ -4998,11 +5007,10 @@ the Bison-generated @code{YYSTYPE}, @code{YYLTYPE}, and 
token definitions.
 @itemize @bullet
 @item Language(s): C, C++
 
address@hidden Purpose: The unqualified @code{%code} or @code{%code requires} 
should
-usually be more appropriate than @code{%code top}.
-However, occasionally it is necessary to insert code much nearer the top of the
-parser source code file.
-For example:
address@hidden Purpose: The unqualified @code{%code} or @code{%code requires}
+should usually be more appropriate than @code{%code top}.  However,
+occasionally it is necessary to insert code much nearer the top of the
+parser implementation file.  For example:
 
 @smallexample
 %code top @{
@@ -5011,7 +5019,7 @@ For example:
 @}
 @end smallexample
 
address@hidden Location(s): Near the top of the parser source code file.
address@hidden Location(s): Near the top of the parser implementation file.
 @end itemize
 
 @item imports
@@ -5580,9 +5588,9 @@ insignificant for practical grammars.
 @item Languages(s): C, C++
 
 @item Purpose: Require parser instrumentation for tracing.
-In C/C++, define the macro @code{YYDEBUG} to 1 in the parser file if it
-is not already defined, so that the debugging facilities are compiled.
address@hidden, ,Tracing Your Parser}.
+In C/C++, define the macro @code{YYDEBUG} to 1 in the parser implementation
+file if it is not already defined, so that the debugging facilities are
+compiled.  @xref{Tracing, ,Tracing Your Parser}.
 
 @item Accepted Values: Boolean
 
@@ -5616,37 +5624,36 @@ Boolean.
 @c ----------------------------------------------------------   %define
 
 @deffn {Directive} %defines
-Write a header file containing macro definitions for the token type
-names defined in the grammar as well as a few other declarations.
-If the parser output file is named @address@hidden then this file
-is named @address@hidden
+Write a parser header file containing macro definitions for the token
+type names defined in the grammar as well as a few other declarations.
+If the parser implementation file is named @address@hidden then
+the parser header file is named @address@hidden
 
-For C parsers, the output header declares @code{YYSTYPE} unless
+For C parsers, the parser header file declares @code{YYSTYPE} unless
 @code{YYSTYPE} is already defined as a macro or you have used a
address@hidden<@var{type}>} tag without using @code{%union}.
-Therefore, if you are using a @code{%union}
-(@pxref{Multiple Types, ,More Than One Value Type}) with components that
-require other definitions, or if you have defined a @code{YYSTYPE} macro
-or type definition
-(@pxref{Value Type, ,Data Types of Semantic Values}), you need to
-arrange for these definitions to be propagated to all modules, e.g., by
-putting them in a prerequisite header that is included both by your
-parser and by any other module that needs @code{YYSTYPE}.
-
-Unless your parser is pure, the output header declares @code{yylval}
-as an external variable.  @xref{Pure Decl, ,A Pure (Reentrant)
-Parser}.
-
-If you have also used locations, the output header declares
address@hidden<@var{type}>} tag without using @code{%union}.  Therefore, if
+you are using a @code{%union} (@pxref{Multiple Types, ,More Than One
+Value Type}) with components that require other definitions, or if you
+have defined a @code{YYSTYPE} macro or type definition (@pxref{Value
+Type, ,Data Types of Semantic Values}), you need to arrange for these
+definitions to be propagated to all modules, e.g., by putting them in
+a prerequisite header that is included both by your parser and by any
+other module that needs @code{YYSTYPE}.
+
+Unless your parser is pure, the parser header file declares
address@hidden as an external variable.  @xref{Pure Decl, ,A Pure
+(Reentrant) Parser}.
+
+If you have also used locations, the parser header file declares
 @code{YYLTYPE} and @code{yylloc} using a protocol similar to that of
-the @code{YYSTYPE} macro and @code{yylval}.  @xref{Locations, ,Tracking
-Locations}.
+the @code{YYSTYPE} macro and @code{yylval}.  @xref{Locations,
+,Tracking Locations}.
 
-This output file is normally essential if you wish to put the definition
-of @code{yylex} in a separate source file, because @code{yylex}
-typically needs to be able to refer to the above-mentioned declarations
-and to the token type codes.  @xref{Token Values, ,Semantic Values of
-Tokens}.
+This parser header file is normally essential if you wish to put the
+definition of @code{yylex} in a separate source file, because
address@hidden typically needs to be able to refer to the
+above-mentioned declarations and to the token type codes.  @xref{Token
+Values, ,Semantic Values of Tokens}.
 
 @findex %code requires
 @findex %code provides
@@ -5665,8 +5672,8 @@ discarded symbols.  @xref{Destructor Decl, , Freeing 
Discarded Symbols}.
 @end deffn
 
 @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 @address@hidden
+Specify a prefix to use for all Bison output file names.  The names
+are chosen as if the grammar file were named @address@hidden
 @end deffn
 
 @deffn {Directive} %language "@var{language}"
@@ -5712,15 +5719,16 @@ Precedence}).
 
 @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.
+implementation file.  Ordinarily Bison writes these commands in the
+parser implementation 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
+implementation file, treating it as an independent source file in its
+own right.
 @end deffn
 
 @deffn {Directive} %output "@var{file}"
-Specify @var{file} for the parser file.
+Specify @var{file} for the parser implementation file.
 @end deffn
 
 @deffn {Directive} %pure-parser
@@ -5749,13 +5757,13 @@ This is similar to how most shells resolve commands.
 @end deffn
 
 @deffn {Directive} %token-table
-Generate an array of token names in the parser file.  The name of the
-array is @code{yytname}; @address@hidden is the name of the
-token whose internal Bison token code number is @var{i}.  The first
-three elements of @code{yytname} correspond to the predefined tokens
address@hidden"$end"},
address@hidden"error"}, and @code{"$undefined"}; after these come the symbols
-defined in the grammar file.
+Generate an array of token names in the parser implementation file.
+The name of the array is @code{yytname}; @address@hidden is
+the name of the token whose internal Bison token code number is
address@hidden  The first three elements of @code{yytname} correspond to the
+predefined tokens @code{"$end"}, @code{"error"}, and
address@hidden"$undefined"}; after these come the symbols defined in the
+grammar file.
 
 The name in the table includes all the characters needed to represent
 the token in Bison.  For single-character literals and literal
@@ -5823,10 +5831,10 @@ name is used in different parsers.  For example, 
@code{YYSTYPE} is not
 renamed, but defining this in different ways in different parsers causes
 no trouble (@pxref{Value Type, ,Data Types of Semantic Values}).
 
-The @samp{-p} option works by adding macro definitions to the beginning
-of the parser source file, defining @code{yyparse} as
address@hidden@var{prefix}parse}, and so on.  This effectively substitutes one
-name for the other in the entire parser file.
+The @samp{-p} option works by adding macro definitions to the
+beginning of the parser implementation file, defining @code{yyparse}
+as @address@hidden, and so on.  This effectively substitutes
+one name for the other in the entire parser implementation file.
 
 @node Interface
 @chapter Parser C-Language Interface
@@ -6009,13 +6017,14 @@ the input stream and returns them to the parser.  Bison 
does not create
 this function automatically; you must write it so that @code{yyparse} can
 call it.  The function is sometimes referred to as a lexical scanner.
 
-In simple programs, @code{yylex} is often defined at the end of the Bison
-grammar file.  If @code{yylex} is defined in a separate source file, you
-need to arrange for the token-type macro definitions to be available there.
-To do this, use the @samp{-d} option when you run Bison, so that it will
-write these macro definitions into a separate header file
address@hidden@var{name}.tab.h} which you can include in the other source files
-that need it.  @xref{Invocation, ,Invoking Bison}.
+In simple programs, @code{yylex} is often defined at the end of the
+Bison grammar file.  If @code{yylex} is defined in a separate source
+file, you need to arrange for the token-type macro definitions to be
+available there.  To do this, use the @samp{-d} option when you run
+Bison, so that it will write these macro definitions into the separate
+parser header file, @address@hidden, which you can include in
+the other source files that need it.  @xref{Invocation, ,Invoking
+Bison}.
 
 @menu
 * Calling Convention::  How @code{yyparse} calls @code{yylex}.
@@ -6036,9 +6045,9 @@ for the type of token it has just found; a zero or 
negative value
 signifies end-of-input.
 
 When a token is referred to in the grammar rules by a name, that name
-in the parser file becomes a C macro whose definition is the proper
-numeric code for that token type.  So @code{yylex} can use the name
-to indicate that type.  @xref{Symbols}.
+in the parser implementation file becomes a C macro whose definition
+is the proper numeric code for that token type.  So @code{yylex} can
+use the name to indicate that type.  @xref{Symbols}.
 
 When a token is referred to in the grammar rules by a character literal,
 the numeric code for that character is also the code for the token type.
@@ -6816,8 +6825,8 @@ different number.
 
 The definition of @code{if_stmt} above is solely to blame for the
 conflict, but the conflict does not actually appear without additional
-rules.  Here is a complete Bison input file that actually manifests the
-conflict:
+rules.  Here is a complete Bison grammar file that actually manifests
+the conflict:
 
 @example
 @group
@@ -7783,9 +7792,10 @@ Here we assume that @code{yylex} looks at the value of 
@code{hexflag}; when
 it is nonzero, all integers are parsed in hexadecimal, and tokens starting
 with letters are parsed as integers if possible.
 
-The declaration of @code{hexflag} shown in the prologue of the parser file
-is needed to make it accessible to the actions (@pxref{Prologue, ,The 
Prologue}).
-You must also write the code in @code{yylex} to obey the flag.
+The declaration of @code{hexflag} shown in the prologue of the grammar
+file is needed to make it accessible to the actions (@pxref{Prologue,
+,The Prologue}).  You must also write the code in @code{yylex} to obey
+the flag.
 
 @node Tie-in Recovery
 @section Lexical Tie-ins and Error Recovery
@@ -7871,10 +7881,10 @@ representation of it, either textually or graphically 
(as a DOT file).
 The textual file is generated when the options @option{--report} or
 @option{--verbose} are specified, see @xref{Invocation, , Invoking
 Bison}.  Its name is made by removing @samp{.tab.c} or @samp{.c} from
-the parser output file name, and adding @samp{.output} instead.
-Therefore, if the input file is @file{foo.y}, then the parser file is
-called @file{foo.tab.c} by default.  As a consequence, the verbose
-output file is called @file{foo.output}.
+the parser implementation file name, and adding @samp{.output}
+instead.  Therefore, if the grammar file is @file{foo.y}, then the
+parser implementation file is called @file{foo.tab.c} by default.  As
+a consequence, the verbose output file is called @file{foo.output}.
 
 The following grammar file, @file{calc.y}, will be used in the sequel:
 
@@ -8339,11 +8349,11 @@ the listing file.  Eventually you will arrive at the 
place where
 something undesirable happens, and you will see which parts of the
 grammar are to blame.
 
-The parser file is a C program and you can use C debuggers on it, but it's
-not easy to interpret what it is doing.  The parser function is a
-finite-state machine interpreter, and aside from the actions it executes
-the same code over and over.  Only the values of variables show where in
-the grammar it is working.
+The parser implementation file is a C program and you can use C
+debuggers on it, but it's not easy to interpret what it is doing.  The
+parser function is a finite-state machine interpreter, and aside from
+the actions it executes the same code over and over.  Only the values
+of variables show where in the grammar it is working.
 
 @findex YYPRINT
 The debugging information normally gives the token type of each token
@@ -8389,16 +8399,15 @@ bison @var{infile}
 @end example
 
 Here @var{infile} is the grammar file name, which usually ends in
address@hidden  The parser file's name is made by replacing the @samp{.y}
-with @samp{.tab.c} and removing any leading directory.  Thus, the
address@hidden foo.y} file name yields
address@hidden, and the @samp{bison hack/foo.y} file name yields
address@hidden  It's also possible, in case you are writing
-C++ code instead of C in your grammar file, to name it @file{foo.ypp}
-or @file{foo.y++}.  Then, the output files will take an extension like
-the given one as input (respectively @file{foo.tab.cpp} and
address@hidden).
-This feature takes effect with all options that manipulate file names like
address@hidden  The parser implementation file's name is made by replacing
+the @samp{.y} with @samp{.tab.c} and removing any leading directory.
+Thus, the @samp{bison foo.y} file name yields @file{foo.tab.c}, and
+the @samp{bison hack/foo.y} file name yields @file{foo.tab.c}.  It's
+also possible, in case you are writing C++ code instead of C in your
+grammar file, to name it @file{foo.ypp} or @file{foo.y++}.  Then, the
+output files will take an extension like the given one as input
+(respectively @file{foo.tab.cpp} and @file{foo.tab.c++}).  This
+feature takes effect with all options that manipulate file names like
 @samp{-o} or @samp{-d}.
 
 For example :
@@ -8460,17 +8469,16 @@ Print the name of the directory containing skeletons 
and XSLT.
 
 @item -y
 @itemx --yacc
-Act more like the traditional Yacc command.  This can cause
-different diagnostics to be generated, and may change behavior in
-other minor ways.  Most importantly, imitate Yacc's output
-file name conventions, so that the parser output file is called
address@hidden, and the other outputs are called @file{y.output} and
address@hidden
-Also, if generating a deterministic parser in C, generate @code{#define}
-statements in addition to an @code{enum} to associate token numbers with token
-names.
-Thus, the following shell script can substitute for Yacc, and the Bison
-distribution contains such a script for compatibility with POSIX:
+Act more like the traditional Yacc command.  This can cause different
+diagnostics to be generated, and may change behavior in other minor
+ways.  Most importantly, imitate Yacc's output file name conventions,
+so that the parser implementation file is called @file{y.tab.c}, and
+the other outputs are called @file{y.output} and @file{y.tab.h}.
+Also, if generating a deterministic parser in C, generate
address@hidden statements in addition to an @code{enum} to associate
+token numbers with token names.  Thus, the following shell script can
+substitute for Yacc, and the Bison distribution contains such a script
+for compatibility with POSIX:
 
 @example
 #! /bin/sh
@@ -8530,9 +8538,9 @@ Tuning the parser:
 @table @option
 @item -t
 @itemx --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.
address@hidden, ,Tracing Your Parser}.
+In the parser implementation 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}.
 
 @item -D @address@hidden
 @itemx address@hidden@var{value}]
@@ -8560,8 +8568,8 @@ definitions for @var{name}.
 @end itemize
 
 You should avoid using @code{-F} and @code{--force-define} in your
-makefiles unless you are confident that it is safe to quietly ignore any
-conflicting @code{%define} that may be added to the grammar file.
+make files unless you are confident that it is safe to quietly ignore
+any conflicting @code{%define} that may be added to the grammar file.
 
 @item -L @var{language}
 @itemx address@hidden
@@ -8583,11 +8591,12 @@ Pretend that @code{%name-prefix "@var{prefix}"} was 
specified.
 
 @item -l
 @itemx --no-lines
-Don't put any @code{#line} preprocessor commands in the parser file.
-Ordinarily Bison puts them in the parser file so that the C compiler
-and debuggers will associate errors with your source file, the
-grammar file.  This option causes them to associate errors with the
-parser file, treating it as an independent source file in its own right.
+Don't put any @code{#line} preprocessor commands in the parser
+implementation file.  Ordinarily Bison puts them in the parser
+implementation file so that the C compiler and debuggers will
+associate errors with your source file, the grammar file.  This option
+causes them to associate errors with the parser implementation file,
+treating it as an independent source file in its own right.
 
 @item -S @var{file}
 @itemx address@hidden
@@ -8659,7 +8668,7 @@ parser.  @xref{Decl Summary}.
 
 @item -o @var{file}
 @itemx address@hidden
-Specify the @var{file} for the parser file.
+Specify the @var{file} for the parser implementation file.
 
 The other output files' names are constructed from @var{file} as
 described under the @samp{-v} and @samp{-d} options.
@@ -8772,7 +8781,7 @@ An auxiliary class @code{stack} used by the parser.
 
 @item @var{file}.hh
 @itemx @var{file}.cc
-(Assuming the extension of the input file was @samp{.yy}.)  The
+(Assuming the extension of the grammar file was @samp{.yy}.)  The
 declaration and implementation of the C++ parser class.  The basename
 and extension of these two files follow the same rules as with regular C
 parsers (@pxref{Invocation}).
@@ -9384,11 +9393,11 @@ calcxx_driver::error (const std::string& m)
 @node Calc++ Parser
 @subsubsection Calc++ Parser
 
-The parser definition file @file{calc++-parser.yy} starts by asking for
-the C++ deterministic parser skeleton, the creation of the parser header
-file, and specifies the name of the parser class.
-Because the C++ skeleton changed several times, it is safer to require
-the version you designed the grammar for.
+The grammar file @file{calc++-parser.yy} starts by asking for the C++
+deterministic parser skeleton, the creation of the parser header file,
+and specifies the name of the parser class.  Because the C++ skeleton
+changed several times, it is safer to require the version you designed
+the grammar for.
 
 @comment file: calc++-parser.yy
 @example
@@ -9751,14 +9760,15 @@ The Java parser skeletons are selected using the 
@code{%language "Java"}
 directive or the @option{-L java}/@option{--language=java} option.
 
 @c FIXME: Documented bug.
-When generating a Java parser, @code{bison @var{basename}.y} will create
-a single Java source file named @address@hidden  Using an
-input file without a @file{.y} suffix is currently broken.  The basename
-of the output file can be changed by the @code{%file-prefix} directive
-or the @option{-p}/@option{--name-prefix} option.  The entire output file
-name can be changed by the @code{%output} directive or the
address@hidden/@option{--output} option.  The output file contains a single
-class for the parser.
+When generating a Java parser, @code{bison @var{basename}.y} will
+create a single Java source file named @address@hidden
+containing the parser implementation.  Using a grammar file without a
address@hidden suffix is currently broken.  The basename of the parser
+implementation file can be changed by the @code{%file-prefix}
+directive or the @option{-p}/@option{--name-prefix} option.  The
+entire parser implementation file name can be changed by the
address@hidden directive or the @option{-o}/@option{--output} option.
+The parser implementation file contains a single class for the parser.
 
 You can create documentation for generated parsers using Javadoc.
 
@@ -10783,9 +10793,9 @@ Bison declarations section or the epilogue.
 
 @c Don't insert spaces, or check the DVI output.
 @deffn {Delimiter} address@hidden@address@hidden
-All code listed between @address@hidden and @address@hidden is copied directly 
to
-the output file uninterpreted.  Such code forms the prologue of the input
-file.  @xref{Grammar Outline, ,Outline of a Bison
+All code listed between @address@hidden and @address@hidden is copied verbatim
+to the parser implementation file.  Such code forms the prologue of
+the grammar file.  @xref{Grammar Outline, ,Outline of a Bison
 Grammar}.
 @end deffn
 
@@ -10874,8 +10884,8 @@ Define a variable to adjust Bison's behavior.
 @end deffn
 
 @deffn {Directive} %defines
-Bison declaration to create a header file meant for the scanner.
address@hidden Summary}.
+Bison declaration to create a parser header file, which is usually
+meant for the scanner.  @xref{Decl Summary}.
 @end deffn
 
 @deffn {Directive} %defines @var{defines-file}
@@ -10965,7 +10975,7 @@ Precedence}.
 
 @deffn {Directive} %no-lines
 Bison declaration to avoid generating @code{#line} directives in the
-parser file.  @xref{Decl Summary}.
+parser implementation file.  @xref{Decl Summary}.
 @end deffn
 
 @deffn {Directive} %nonassoc
@@ -10974,8 +10984,8 @@ Bison declaration to assign precedence and 
nonassociativity to token(s).
 @end deffn
 
 @deffn {Directive} %output "@var{file}"
-Bison declaration to set the name of the parser file.  @xref{Decl
-Summary}.
+Bison declaration to set the name of the parser implementation file.
address@hidden Summary}.
 @end deffn
 
 @deffn {Directive} %param @address@hidden@} @dots{}
@@ -11030,8 +11040,8 @@ Bison declaration to declare token(s) without 
specifying precedence.
 @end deffn
 
 @deffn {Directive} %token-table
-Bison declaration to include a token name table in the parser file.
address@hidden Summary}.
+Bison declaration to include a token name table in the parser
+implementation file.  @xref{Decl Summary}.
 @end deffn
 
 @deffn {Directive} %type
@@ -11510,7 +11520,7 @@ grammatically indivisible.  The piece of text it 
represents is a token.
 @c LocalWords: YYSTACK DVI fdl printindex IELR nondeterministic nonterminals ps
 @c LocalWords: subexpressions declarator nondeferred config libintl postfix LAC
 @c LocalWords: preprocessor nonpositive unary nonnumeric typedef extern rhs
address@hidden LocalWords: yytokentype filename destructor multicharacter 
nonnull EBCDIC
address@hidden LocalWords: yytokentype destructor multicharacter nonnull EBCDIC
 @c LocalWords: lvalue nonnegative XNUM CHR chr TAGLESS tagless stdout api TOK
 @c LocalWords: destructors Reentrancy nonreentrant subgrammar nonassociative
 @c LocalWords: deffnx namespace xml goto lalr ielr runtime lex yacc yyps env
@@ -11518,7 +11528,7 @@ grammatically indivisible.  The piece of text it 
represents is a token.
 @c LocalWords: YYENABLE bindtextdomain Makefile DEFS CPPFLAGS DBISON DeRemer
 @c LocalWords: autoreconf Pennello multisets nondeterminism Generalised baz
 @c LocalWords: redeclare automata Dparse localedir datadir XSLT midrule Wno
address@hidden LocalWords: makefiles Graphviz multitable headitem hh basename 
Doxygen fno
address@hidden LocalWords: Graphviz multitable headitem hh basename Doxygen fno
 @c LocalWords: doxygen ival sval deftypemethod deallocate pos deftypemethodx
 @c LocalWords: Ctor defcv defcvx arg accessors arithmetics CPP ifndef CALCXX
 @c LocalWords: lexer's calcxx bool LPAREN RPAREN deallocation cerrno climits
-- 
1.7.0.4


>From e0c072223c4901b4b41270a4a5ea9979ec85b64d Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Sun, 6 Feb 2011 12:29:56 -0500
Subject: [PATCH 4/7] doc: begin to split apart the manual's Decl Summary 
section.

Discussed in thread starting at
<http://lists.gnu.org/archive/html/bison-patches/2009-05/msg00013.html>.
* doc/bison.texinfo (Decl Summary): Extract most of the %code
entry into...
(%code Summary): ... this new subsection, and update all
cross-references.  For readability of the patches, rewriting of
the text so it makes sense as a separate subsection will come in a
later patch.
(cherry picked from commit 8e6f2266302c2035ef2b0ed7375cd8810b160f13)

Conflicts:

        doc/bison.texinfo
---
 ChangeLog         |   12 +++
 doc/bison.texinfo |  214 ++++++++++++++++++++++++++++-------------------------
 2 files changed, 125 insertions(+), 101 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e19e959..14bb4ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2011-02-06  Joel E. Denny  <address@hidden>
 
+       doc: begin to split apart the manual's Decl Summary section.
+       Discussed in thread starting at
+       <http://lists.gnu.org/archive/html/bison-patches/2009-05/msg00013.html>.
+       * doc/bison.texinfo (Decl Summary): Extract most of the %code
+       entry into...
+       (%code Summary): ... this new subsection, and update all
+       cross-references.  For readability of the patches, rewriting of
+       the text so it makes sense as a separate subsection will come in a
+       later patch.
+
+2011-02-06  Joel E. Denny  <address@hidden>
+
        doc: clean up naming of various Bison files.
        The Bison manual's names for various files associated with a Bison
        parser has devolved into inconsistency.  This patch makes the
diff --git a/doc/bison.texinfo b/doc/bison.texinfo
index c816160..5d597f7 100644
--- a/doc/bison.texinfo
+++ b/doc/bison.texinfo
@@ -228,6 +228,7 @@ Bison Declarations
 * Pure Decl::         Requesting a reentrant parser.
 * Push Decl::         Requesting a push parser.
 * Decl Summary::      Table of all Bison declarations.
+* %code Summary::     Inserting code into the parser source.
 
 Parser C-Language Interface
 
@@ -2796,7 +2797,7 @@ directive with an explicit qualifier field, which 
identifies the
 purpose of the code and thus the location(s) where Bison should
 generate it.  For C/C++, the qualifier can be omitted for the default
 location, or it can be one of @code{requires}, @code{provides},
address@hidden  @xref{Decl Summary,,%code}.
address@hidden  @xref{%code Summary}.
 
 Look again at the example of the previous section:
 
@@ -4198,6 +4199,7 @@ and Context-Free Grammars}).
 * Pure Decl::         Requesting a reentrant parser.
 * Push Decl::         Requesting a push parser.
 * Decl Summary::      Table of all Bison declarations.
+* %code Summary::     Inserting code into the parser source.
 @end menu
 
 @node Require Decl
@@ -4940,104 +4942,11 @@ In order to change the behavior of @command{bison}, 
use the following
 directives:
 
 @deffn {Directive} %code @address@hidden@}
address@hidden {Directive} %code @var{qualifier} @address@hidden@}
 @findex %code
-This is the unqualified form of the @code{%code} directive.
-It inserts @var{code} verbatim at a language-dependent default location in the
address@hidden default location is actually skeleton-dependent;
-  writers of non-standard skeletons however should choose the default location
-  consistently with the behavior of the standard Bison skeletons.}.
-
address@hidden Prologue
-For C/C++, the default location is the parser implementation file
-after the usual contents of the parser header file.  Thus,
address@hidden replaces the traditional Yacc prologue,
address@hidden@address@hidden@}}, for most purposes.  For a detailed
-discussion, see @ref{Prologue Alternatives}.
-
-For Java, the default location is inside the parser class.
address@hidden deffn
-
address@hidden {Directive} %code @var{qualifier} @address@hidden@}
-This is the qualified form of the @code{%code} directive.
-If you need to specify location-sensitive verbatim @var{code} that does not
-belong at the default location selected by the unqualified @code{%code} form,
-use this form instead.
-
address@hidden identifies the purpose of @var{code} and thus the location(s)
-where Bison should generate it.
-Not all @var{qualifier}s are accepted for all target languages.
-Unaccepted @var{qualifier}s produce an error.
-Some of the accepted @var{qualifier}s are:
-
address@hidden @bullet
address@hidden requires
address@hidden %code requires
-
address@hidden @bullet
address@hidden Language(s): C, C++
-
address@hidden Purpose: This is the best place to write dependency code 
required for
address@hidden and @code{YYLTYPE}.
-In other words, it's the best place to define types referenced in @code{%union}
-directives, and it's the best place to override Bison's default @code{YYSTYPE}
-and @code{YYLTYPE} definitions.
-
address@hidden Location(s): The parser header file and the parser 
implementation file
-before the Bison-generated @code{YYSTYPE} and @code{YYLTYPE}
-definitions.
address@hidden itemize
-
address@hidden provides
address@hidden %code provides
-
address@hidden @bullet
address@hidden Language(s): C, C++
-
address@hidden Purpose: This is the best place to write additional definitions 
and
-declarations that should be provided to other modules.
-
address@hidden Location(s): The parser header file and the parser implementation
-file after the Bison-generated @code{YYSTYPE}, @code{YYLTYPE}, and
-token definitions.
address@hidden itemize
-
address@hidden top
address@hidden %code top
-
address@hidden @bullet
address@hidden Language(s): C, C++
-
address@hidden Purpose: The unqualified @code{%code} or @code{%code requires}
-should usually be more appropriate than @code{%code top}.  However,
-occasionally it is necessary to insert code much nearer the top of the
-parser implementation file.  For example:
-
address@hidden
-%code top @{
-  #define _GNU_SOURCE
-  #include <stdio.h>
address@hidden
address@hidden smallexample
-
address@hidden Location(s): Near the top of the parser implementation file.
address@hidden itemize
-
address@hidden imports
address@hidden %code imports
-
address@hidden @bullet
address@hidden Language(s): Java
-
address@hidden Purpose: This is the best place to write Java import directives.
-
address@hidden Location(s): The parser Java file after any Java package 
directive and
-before any class definitions.
address@hidden itemize
address@hidden itemize
-
address@hidden Prologue
-For a detailed discussion of how to use @code{%code} in place of the
-traditional Yacc prologue for C/C++, see @ref{Prologue Alternatives}.
+Insert @var{code} verbatim into the output parser source at the
+default location or at the location specified by @var{qualifier}.
address@hidden Summary}.
 @end deffn
 
 @deffn {Directive} %debug
@@ -5659,7 +5568,7 @@ Values, ,Semantic Values of Tokens}.
 @findex %code provides
 If you have declared @code{%code requires} or @code{%code provides}, the output
 header also contains their code.
address@hidden Summary, ,%code}.
address@hidden Summary}.
 @end deffn
 
 @deffn {Directive} %defines @var{defines-file}
@@ -5802,6 +5711,109 @@ Pretend the option @option{--yacc} was given, i.e., 
imitate Yacc,
 including its naming conventions.  @xref{Bison Options}, for more.
 @end deffn
 
address@hidden %code Summary
address@hidden %code Summary
address@hidden {Directive} %code @address@hidden@}
address@hidden %code
+This is the unqualified form of the @code{%code} directive.
+It inserts @var{code} verbatim at a language-dependent default location in the
address@hidden default location is actually skeleton-dependent;
+  writers of non-standard skeletons however should choose the default location
+  consistently with the behavior of the standard Bison skeletons.}.
+
address@hidden Prologue
+For C/C++, the default location is the parser implementation file
+after the usual contents of the parser header file.  Thus,
address@hidden replaces the traditional Yacc prologue,
address@hidden@address@hidden@}}, for most purposes.  For a detailed
+discussion, see @ref{Prologue Alternatives}.
+
+For Java, the default location is inside the parser class.
address@hidden deffn
+
address@hidden {Directive} %code @var{qualifier} @address@hidden@}
+This is the qualified form of the @code{%code} directive.
+If you need to specify location-sensitive verbatim @var{code} that does not
+belong at the default location selected by the unqualified @code{%code} form,
+use this form instead.
+
address@hidden identifies the purpose of @var{code} and thus the location(s)
+where Bison should generate it.
+Not all @var{qualifier}s are accepted for all target languages.
+Unaccepted @var{qualifier}s produce an error.
+Some of the accepted @var{qualifier}s are:
+
address@hidden @bullet
address@hidden requires
address@hidden %code requires
+
address@hidden @bullet
address@hidden Language(s): C, C++
+
address@hidden Purpose: This is the best place to write dependency code 
required for
address@hidden and @code{YYLTYPE}.
+In other words, it's the best place to define types referenced in @code{%union}
+directives, and it's the best place to override Bison's default @code{YYSTYPE}
+and @code{YYLTYPE} definitions.
+
address@hidden Location(s): The parser header file and the parser 
implementation file
+before the Bison-generated @code{YYSTYPE} and @code{YYLTYPE}
+definitions.
address@hidden itemize
+
address@hidden provides
address@hidden %code provides
+
address@hidden @bullet
address@hidden Language(s): C, C++
+
address@hidden Purpose: This is the best place to write additional definitions 
and
+declarations that should be provided to other modules.
+
address@hidden Location(s): The parser header file and the parser implementation
+file after the Bison-generated @code{YYSTYPE}, @code{YYLTYPE}, and
+token definitions.
address@hidden itemize
+
address@hidden top
address@hidden %code top
+
address@hidden @bullet
address@hidden Language(s): C, C++
+
address@hidden Purpose: The unqualified @code{%code} or @code{%code requires}
+should usually be more appropriate than @code{%code top}.  However,
+occasionally it is necessary to insert code much nearer the top of the
+parser implementation file.  For example:
+
address@hidden
+%code top @{
+  #define _GNU_SOURCE
+  #include <stdio.h>
address@hidden
address@hidden smallexample
+
address@hidden Location(s): Near the top of the parser implementation file.
address@hidden itemize
+
address@hidden imports
address@hidden %code imports
+
address@hidden @bullet
address@hidden Language(s): Java
+
address@hidden Purpose: This is the best place to write Java import directives.
+
address@hidden Location(s): The parser Java file after any Java package 
directive and
+before any class definitions.
address@hidden itemize
address@hidden itemize
+
address@hidden Prologue
+For a detailed discussion of how to use @code{%code} in place of the
+traditional Yacc prologue for C/C++, see @ref{Prologue Alternatives}.
address@hidden deffn
+
 
 @node Multiple Parsers
 @section Multiple Parsers in the Same Program
@@ -9430,7 +9442,7 @@ to include the header of the other, which is, of course, 
insane.  This
 mutual dependency will be broken using forward declarations.  Because the
 driver's header needs detailed knowledge about the parser class (in
 particular its inner types), it is the parser's header which will use a
-forward declaration of the driver.  @xref{Decl Summary, ,%code}.
+forward declaration of the driver.  @xref{%code Summary}.
 
 @comment file: calc++-parser.yy
 @example
@@ -10861,7 +10873,7 @@ Start-Symbol}.  It cannot be used in the grammar.
 @deffn {Directive} %code @address@hidden@}
 @deffnx {Directive} %code @var{qualifier} @address@hidden@}
 Insert @var{code} verbatim into output parser source.
address@hidden Summary,,%code}.
address@hidden Summary}.
 @end deffn
 
 @deffn {Directive} %debug
-- 
1.7.0.4


>From 35c1e5f0cdfcd9e6e70fd47efdb3626528825f60 Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Sun, 6 Feb 2011 12:41:24 -0500
Subject: [PATCH 5/7] doc: finish splitting apart the manual's Decl Summary 
section.

Suggested by Akim Demaille at
<http://lists.gnu.org/archive/html/bison-patches/2009-05/msg00013.html>.
* doc/bison.texinfo (Decl Summary): Extract most of the %define
entry into...
(%define Summary): ... this new subsection, and update all
cross-references.  For readability of the patches, rewriting of
the text so it makes sense as a separate subsection will come in a
later patch.  Moreover, the majority of the text describing the
various new LR features should likely move to another new section
somewhere.
(cherry picked from commit 2f4518a12609c27887a9eb262d60a38b58af9657)

Conflicts:

        doc/bison.texinfo
---
 ChangeLog         |   14 ++
 doc/bison.texinfo |  542 +++++++++++++++++++++++++++--------------------------
 2 files changed, 287 insertions(+), 269 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 14bb4ad..869e503 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2011-02-06  Joel E. Denny  <address@hidden>
 
+       doc: finish splitting apart the manual's Decl Summary section.
+       Suggested by Akim Demaille at
+       <http://lists.gnu.org/archive/html/bison-patches/2009-05/msg00013.html>.
+       * doc/bison.texinfo (Decl Summary): Extract most of the %define
+       entry into...
+       (%define Summary): ... this new subsection, and update all
+       cross-references.  For readability of the patches, rewriting of
+       the text so it makes sense as a separate subsection will come in a
+       later patch.  Moreover, the majority of the text describing the
+       various new LR features should likely move to another new section
+       somewhere.
+
+2011-02-06  Joel E. Denny  <address@hidden>
+
        doc: begin to split apart the manual's Decl Summary section.
        Discussed in thread starting at
        <http://lists.gnu.org/archive/html/bison-patches/2009-05/msg00013.html>.
diff --git a/doc/bison.texinfo b/doc/bison.texinfo
index 5d597f7..0e7038b 100644
--- a/doc/bison.texinfo
+++ b/doc/bison.texinfo
@@ -228,6 +228,7 @@ Bison Declarations
 * Pure Decl::         Requesting a reentrant parser.
 * Push Decl::         Requesting a push parser.
 * Decl Summary::      Table of all Bison declarations.
+* %define Summary::   Defining variables to adjust Bison's behavior.
 * %code Summary::     Inserting code into the parser source.
 
 Parser C-Language Interface
@@ -485,7 +486,7 @@ restrictions of LALR(1), which is hard to explain simply.
 more information on this.
 As an experimental feature, you can escape these additional restrictions by
 requesting IELR(1) or canonical LR(1) parser tables.
address@hidden Summary,,lr.type}, to learn how.
address@hidden Summary,,lr.type}, to learn how.
 
 @cindex GLR parsing
 @cindex generalized LR (GLR) parsing
@@ -4199,6 +4200,7 @@ and Context-Free Grammars}).
 * Pure Decl::         Requesting a reentrant parser.
 * Push Decl::         Requesting a push parser.
 * Decl Summary::      Table of all Bison declarations.
+* %define Summary::   Defining variables to adjust Bison's behavior.
 * %code Summary::     Inserting code into the parser source.
 @end menu
 
@@ -4789,7 +4791,7 @@ within a certain time period.
 
 Normally, Bison generates a pull parser.
 The following Bison declaration says that you want the parser to be a push
-parser (@pxref{Decl Summary,,%define api.push-pull}):
+parser (@pxref{%define Summary,,api.push-pull}):
 
 @example
 %define api.push-pull push
@@ -4958,6 +4960,195 @@ parse.trace}.
 @deffn {Directive} %define @var{variable}
 @deffnx {Directive} %define @var{variable} @var{value}
 @deffnx {Directive} %define @var{variable} "@var{value}"
+Define a variable to adjust Bison's behavior.  @xref{%define Summary}.
address@hidden deffn
+
address@hidden {Directive} %defines
+Write a parser header file containing macro definitions for the token
+type names defined in the grammar as well as a few other declarations.
+If the parser implementation file is named @address@hidden then
+the parser header file is named @address@hidden
+
+For C parsers, the parser header file declares @code{YYSTYPE} unless
address@hidden is already defined as a macro or you have used a
address@hidden<@var{type}>} tag without using @code{%union}.  Therefore, if
+you are using a @code{%union} (@pxref{Multiple Types, ,More Than One
+Value Type}) with components that require other definitions, or if you
+have defined a @code{YYSTYPE} macro or type definition (@pxref{Value
+Type, ,Data Types of Semantic Values}), you need to arrange for these
+definitions to be propagated to all modules, e.g., by putting them in
+a prerequisite header that is included both by your parser and by any
+other module that needs @code{YYSTYPE}.
+
+Unless your parser is pure, the parser header file declares
address@hidden as an external variable.  @xref{Pure Decl, ,A Pure
+(Reentrant) Parser}.
+
+If you have also used locations, the parser header file declares
address@hidden and @code{yylloc} using a protocol similar to that of
+the @code{YYSTYPE} macro and @code{yylval}.  @xref{Locations,
+,Tracking Locations}.
+
+This parser header file is normally essential if you wish to put the
+definition of @code{yylex} in a separate source file, because
address@hidden typically needs to be able to refer to the
+above-mentioned declarations and to the token type codes.  @xref{Token
+Values, ,Semantic Values of Tokens}.
+
address@hidden %code requires
address@hidden %code provides
+If you have declared @code{%code requires} or @code{%code provides}, the output
+header also contains their code.
address@hidden Summary}.
address@hidden deffn
+
address@hidden {Directive} %defines @var{defines-file}
+Same as above, but save in the file @var{defines-file}.
address@hidden deffn
+
address@hidden {Directive} %destructor
+Specify how the parser should reclaim the memory associated to
+discarded symbols.  @xref{Destructor Decl, , Freeing Discarded Symbols}.
address@hidden deffn
+
address@hidden {Directive} %file-prefix "@var{prefix}"
+Specify a prefix to use for all Bison output file names.  The names
+are chosen as if the grammar file were named @address@hidden
address@hidden deffn
+
address@hidden {Directive} %language "@var{language}"
+Specify the programming language for the generated parser.  Currently
+supported languages include C, C++, and Java.
address@hidden is case-insensitive.
+
+This directive is experimental and its effect may be modified in future
+releases.
address@hidden deffn
+
address@hidden {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 syntax error messages.
address@hidden deffn
+
address@hidden {Directive} %name-prefix "@var{prefix}"
+Rename the external symbols used in the parser so that they start with
address@hidden instead of @samp{yy}.  The precise list of symbols renamed
+in C parsers
+is @code{yyparse}, @code{yylex}, @code{yyerror}, @code{yynerrs},
address@hidden, @code{yychar}, @code{yydebug}, and
+(if locations are used) @code{yylloc}.  If you use a push parser,
address@hidden, @code{yypull_parse}, @code{yypstate},
address@hidden and @code{yypstate_delete} will
+also be renamed.  For example, if you use @samp{%name-prefix "c_"}, the
+names become @code{c_parse}, @code{c_lex}, and so on.
+For C++ parsers, see the @samp{%define api.namespace} documentation in this
+section.
address@hidden Parsers, ,Multiple Parsers in the Same Program}.
address@hidden deffn
+
address@hidden defaultprec
address@hidden {Directive} %no-default-prec
+Do not assign a precedence to rules lacking an explicit @code{%prec}
+modifier (@pxref{Contextual Precedence, ,Context-Dependent
+Precedence}).
address@hidden deffn
address@hidden ifset
+
address@hidden {Directive} %no-lines
+Don't generate any @code{#line} preprocessor commands in the parser
+implementation file.  Ordinarily Bison writes these commands in the
+parser implementation 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
+implementation file, treating it as an independent source file in its
+own right.
address@hidden deffn
+
address@hidden {Directive} %output "@var{file}"
+Specify @var{file} for the parser implementation file.
address@hidden deffn
+
address@hidden {Directive} %pure-parser
+Deprecated version of @samp{%define api.pure} (@pxref{%define
+Summary,,api.pure}), for which Bison is more careful to warn about
+unreasonable usage.
address@hidden deffn
+
address@hidden {Directive} %require "@var{version}"
+Require version @var{version} or higher of Bison.  @xref{Require Decl, ,
+Require a Version of Bison}.
address@hidden deffn
+
address@hidden {Directive} %skeleton "@var{file}"
+Specify the skeleton to use.
+
address@hidden You probably don't need this option unless you are developing 
Bison.
address@hidden You should use @code{%language} if you want to specify the 
skeleton for a
address@hidden different language, because it is clearer and because it will 
always choose the
address@hidden correct skeleton for non-deterministic or push parsers.
+
+If @var{file} does not contain a @code{/}, @var{file} is the name of a skeleton
+file in the Bison installation directory.
+If it does, @var{file} is an absolute file name or a file name relative to the
+directory of the grammar file.
+This is similar to how most shells resolve commands.
address@hidden deffn
+
address@hidden {Directive} %token-table
+Generate an array of token names in the parser implementation file.
+The name of the array is @code{yytname}; @address@hidden is
+the name of the token whose internal Bison token code number is
address@hidden  The first three elements of @code{yytname} correspond to the
+predefined tokens @code{"$end"}, @code{"error"}, and
address@hidden"$undefined"}; after these come the symbols defined in the
+grammar file.
+
+The name in the table includes all the characters needed to represent
+the token in Bison.  For single-character literals and literal
+strings, this includes the surrounding quoting characters and any
+escape sequences.  For example, the Bison single-character literal
address@hidden'+'} corresponds to a three-character name, represented in C as
address@hidden"'+'"}; and the Bison two-character literal string @code{"\\/"}
+corresponds to a five-character name, represented in C as
address@hidden"\"\\\\/\""}.
+
+When you specify @code{%token-table}, Bison also generates macro
+definitions for macros @code{YYNTOKENS}, @code{YYNNTS}, and
address@hidden, and @code{YYNSTATES}:
+
address@hidden @code
address@hidden YYNTOKENS
+The highest token number, plus one.
address@hidden YYNNTS
+The number of nonterminal symbols.
address@hidden YYNRULES
+The number of grammar rules,
address@hidden YYNSTATES
+The number of parser states (@pxref{Parser States}).
address@hidden table
address@hidden deffn
+
address@hidden {Directive} %verbose
+Write an extra output file containing verbose descriptions of the
+parser states and what is done for each type of lookahead token in
+that state.  @xref{Understanding, , Understanding Your Parser}, for more
+information.
address@hidden deffn
+
address@hidden {Directive} %yacc
+Pretend the option @option{--yacc} was given, i.e., imitate Yacc,
+including its naming conventions.  @xref{Bison Options}, for more.
address@hidden deffn
+
+
address@hidden %define Summary
address@hidden %define Summary
address@hidden {Directive} %define @var{variable}
address@hidden {Directive} %define @var{variable} @var{value}
address@hidden {Directive} %define @var{variable} "@var{value}"
 Define a variable to adjust Bison's behavior.
 
 It is an error if a @var{variable} is defined by @code{%define} multiple
@@ -5170,21 +5361,19 @@ More user feedback will help to stabilize it.)
 @item Accepted Values:
 @itemize
 @item @code{all}.
-This is the traditional Bison behavior.
-The main advantage is a significant decrease in the size of the parser
-tables.
-The disadvantage is that, when the generated parser encounters a
+This is the traditional Bison behavior.  The main advantage is a
+significant decrease in the size of the parser tables.  The
+disadvantage is that, when the generated parser encounters a
 syntactically unacceptable token, the parser might then perform
 unnecessary default reductions before it can detect the syntax error.
-Such delayed syntax error detection is usually inherent in
-LALR and IELR parser tables anyway due to
-LR state merging (@pxref{Decl Summary,,lr.type}).
-Furthermore, the use of @code{%nonassoc} can contribute to delayed
-syntax error detection even in the case of canonical LR.
-As an experimental feature, delayed syntax error detection can be
-overcome in all cases by enabling LAC (@pxref{Decl
-Summary,,parse.lac}, for details, including a discussion of the effects
-of delayed syntax error detection).
+Such delayed syntax error detection is usually inherent in LALR and
+IELR parser tables anyway due to LR state merging (@pxref{%define
+Summary,,lr.type}).  Furthermore, the use of @code{%nonassoc} can
+contribute to delayed syntax error detection even in the case of
+canonical LR.  As an experimental feature, delayed syntax error
+detection can be overcome in all cases by enabling LAC (@pxref{%define
+Summary,,parse.lac}, for details, including a discussion of the
+effects of delayed syntax error detection).
 
 @item @code{consistent}.
 @cindex consistent states
@@ -5332,21 +5521,20 @@ This can significantly reduce the complexity of 
developing of a grammar.
 @cindex syntax errors delayed
 @cindex LAC
 @findex %nonassoc
-While inefficient, canonical LR parser tables can be an
-interesting means to explore a grammar because they have a property that
-IELR and LALR tables do not.
-That is, if @code{%nonassoc} is not used and default reductions are left
-disabled (@pxref{Decl Summary,,lr.default-reductions}), then, for every
-left context of every canonical LR state, the set of tokens
-accepted by that state is guaranteed to be the exact set of tokens that
-is syntactically acceptable in that left context.
-It might then seem that an advantage of canonical LR parsers
-in production is that, under the above constraints, they are guaranteed
-to detect a syntax error as soon as possible without performing any
-unnecessary reductions.
-However, IELR parsers using LAC (@pxref{Decl
-Summary,,parse.lac}) are also able to achieve this behavior without
-sacrificing @code{%nonassoc} or default reductions.
+While inefficient, canonical LR parser tables can be an interesting
+means to explore a grammar because they have a property that IELR and
+LALR tables do not.  That is, if @code{%nonassoc} is not used and
+default reductions are left disabled (@pxref{%define
+Summary,,lr.default-reductions}), then, for every left context of
+every canonical LR state, the set of tokens accepted by that state is
+guaranteed to be the exact set of tokens that is syntactically
+acceptable in that left context.  It might then seem that an advantage
+of canonical LR parsers in production is that, under the above
+constraints, they are guaranteed to detect a syntax error as soon as
+possible without performing any unnecessary reductions.  However, IELR
+parsers using LAC (@pxref{%define Summary,,parse.lac}) are also able
+to achieve this behavior without sacrificing @code{%nonassoc} or
+default reductions.
 @end itemize
 
 @item Default Value: @code{lalr}
@@ -5450,16 +5638,17 @@ error messages are enabled, the parser must then 
discover the list of
 expected tokens, so it performs a separate exploratory parse for each
 token in the grammar.
 
-There is one subtlety about the use of LAC.  That is, when in
-a consistent parser state with a default reduction, the parser will not
-attempt to fetch a token from the scanner because no lookahead is needed
-to determine the next parser action.  Thus, whether default reductions
-are enabled in consistent states (@pxref{Decl
+There is one subtlety about the use of LAC.  That is, when in a
+consistent parser state with a default reduction, the parser will not
+attempt to fetch a token from the scanner because no lookahead is
+needed to determine the next parser action.  Thus, whether default
+reductions are enabled in consistent states (@pxref{%define
 Summary,,lr.default-reductions}) affects how soon the parser detects a
 syntax error: when it @emph{reaches} an erroneous token or when it
-eventually @emph{needs} that token as a lookahead.  The latter behavior
-is probably more intuitive, so Bison currently provides no way to
-achieve the former behavior while default reductions are fully enabled.
+eventually @emph{needs} that token as a lookahead.  The latter
+behavior is probably more intuitive, so Bison currently provides no
+way to achieve the former behavior while default reductions are fully
+enabled.
 
 Thus, when LAC is in use, for some fixed decision of whether
 to enable default reductions in consistent states, canonical
@@ -5530,186 +5719,7 @@ Boolean.
 
 @end table
 @end deffn
address@hidden ----------------------------------------------------------   
%define
-
address@hidden {Directive} %defines
-Write a parser header file containing macro definitions for the token
-type names defined in the grammar as well as a few other declarations.
-If the parser implementation file is named @address@hidden then
-the parser header file is named @address@hidden
-
-For C parsers, the parser header file declares @code{YYSTYPE} unless
address@hidden is already defined as a macro or you have used a
address@hidden<@var{type}>} tag without using @code{%union}.  Therefore, if
-you are using a @code{%union} (@pxref{Multiple Types, ,More Than One
-Value Type}) with components that require other definitions, or if you
-have defined a @code{YYSTYPE} macro or type definition (@pxref{Value
-Type, ,Data Types of Semantic Values}), you need to arrange for these
-definitions to be propagated to all modules, e.g., by putting them in
-a prerequisite header that is included both by your parser and by any
-other module that needs @code{YYSTYPE}.
-
-Unless your parser is pure, the parser header file declares
address@hidden as an external variable.  @xref{Pure Decl, ,A Pure
-(Reentrant) Parser}.
-
-If you have also used locations, the parser header file declares
address@hidden and @code{yylloc} using a protocol similar to that of
-the @code{YYSTYPE} macro and @code{yylval}.  @xref{Locations,
-,Tracking Locations}.
-
-This parser header file is normally essential if you wish to put the
-definition of @code{yylex} in a separate source file, because
address@hidden typically needs to be able to refer to the
-above-mentioned declarations and to the token type codes.  @xref{Token
-Values, ,Semantic Values of Tokens}.
-
address@hidden %code requires
address@hidden %code provides
-If you have declared @code{%code requires} or @code{%code provides}, the output
-header also contains their code.
address@hidden Summary}.
address@hidden deffn
 
address@hidden {Directive} %defines @var{defines-file}
-Same as above, but save in the file @var{defines-file}.
address@hidden deffn
-
address@hidden {Directive} %destructor
-Specify how the parser should reclaim the memory associated to
-discarded symbols.  @xref{Destructor Decl, , Freeing Discarded Symbols}.
address@hidden deffn
-
address@hidden {Directive} %file-prefix "@var{prefix}"
-Specify a prefix to use for all Bison output file names.  The names
-are chosen as if the grammar file were named @address@hidden
address@hidden deffn
-
address@hidden {Directive} %language "@var{language}"
-Specify the programming language for the generated parser.  Currently
-supported languages include C, C++, and Java.
address@hidden is case-insensitive.
-
-This directive is experimental and its effect may be modified in future
-releases.
address@hidden deffn
-
address@hidden {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 syntax error messages.
address@hidden deffn
-
address@hidden {Directive} %name-prefix "@var{prefix}"
-Rename the external symbols used in the parser so that they start with
address@hidden instead of @samp{yy}.  The precise list of symbols renamed
-in C parsers
-is @code{yyparse}, @code{yylex}, @code{yyerror}, @code{yynerrs},
address@hidden, @code{yychar}, @code{yydebug}, and
-(if locations are used) @code{yylloc}.  If you use a push parser,
address@hidden, @code{yypull_parse}, @code{yypstate},
address@hidden and @code{yypstate_delete} will
-also be renamed.  For example, if you use @samp{%name-prefix "c_"}, the
-names become @code{c_parse}, @code{c_lex}, and so on.
-For C++ parsers, see the @samp{%define api.namespace} documentation in this
-section.
address@hidden Parsers, ,Multiple Parsers in the Same Program}.
address@hidden deffn
-
address@hidden defaultprec
address@hidden {Directive} %no-default-prec
-Do not assign a precedence to rules lacking an explicit @code{%prec}
-modifier (@pxref{Contextual Precedence, ,Context-Dependent
-Precedence}).
address@hidden deffn
address@hidden ifset
-
address@hidden {Directive} %no-lines
-Don't generate any @code{#line} preprocessor commands in the parser
-implementation file.  Ordinarily Bison writes these commands in the
-parser implementation 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
-implementation file, treating it as an independent source file in its
-own right.
address@hidden deffn
-
address@hidden {Directive} %output "@var{file}"
-Specify @var{file} for the parser implementation file.
address@hidden deffn
-
address@hidden {Directive} %pure-parser
-Deprecated version of @samp{%define api.pure} (@pxref{Decl Summary, ,%define}),
-for which Bison is more careful to warn about unreasonable usage.
address@hidden deffn
-
address@hidden {Directive} %require "@var{version}"
-Require version @var{version} or higher of Bison.  @xref{Require Decl, ,
-Require a Version of Bison}.
address@hidden deffn
-
address@hidden {Directive} %skeleton "@var{file}"
-Specify the skeleton to use.
-
address@hidden You probably don't need this option unless you are developing 
Bison.
address@hidden You should use @code{%language} if you want to specify the 
skeleton for a
address@hidden different language, because it is clearer and because it will 
always choose the
address@hidden correct skeleton for non-deterministic or push parsers.
-
-If @var{file} does not contain a @code{/}, @var{file} is the name of a skeleton
-file in the Bison installation directory.
-If it does, @var{file} is an absolute file name or a file name relative to the
-directory of the grammar file.
-This is similar to how most shells resolve commands.
address@hidden deffn
-
address@hidden {Directive} %token-table
-Generate an array of token names in the parser implementation file.
-The name of the array is @code{yytname}; @address@hidden is
-the name of the token whose internal Bison token code number is
address@hidden  The first three elements of @code{yytname} correspond to the
-predefined tokens @code{"$end"}, @code{"error"}, and
address@hidden"$undefined"}; after these come the symbols defined in the
-grammar file.
-
-The name in the table includes all the characters needed to represent
-the token in Bison.  For single-character literals and literal
-strings, this includes the surrounding quoting characters and any
-escape sequences.  For example, the Bison single-character literal
address@hidden'+'} corresponds to a three-character name, represented in C as
address@hidden"'+'"}; and the Bison two-character literal string @code{"\\/"}
-corresponds to a five-character name, represented in C as
address@hidden"\"\\\\/\""}.
-
-When you specify @code{%token-table}, Bison also generates macro
-definitions for macros @code{YYNTOKENS}, @code{YYNNTS}, and
address@hidden, and @code{YYNSTATES}:
-
address@hidden @code
address@hidden YYNTOKENS
-The highest token number, plus one.
address@hidden YYNNTS
-The number of nonterminal symbols.
address@hidden YYNRULES
-The number of grammar rules,
address@hidden YYNSTATES
-The number of parser states (@pxref{Parser States}).
address@hidden table
address@hidden deffn
-
address@hidden {Directive} %verbose
-Write an extra output file containing verbose descriptions of the
-parser states and what is done for each type of lookahead token in
-that state.  @xref{Understanding, , Understanding Your Parser}, for more
-information.
address@hidden deffn
-
address@hidden {Directive} %yacc
-Pretend the option @option{--yacc} was given, i.e., imitate Yacc,
-including its naming conventions.  @xref{Bison Options}, for more.
address@hidden deffn
 
 @node %code Summary
 @subsection %code Summary
@@ -7328,16 +7338,14 @@ the two contexts causes a conflict later.  In parser 
terminology, this
 occurrence means that the grammar is not LALR(1).
 
 For many practical grammars (specifically those that fall into the
-non-LR(1) class), the limitations of LALR(1) result in
-difficulties beyond just mysterious reduce/reduce conflicts.
-The best way to fix all these problems is to select a different parser
-table generation algorithm.
-Either IELR(1) or canonical LR(1) would suffice, but
-the former is more efficient and easier to debug during development.
address@hidden Summary,,lr.type}, for details.
-(Bison's IELR(1) and canonical LR(1) implementations
-are experimental.
-More user feedback will help to stabilize them.)
+non-LR(1) class), the limitations of LALR(1) result in difficulties
+beyond just mysterious reduce/reduce conflicts.  The best way to fix
+all these problems is to select a different parser table generation
+algorithm.  Either IELR(1) or canonical LR(1) would suffice, but the
+former is more efficient and easier to debug during development.
address@hidden Summary,,lr.type}, for details.  (Bison's IELR(1) and
+canonical LR(1) implementations are experimental.  More user feedback
+will help to stabilize them.)
 
 If you instead wish to work around LALR(1)'s limitations, you
 can often fix a mysterious conflict by identifying the two parser states
@@ -8311,12 +8319,11 @@ compatibility with previous versions of Bison.
 
 @item the variable @samp{parse.trace}
 @findex %define parse.trace
-Add the @samp{%define parse.trace} directive (@pxref{Decl Summary,
-,Bison Declaration Summary}), or pass the @option{-Dparse.trace} option
+Add the @samp{%define parse.trace} directive (@pxref{%define
+Summary,,parse.trace}), or pass the @option{-Dparse.trace} option
 (@pxref{Bison Options}).  This is a Bison extension, which is especially
-useful for languages that don't use a preprocessor.  Unless
-POSIX and Yacc portability matter to you, this is the
-preferred solution.
+useful for languages that don't use a preprocessor.  Unless POSIX and Yacc
+portability matter to you, this is the preferred solution.
 @end table
 
 We suggest that you always enable the trace option so that debugging is
@@ -8559,7 +8566,7 @@ compiled.  @xref{Tracing, ,Tracing Your Parser}.
 @itemx -F @address@hidden
 @itemx address@hidden@var{value}]
 Each of these is equivalent to @samp{%define @var{name} "@var{value}"}
-(@pxref{Decl Summary, ,%define}) except that Bison processes multiple
+(@pxref{%define Summary}) except that Bison processes multiple
 definitions for the same @var{name} as follows:
 
 @itemize
@@ -8777,10 +8784,9 @@ The C++ deterministic parser is selected using the 
skeleton directive,
 When run, @command{bison} will create several entities in the @samp{yy}
 namespace.
 @findex %define api.namespace
-Use the @samp{%define api.namespace} directive to change the namespace
-name, see
address@hidden Summary}.
-The various classes are generated in the following files:
+Use the @samp{%define api.namespace} directive to change the namespace name,
+see @ref{%define Summary,,api.namespace}.  The various classes are generated
+in the following files:
 
 @table @file
 @item position.hh
@@ -8853,7 +8859,7 @@ limitations reported in the previous section, and in 
particular, object
 types can be used without pointers.
 
 To enable variant-based semantic values, set @code{%define} variable
address@hidden (@pxref{Decl Summary, , variant}).  Once this defined,
address@hidden (@pxref{%define Summary,, variant}).  Once this defined,
 @code{%union} is ignored, and instead of using the name of the fields of the
 @code{%union} to ``type'' the symbols, use genuine types.
 
@@ -9507,9 +9513,9 @@ The code between @samp{%code @{} and @address@hidden is 
output in the
 @noindent
 The token numbered as 0 corresponds to end of file; the following line
 allows for nicer error messages referring to ``end of file'' instead of
-``$end''.  Similarly user friendly names are provided for each symbol.
-To avoid name clashes in the generated files (@pxref{Calc++ Scanner}),
-prefix tokens with @code{TOK_} (@pxref{Decl Summary,, api.tokens.prefix}).
+``$end''.  Similarly user friendly names are provided for each symbol.  To
+avoid name clashes in the generated files (@pxref{Calc++ Scanner}), prefix
+tokens with @code{TOK_} (@pxref{%define Summary,,api.tokens.prefix}).
 
 @comment file: calc++-parser.yy
 @example
@@ -10891,8 +10897,7 @@ Precedence}.
 @deffn {Directive} %define @var{define-variable}
 @deffnx {Directive} %define @var{define-variable} @var{value}
 @deffnx {Directive} %define @var{define-variable} "@var{value}"
-Define a variable to adjust Bison's behavior.
address@hidden Summary,,%define}.
+Define a variable to adjust Bison's behavior.  @xref{%define Summary}.
 @end deffn
 
 @deffn {Directive} %defines
@@ -11022,8 +11027,9 @@ Bison declaration to assign precedence to token(s), but 
no associativity
 @end deffn
 
 @deffn {Directive} %pure-parser
-Deprecated version of @samp{%define api.pure} (@pxref{Decl Summary, ,%define}),
-for which Bison is more careful to warn about unreasonable usage.
+Deprecated version of @samp{%define api.pure} (@pxref{%define
+Summary,,api.pure}), for which Bison is more careful to warn about
+unreasonable usage.
 @end deffn
 
 @deffn {Directive} %require "@var{version}"
@@ -11297,8 +11303,8 @@ committee document contributing to what became the 
Algol 60 report.
 @xref{Language and Grammar, ,Languages and Context-Free Grammars}.
 
 @item Consistent State
-A state containing only one possible action.
address@hidden Summary,,lr.default-reductions}.
+A state containing only one possible action.  @xref{%define
+Summary,,lr.default-reductions}.
 
 @item Context-free grammars
 Grammars specified as rules that can be applied regardless of context.
@@ -11309,11 +11315,10 @@ Grammars}.
 
 @item Default Reduction
 The reduction that a parser should perform if the current parser state
-contains no other action for the lookahead token.
-In permitted parser states, Bison declares the reduction with the
-largest lookahead set to be the default reduction and removes that
-lookahead set.
address@hidden Summary,,lr.default-reductions}.
+contains no other action for the lookahead token.  In permitted parser
+states, Bison declares the reduction with the largest lookahead set to
+be the default reduction and removes that lookahead set.
address@hidden Summary,,lr.default-reductions}.
 
 @item Dynamic allocation
 Allocation of memory that occurs during execution, rather than at
@@ -11346,18 +11351,16 @@ for example, `expression' or `declaration' in 
address@hidden
 @xref{Language and Grammar, ,Languages and Context-Free Grammars}.
 
 @item IELR(1)
-A minimal LR(1) parser table generation algorithm.
-That is, given any context-free grammar, IELR(1) generates
-parser tables with the full language recognition power of canonical
-LR(1) but with nearly the same number of parser states as
-LALR(1).
-This reduction in parser states is often an order of magnitude.
-More importantly, because canonical LR(1)'s extra parser
-states may contain duplicate conflicts in the case of
-non-LR(1) grammars, the number of conflicts for
-IELR(1) is often an order of magnitude less as well.
-This can significantly reduce the complexity of developing of a grammar.
address@hidden Summary,,lr.type}.
+A minimal LR(1) parser table generation algorithm.  That is, given any
+context-free grammar, IELR(1) generates parser tables with the full
+language recognition power of canonical LR(1) but with nearly the same
+number of parser states as LALR(1).  This reduction in parser states
+is often an order of magnitude.  More importantly, because canonical
+LR(1)'s extra parser states may contain duplicate conflicts in the
+case of non-LR(1) grammars, the number of conflicts for IELR(1) is
+often an order of magnitude less as well.  This can significantly
+reduce the complexity of developing of a grammar.  @xref{%define
+Summary,,lr.type}.
 
 @item Infix operator
 An arithmetic operator that is placed between the operands on which it
@@ -11368,11 +11371,12 @@ A continuous flow of data between devices or programs.
 
 @item LAC (Lookahead Correction)
 A parsing mechanism that fixes the problem of delayed syntax error
-detection, which is caused by LR state merging, default reductions, and
-the use of @code{%nonassoc}.  Delayed syntax error detection results in
-unexpected semantic actions, initiation of error recovery in the wrong
-syntactic context, and an incorrect list of expected tokens in a verbose
-syntax error message.  @xref{Decl Summary,,parse.lac}.
+detection, which is caused by LR state merging, default reductions,
+and the use of @code{%nonassoc}.  Delayed syntax error detection
+results in unexpected semantic actions, initiation of error recovery
+in the wrong syntactic context, and an incorrect list of expected
+tokens in a verbose syntax error message.  @xref{%define
+Summary,,parse.lac}.
 
 @item Language construct
 One of the typical usage schemas of the language.  For example, one of
-- 
1.7.0.4


>From 51151d91716c3113f809c22871fc83edda06d094 Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Sun, 6 Feb 2011 14:18:01 -0500
Subject: [PATCH 6/7] doc: clean up new subsections in manual.

* doc/bison.texinfo (%define Summary): Reword so it reads well as
a separate section.  For example, add an intro, and move most of
the text outside of the @deffn so it is not indented so far.
(%code Summary): Likewise.
(Table of Symbols): Reword %code entry to match the %code entry in
Decl Summary.
(cherry picked from commit 406dec82864f5015bca1cb8c4b0cc298dea39374)

Conflicts:

        doc/bison.texinfo
---
 ChangeLog         |   10 +++++
 doc/bison.texinfo |   95 ++++++++++++++++++++++++++++++++--------------------
 2 files changed, 68 insertions(+), 37 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 869e503..815fff5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2011-02-06  Joel E. Denny  <address@hidden>
 
+       doc: clean up new subsections in manual.
+       * doc/bison.texinfo (%define Summary): Reword so it reads well as
+       a separate section.  For example, add an intro, and move most of
+       the text outside of the @deffn so it is not indented so far.
+       (%code Summary): Likewise.
+       (Table of Symbols): Reword %code entry to match the %code entry in
+       Decl Summary.
+
+2011-02-06  Joel E. Denny  <address@hidden>
+
        doc: finish splitting apart the manual's Decl Summary section.
        Suggested by Akim Demaille at
        <http://lists.gnu.org/archive/html/bison-patches/2009-05/msg00013.html>.
diff --git a/doc/bison.texinfo b/doc/bison.texinfo
index 0e7038b..e391187 100644
--- a/doc/bison.texinfo
+++ b/doc/bison.texinfo
@@ -5146,23 +5146,35 @@ including its naming conventions.  @xref{Bison 
Options}, for more.
 
 @node %define Summary
 @subsection %define Summary
+
+There are many features of Bison's behavior that can be controlled by
+assigning the feature a single value.  For historical reasons, some
+such features are assigned values by dedicated directives, such as
address@hidden, which assigns the start symbol.  However, newer such
+features are associated with variables, which are assigned by the
address@hidden directive:
+
 @deffn {Directive} %define @var{variable}
 @deffnx {Directive} %define @var{variable} @var{value}
 @deffnx {Directive} %define @var{variable} "@var{value}"
-Define a variable to adjust Bison's behavior.
+Define @var{variable} to @var{value}.
 
-It is an error if a @var{variable} is defined by @code{%define} multiple
-times, but see @ref{Bison Options,,-D @address@hidden
address@hidden must be placed in quotation marks if it contains any
+character other than a letter, underscore, period, or non-initial dash
+or digit.  Omitting @code{"@var{value}"} entirely is always equivalent
+to specifying @code{""}.
 
address@hidden must be placed in quotation marks if it contains any character
-other than a letter, underscore, period, or non-initial dash or digit.
+It is an error if a @var{variable} is defined by @code{%define}
+multiple times, but see @ref{Bison Options,,-D
address@hidden@var{value}]}.
address@hidden deffn
 
-Omitting @code{"@var{value}"} entirely is always equivalent to specifying
address@hidden""}.
+The rest of this section summarizes variables and values that
address@hidden accepts.
 
-Some @var{variable}s take Boolean values.
-In this case, Bison will complain if the variable definition does not meet one
-of the following four conditions:
+Some @var{variable}s take Boolean values.  In this case, Bison will
+complain if the variable definition does not meet one of the following
+four conditions:
 
 @enumerate
 @item @address@hidden is @code{true}
@@ -5715,43 +5727,51 @@ Boolean.
 @code{false}
 @end itemize
 @c variant
-
-
 @end table
address@hidden deffn
 
 
 @node %code Summary
 @subsection %code Summary
address@hidden {Directive} %code @address@hidden@}
 @findex %code
-This is the unqualified form of the @code{%code} directive.
-It inserts @var{code} verbatim at a language-dependent default location in the
address@hidden default location is actually skeleton-dependent;
-  writers of non-standard skeletons however should choose the default location
-  consistently with the behavior of the standard Bison skeletons.}.
-
 @cindex Prologue
+
+The @code{%code} directive inserts code verbatim into the output
+parser source at any of a predefined set of locations.  It thus serves
+as a flexible and user-friendly alternative to the traditional Yacc
+prologue, @address@hidden@address@hidden  This section summarizes the
+functionality of @code{%code} for the various target languages
+supported by Bison.  For a detailed discussion of how to use
address@hidden in place of @address@hidden@address@hidden for C/C++ and why it
+is advantageous to do so, @pxref{Prologue Alternatives}.
+
address@hidden {Directive} %code @address@hidden@}
+This is the unqualified form of the @code{%code} directive.  It
+inserts @var{code} verbatim at a language-dependent default location
+in the parser implementation.
+
 For C/C++, the default location is the parser implementation file
-after the usual contents of the parser header file.  Thus,
address@hidden replaces the traditional Yacc prologue,
address@hidden@address@hidden@}}, for most purposes.  For a detailed
-discussion, see @ref{Prologue Alternatives}.
+after the usual contents of the parser header file.  Thus, the
+unqualified form replaces @address@hidden@address@hidden for most purposes.
 
 For Java, the default location is inside the parser class.
 @end deffn
 
 @deffn {Directive} %code @var{qualifier} @address@hidden@}
 This is the qualified form of the @code{%code} directive.
-If you need to specify location-sensitive verbatim @var{code} that does not
-belong at the default location selected by the unqualified @code{%code} form,
-use this form instead.
address@hidden identifies the purpose of @var{code} and thus the
+location(s) where Bison should insert it.  That is, if you need to
+specify location-sensitive @var{code} that does not belong at the
+default location selected by the unqualified @code{%code} form, use
+this form instead.
address@hidden deffn
+
+For any particular qualifier or for the unqualified form, if there are
+multiple occurrences of the @code{%code} directive, Bison concatenates
+the specified code in the order in which it appears in the grammar
+file.
 
address@hidden identifies the purpose of @var{code} and thus the location(s)
-where Bison should generate it.
-Not all @var{qualifier}s are accepted for all target languages.
-Unaccepted @var{qualifier}s produce an error.
-Some of the accepted @var{qualifier}s are:
+Not all qualifiers are accepted for all target languages.  Unaccepted
+qualifiers produce an error.  Some of the accepted qualifiers are:
 
 @itemize @bullet
 @item requires
@@ -5819,10 +5839,10 @@ before any class definitions.
 @end itemize
 @end itemize
 
address@hidden Prologue
-For a detailed discussion of how to use @code{%code} in place of the
-traditional Yacc prologue for C/C++, see @ref{Prologue Alternatives}.
address@hidden deffn
+Though we say the insertion locations are language-dependent, they are
+technically skeleton-dependent.  Writers of non-standard skeletons
+however should choose their locations consistently with the behavior
+of the standard Bison skeletons.
 
 
 @node Multiple Parsers
@@ -10878,7 +10898,8 @@ Start-Symbol}.  It cannot be used in the grammar.
 
 @deffn {Directive} %code @address@hidden@}
 @deffnx {Directive} %code @var{qualifier} @address@hidden@}
-Insert @var{code} verbatim into output parser source.
+Insert @var{code} verbatim into the output parser source at the
+default location or at the location specified by @var{qualifier}.
 @xref{%code Summary}.
 @end deffn
 
-- 
1.7.0.4


>From 84072495292eb90d6683fbabe159bf8900193810 Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Sun, 13 Feb 2011 12:02:31 -0500
Subject: [PATCH 7/7] doc: fix some minor inconsistencies.

* doc/bison.texinfo (%define Summary): Fix mislabeled entry for
lex_symbol.
(%code Summary): For consistency with the variable list in the
%define Summary, enclose the list of %code qualifiers in a table
instead of an itemize.
---
 ChangeLog         |    9 +++++++++
 doc/bison.texinfo |    6 +++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 815fff5..3a6e81e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-02-13  Joel E. Denny  <address@hidden>
+
+       doc: fix some minor inconsistencies.
+       * doc/bison.texinfo (%define Summary): Fix mislabeled entry for
+       lex_symbol.
+       (%code Summary): For consistency with the variable list in the
+       %define Summary, enclose the list of %code qualifiers in a table
+       instead of an itemize.
+
 2011-02-06  Joel E. Denny  <address@hidden>
 
        doc: clean up new subsections in manual.
diff --git a/doc/bison.texinfo b/doc/bison.texinfo
index e391187..0ed453e 100644
--- a/doc/bison.texinfo
+++ b/doc/bison.texinfo
@@ -5327,7 +5327,7 @@ empty
 
 
 @c ================================================== lex_symbol
address@hidden variant
address@hidden lex_symbol
 @findex %define lex_symbol
 
 @itemize @bullet
@@ -5773,7 +5773,7 @@ file.
 Not all qualifiers are accepted for all target languages.  Unaccepted
 qualifiers produce an error.  Some of the accepted qualifiers are:
 
address@hidden @bullet
address@hidden @code
 @item requires
 @findex %code requires
 
@@ -5837,7 +5837,7 @@ parser implementation file.  For example:
 @item Location(s): The parser Java file after any Java package directive and
 before any class definitions.
 @end itemize
address@hidden itemize
address@hidden table
 
 Though we say the insertion locations are language-dependent, they are
 technically skeleton-dependent.  Writers of non-standard skeletons
-- 
1.7.0.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]