]> git.saurik.com Git - bison.git/blobdiff - doc/bison.texinfo
Do not use date ranges in copyright notices.
[bison.git] / doc / bison.texinfo
index c91a740a68c1882c938dfc5f37698477445efde5..4027388d5151e083907d28d5847e87944f32a2ae 100644 (file)
 This manual (@value{UPDATED}) is for @acronym{GNU} Bison (version
 @value{VERSION}), the @acronym{GNU} parser generator.
 
 This manual (@value{UPDATED}) is for @acronym{GNU} Bison (version
 @value{VERSION}), the @acronym{GNU} parser generator.
 
-Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998,
-1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free
+Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998, 1999,
+2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
 Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the @acronym{GNU} Free Documentation License,
 Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the @acronym{GNU} Free Documentation License,
-Version 1.2 or any later version published by the Free Software
+Version 1.3 or any later version published by the Free Software
 Foundation; with no Invariant Sections, with the Front-Cover texts
 being ``A @acronym{GNU} Manual,'' and with the Back-Cover Texts as in
 (a) below.  A copy of the license is included in the section entitled
 Foundation; with no Invariant Sections, with the Front-Cover texts
 being ``A @acronym{GNU} Manual,'' and with the Back-Cover Texts as in
 (a) below.  A copy of the license is included in the section entitled
@@ -3800,8 +3800,11 @@ typedef struct YYLTYPE
 @} YYLTYPE;
 @end example
 
 @} YYLTYPE;
 @end example
 
-At the beginning of the parsing, Bison initializes all these fields to 1
-for @code{yylloc}.
+When @code{YYLTYPE} is not defined, at the beginning of the parsing, Bison
+initializes all these fields to 1 for @code{yylloc}.  To initialize
+@code{yylloc} with a custom location type (or to chose a different
+initialization), use the @code{%initial-action} directive.  @xref{Initial
+Action Decl, , Performing Actions before Parsing}.
 
 @node Actions and Locations
 @subsection Actions and Locations
 
 @node Actions and Locations
 @subsection Actions and Locations
@@ -5348,7 +5351,7 @@ This function is available if either the @code{%define api.push_pull "push"} or
 @xref{Push Decl, ,A Push Parser}.
 
 @deftypefun yypstate *yypstate_new (void)
 @xref{Push Decl, ,A Push Parser}.
 
 @deftypefun yypstate *yypstate_new (void)
-The fuction will return a valid parser instance if there was memory available
+The function will return a valid parser instance if there was memory available
 or 0 if no memory was available.
 In impure mode, it will also return 0 if a parser instance is currently
 allocated.
 or 0 if no memory was available.
 In impure mode, it will also return 0 if a parser instance is currently
 allocated.
@@ -6805,7 +6808,7 @@ that allows variable-length arrays.  The default is 200.
 Do not allow @code{YYINITDEPTH} to be greater than @code{YYMAXDEPTH}.
 
 @c FIXME: C++ output.
 Do not allow @code{YYINITDEPTH} to be greater than @code{YYMAXDEPTH}.
 
 @c FIXME: C++ output.
-Because of semantical differences between C and C++, the
+Because of semantic differences between C and C++, the
 @acronym{LALR}(1) parsers in C produced by Bison cannot grow when compiled
 by C++ compilers.  In this precise case (compiling a C parser as C++) you are
 suggested to grow @code{YYINITDEPTH}.  The Bison maintainers hope to fix
 @acronym{LALR}(1) parsers in C produced by Bison cannot grow when compiled
 by C++ compilers.  In this precise case (compiling a C parser as C++) you are
 suggested to grow @code{YYINITDEPTH}.  The Bison maintainers hope to fix
@@ -8011,8 +8014,8 @@ int yyparse (void);
 @c - initial action
 
 The C++ @acronym{LALR}(1) parser is selected using the skeleton directive,
 @c - initial action
 
 The C++ @acronym{LALR}(1) parser is selected using the skeleton directive,
