X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/92ac370570776d9021d21e1f3ca43a127e981956..d63282419d27320c40be57d46418a0b44691626c:/doc/bison.texinfo diff --git a/doc/bison.texinfo b/doc/bison.texinfo index c1bff43c..22e5da91 100644 --- a/doc/bison.texinfo +++ b/doc/bison.texinfo @@ -44,7 +44,7 @@ This manual is for @acronym{GNU} Bison (version @value{VERSION}, @value{UPDATED}), the @acronym{GNU} parser generator. Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998, -1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -223,7 +223,7 @@ Bison Declarations * Union Decl:: Declaring the set of all semantic value types. * Type Decl:: Declaring the choice of type for a nonterminal symbol. * Destructor Decl:: Declaring how symbols are freed. -* Expect Decl:: Suppressing warnings about shift/reduce conflicts. +* Expect Decl:: Suppressing warnings about parsing conflicts. * Start Decl:: Specifying the start symbol. * Pure Decl:: Requesting a reentrant parser. * Decl Summary:: Table of all Bison declarations. @@ -356,7 +356,7 @@ encourage people to make other software free. So we decided to make the practical conditions for using Bison match the practical conditions for using the other @acronym{GNU} tools. -This exception applies only when Bison is generating C code for a +This exception applies only when Bison is generating C code for an @acronym{LALR}(1) parser; otherwise, the @acronym{GPL} terms operate as usual. You can tell whether the exception applies to your @samp{.c} output file by @@ -3280,7 +3280,7 @@ Grammars}). * Union Decl:: Declaring the set of all semantic value types. * Type Decl:: Declaring the choice of type for a nonterminal symbol. * Destructor Decl:: Declaring how symbols are freed. -* Expect Decl:: Suppressing warnings about shift/reduce conflicts. +* Expect Decl:: Suppressing warnings about parsing conflicts. * Start Decl:: Specifying the start symbol. * Pure Decl:: Requesting a reentrant parser. * Decl Summary:: Table of all Bison declarations. @@ -3309,10 +3309,12 @@ associativity and precedence. @xref{Precedence Decl, ,Operator Precedence}. You can explicitly specify the numeric code for a token type by appending -an integer value in the field immediately following the token name: +a decimal or hexadecimal integer value in the field immediately +following the token name: @example %token NUM 300 +%token XNUM 0x12d // a GNU extension @end example @noindent @@ -3558,6 +3560,7 @@ typefull: string; // $$ = $1 applies, $1 is not destroyed. @cindex warnings, preventing @cindex conflicts, suppressing warnings of @findex %expect +@findex %expect-rr Bison normally warns if there are any conflicts in the grammar (@pxref{Shift/Reduce, ,Shift/Reduce Conflicts}), but most real grammars @@ -3578,6 +3581,18 @@ reduce/reduce conflicts. The usual warning is given if there are either more or fewer conflicts, or if there are any reduce/reduce conflicts. +For normal LALR(1) parsers, reduce/reduce conflicts are more serious, +and should be eliminated entirely. Bison will always report +reduce/reduce conflicts for these parsers. With GLR parsers, however, +both shift/reduce and reduce/reduce are routine (otherwise, there +would be no need to use GLR parsing). Therefore, it is also possible +to specify an expected number of reduce/reduce conflicts in GLR +parsers, using the declaration: + +@example +%expect-rr @var{n} +@end example + In general, using @code{%expect} involves these steps: @itemize @bullet @@ -6214,7 +6229,7 @@ compatibility with @acronym{POSIX}: @example #! /bin/sh -bison -y "$@" +bison -y "$@@" @end example @end table @@ -6508,6 +6523,11 @@ handle features like include files, you might consider using Flex functions like @samp{yy_switch_to_buffer} that manipulate multiple input buffers. +If your Flex-generated scanner uses start conditions (@pxref{Start +conditions, , Start conditions, flex, The Flex Manual}), you might +also want to reset the scanner's state, i.e., go back to the initial +start condition, through a call to @samp{BEGIN (0)}. + @node Strings are Destroyed @section Strings are Destroyed