-@samp{%skeleton "lalr1.c"}, or the synonymous command-line option
-@option{--skeleton=lalr1.c}.
+@samp{%skeleton "lalr1.cc"}, or the synonymous command-line option
+@option{--skeleton=lalr1.cc}.
 @xref{Decl Summary}.
 
 When run, @command{bison} will create several entities in the @samp{yy}
 @xref{Decl Summary}.
 
 When run, @command{bison} will create several entities in the @samp{yy}
@@ -8161,11 +8164,19 @@ this class is detailed below.  It can be extended using the
 it describes an additional member of the parser class, and an
 additional argument for its constructor.
 
 it describes an additional member of the parser class, and an
 additional argument for its constructor.
 
-@defcv {Type} {parser} {semantic_value_type}
-@defcvx {Type} {parser} {location_value_type}
+@defcv {Type} {parser} {semantic_type}
+@defcvx {Type} {parser} {location_type}
 The types for semantics value and locations.
 @end defcv
 
 The types for semantics value and locations.
 @end defcv
 
+@defcv {Type} {parser} {token}
+A structure that contains (only) the definition of the tokens as the
+@code{yytokentype} enumeration.  To refer to the token @code{FOO}, the
+scanner should use @code{yy::parser::token::FOO}.  The scanner can use
+@samp{typedef yy::parser::token token;} to ``import'' the token enumeration
+(@pxref{Calc++ Scanner}).
+@end defcv
+
 @deftypemethod {parser} {} parser (@var{type1} @var{arg1}, ...)
 Build a new parser object.  There are no arguments by default, unless
 @samp{%parse-param @{@var{type1} @var{arg1}@}} was used.
 @deftypemethod {parser} {} parser (@var{type1} @var{arg1}, ...)
 Build a new parser object.  There are no arguments by default, unless
 @samp{%parse-param @{@var{type1} @var{arg1}@}} was used.
@@ -8204,7 +8215,7 @@ The parser invokes the scanner by calling @code{yylex}.  Contrary to C
 parsers, C++ parsers are always pure: there is no point in using the
 @code{%define api.pure} directive.  Therefore the interface is as follows.
 
 parsers, C++ parsers are always pure: there is no point in using the
 @code{%define api.pure} directive.  Therefore the interface is as follows.
 
-@deftypemethod {parser} {int} yylex (semantic_value_type& @var{yylval}, location_type& @var{yylloc}, @var{type1} @var{arg1}, ...)
+@deftypemethod {parser} {int} yylex (semantic_type* @var{yylval}, location_type* @var{yylloc}, @var{type1} @var{arg1}, ...)
 Return the next token.  Its type is the return value, its semantic
 value and location being @var{yylval} and @var{yylloc}.  Invocations of
 @samp{%lex-param @{@var{type1} @var{arg1}@}} yield additional arguments.
 Return the next token.  Its type is the return value, its semantic
 value and location being @var{yylval} and @var{yylloc}.  Invocations of
 @samp{%lex-param @{@var{type1} @var{arg1}@}} yield additional arguments.
@@ -8444,7 +8455,7 @@ global variables.
 
 @noindent
 Then we request the location tracking feature, and initialize the
 
 @noindent
 Then we request the location tracking feature, and initialize the
-first location's file name.  Afterwards new locations are computed
+first location's file name.  Afterward new locations are computed
 relatively to the previous locations: the file name will be
 automatically propagated.
 
 relatively to the previous locations: the file name will be
 automatically propagated.
 
@@ -8848,7 +8859,7 @@ The first, inclusive, position of the range, and the first beyond.
 @end deftypeivar
 
 @deftypeop {Constructor} {Location} {} Location (Position @var{loc})
 @end deftypeivar
 
 @deftypeop {Constructor} {Location} {} Location (Position @var{loc})
-Create a @code{Location} denoting an empty range located at a given point. 
+Create a @code{Location} denoting an empty range located at a given point.
 @end deftypeop
 
 @deftypeop {Constructor} {Location} {} Location (Position @var{begin}, Position @var{end})
 @end deftypeop
 
 @deftypeop {Constructor} {Location} {} Location (Position @var{begin}, Position @var{end})
@@ -8978,7 +8989,7 @@ changed using @code{%define location_type "@var{class-name}".}
 
 @deftypemethod {Lexer} {int} yylex ()
 Return the next token.  Its type is the return value, its semantic
 
 @deftypemethod {Lexer} {int} yylex ()
 Return the next token.  Its type is the return value, its semantic
-value and location are saved and returned by the ther methods in the
+value and location are saved and returned by the their methods in the
 interface.
 
 Use @code{%define lex_throws} to specify any uncaught exceptions.
 interface.
 
 Use @code{%define lex_throws} to specify any uncaught exceptions.
@@ -8996,7 +9007,7 @@ The return type can be changed using @code{%define position_type
 @end deftypemethod
 
 @deftypemethod {Lexer} {Object} getLVal ()
 @end deftypemethod
 
 @deftypemethod {Lexer} {Object} getLVal ()
-Return the semantical value of the last token that yylex returned.
+Return the semantic value of the last token that yylex returned.
 
 The return type can be changed using @code{%define stype
 "@var{class-name}".}
 
 The return type can be changed using @code{%define stype
 "@var{class-name}".}
@@ -9062,12 +9073,7 @@ Return immediately from the parser, indicating success.
 @end deffn
 
 @deffn {Statement} {return YYERROR;}
 @end deffn
 
 @deffn {Statement} {return YYERROR;}
-Start error recovery without printing an error message. 
-@xref{Error Recovery}.
-@end deffn
-
-@deffn {Statement} {return YYFAIL;}
-Print an error message and start error recovery. 
+Start error recovery without printing an error message.
 @xref{Error Recovery}.
 @end deffn
 
 @xref{Error Recovery}.
 @end deffn
 
@@ -9112,7 +9118,7 @@ corresponds to these C macros.}.
 @item
 Java lacks unions, so @code{%union} has no effect.  Instead, semantic
 values have a common base type: @code{Object} or as specified by
 @item
 Java lacks unions, so @code{%union} has no effect.  Instead, semantic
 values have a common base type: @code{Object} or as specified by
-@code{%define stype}.  Angle backets on @code{%token}, @code{type},
+@samp{%define stype}.  Angle brackets on @code{%token}, @code{type},
 @code{$@var{n}} and @code{$$} specify subtypes rather than fields of
 an union.  The type of @code{$$}, even with angle brackets, is the base
 type since Java casts are not allow on the left-hand side of assignments.
 @code{$@var{n}} and @code{$$} specify subtypes rather than fields of
 an union.  The type of @code{$$}, even with angle brackets, is the base
 type since Java casts are not allow on the left-hand side of assignments.
@@ -9121,7 +9127,7 @@ left-hand side of assignments. See @pxref{Java Semantic Values} and
 @pxref{Java Action Features}.
 
 @item
 @pxref{Java Action Features}.
 
 @item
-The prolog declarations have a different meaning than in C/C++ code.
+The prologue declarations have a different meaning than in C/C++ code.
 @table @asis
 @item @code{%code imports}
 blocks are placed at the beginning of the Java source code.  They may
 @table @asis
 @item @code{%code imports}
 blocks are placed at the beginning of the Java source code.  They may
@@ -10339,6 +10345,10 @@ grammatically indivisible.  The piece of text it represents is a token.
 
 @bye
 
 
 @bye
 
+@c Local Variables:
+@c fill-column: 76
+@c End:
+
 @c LocalWords: texinfo setfilename settitle setchapternewpage finalout
 @c LocalWords: ifinfo smallbook shorttitlepage titlepage GPL FIXME iftex
 @c LocalWords: akim fn cp syncodeindex vr tp synindex dircategory direntry
 @c LocalWords: texinfo setfilename settitle setchapternewpage finalout
 @c LocalWords: ifinfo smallbook shorttitlepage titlepage GPL FIXME iftex
 @c LocalWords: akim fn cp syncodeindex vr tp synindex dircategory direntry