%merge: clearer tests on diagnostics
[bison.git] / NEWS
blob1fd12f9f2131c3f5315a59c1023bba03f7aac4c4
1 GNU Bison NEWS
3 * Noteworthy changes in release ?.? (????-??-??) [?]
5 ** Bug fixes
7 *** C-language parsers now work around quirks of HP-UX 11.23 (2003).
9 * Noteworthy changes in release 3.7.4 (2020-11-14) [stable]
11 ** Bug fixes
13 *** Bug fixes in yacc.c
15   In Yacc mode, all the tokens are defined twice: once as an enum, and then
16   as a macro.  YYEMPTY was missing its macro.
18 *** Bug fixes in lalr1.cc
20   The lalr1.cc skeleton used to emit internal assertions (using YY_ASSERT)
21   even when the `parse.assert` %define variable is not enabled.  It no
22   longer does.
24   The private internal macro YY_ASSERT now obeys the `api.prefix` %define
25   variable.
27   When there is a very large number of tokens, some assertions could be long
28   enough to hit arbitrary limits in Visual C++.  They have been rewritten to
29   work around this limitation.
31 ** Changes
33   The YYBISON macro in generated "regular C parsers" (from the "yacc.c"
34   skeleton) used to be defined to 1.  It is now defined to the version of
35   Bison as an integer (e.g., 30704 for version 3.7.4).
37 * Noteworthy changes in release 3.7.3 (2020-10-13) [stable]
39 ** Bug fixes
41   Fix concurrent build issues.
43   The bison executable is no longer linked uselessly against libreadline.
45   Fix incorrect use of yytname in glr.cc.
47 * Noteworthy changes in release 3.7.2 (2020-09-05) [stable]
49   This release of Bison fixes all known bugs reported for Bison in MITRE's
50   Common Vulnerabilities and Exposures (CVE) system.  These vulnerabilities
51   are only about bison-the-program itself, not the generated code.
53   Although these bugs are typically irrelevant to how Bison is used, they
54   are worth fixing if only to give users peace of mind.
56   There is no known vulnerability in the generated parsers.
58 ** Bug fixes
60   Fix concurrent build issues (introduced in Bison 3.5).
62   Push parsers always use YYMALLOC/YYFREE (no direct calls to malloc/free).
64   Fix portability issues of the test suite, and of bison itself.
66   Some unlikely crashes found by fuzzing have been fixed.  This is only
67   about bison itself, not the generated parsers.
70 * Noteworthy changes in release 3.7.1 (2020-08-02) [stable]
72 ** Bug fixes
74   Crash when a token alias contains a NUL byte.
76   Portability issues with libtextstyle.
78   Portability issues of Bison itself with MSVC.
80 ** Changes
82   Improvements and fixes in the documentation.
84   More precise location about symbol type redefinitions.
87 * Noteworthy changes in release 3.7 (2020-07-23) [stable]
89 ** Deprecated features
91   The YYPRINT macro, which works only with yacc.c and only for tokens, was
92   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
93   It is deprecated and its support will be removed eventually.
95   In conformance with the recommendations of the Graphviz team, in the next
96   version Bison the option `--graph` will generate a *.gv file by default,
97   instead of *.dot.  A transition started in Bison 3.4.
99 ** New features
101 *** Counterexample Generation
103   Contributed by Vincent Imbimbo.
105   When given `-Wcounterexamples`/`-Wcex`, bison will now output
106   counterexamples for conflicts.
108 **** Unifying Counterexamples
110   Unifying counterexamples are strings which can be parsed in two ways due
111   to the conflict.  For example on a grammar that contains the usual
112   "dangling else" ambiguity:
114     $ bison else.y
115     else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
116     else.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
118     $ bison else.y -Wcex
119     else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
120     else.y: warning: shift/reduce conflict on token "else" [-Wcounterexamples]
121       Example: "if" exp "then" "if" exp "then" exp • "else" exp
122       Shift derivation
123         exp
124         ↳ "if" exp "then" exp
125                           ↳ "if" exp "then" exp • "else" exp
126       Example: "if" exp "then" "if" exp "then" exp • "else" exp
127       Reduce derivation
128         exp
129         ↳ "if" exp "then" exp                     "else" exp
130                           ↳ "if" exp "then" exp •
132   When text styling is enabled, colors are used in the examples and the
133   derivations to highlight the structure of both analyses.  In this case,
135     "if" exp "then" [ "if" exp "then" exp • ] "else" exp
137   vs.
139     "if" exp "then" [ "if" exp "then" exp • "else" exp ]
142   The counterexamples are "focused", in two different ways.  First, they do
143   not clutter the output with all the derivations from the start symbol,
144   rather they start on the "conflicted nonterminal". They go straight to the
145   point.  Second, they don't "expand" nonterminal symbols uselessly.
147 **** Nonunifying Counterexamples
149   In the case of the dangling else, Bison found an example that can be
150   parsed in two ways (therefore proving that the grammar is ambiguous).
151   When it cannot find such an example, it instead generates two examples
152   that are the same up until the dot:
154     $ bison foo.y
155     foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
156     foo.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
157     foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
158         4 | a: expr
159           |    ^~~~
161     $ bison -Wcex foo.y
162     foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
163     foo.y: warning: shift/reduce conflict on token ID [-Wcounterexamples]
164       First example: expr • ID ',' ID $end
165       Shift derivation
166         $accept
167         ↳ s                      $end
168           ↳ a                 ID
169             ↳ expr
170               ↳ expr • ID ','
171       Second example: expr • ID $end
172       Reduce derivation
173         $accept
174         ↳ s             $end
175           ↳ a        ID
176             ↳ expr •
177     foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
178         4 | a: expr
179           |    ^~~~
181   In these cases, the parser usually doesn't have enough lookahead to
182   differentiate the two given examples.
184 **** Reports
186   Counterexamples are also included in the report when given
187   `--report=counterexamples`/`-rcex` (or `--report=all`), with more
188   technical details:
190     State 7
192       1 exp: "if" exp "then" exp •  [$end, "then", "else"]
193       2    | "if" exp "then" exp • "else" exp
195       "else"  shift, and go to state 8
197       "else"    [reduce using rule 1 (exp)]
198       $default  reduce using rule 1 (exp)
200       shift/reduce conflict on token "else":
201           1 exp: "if" exp "then" exp •
202           2 exp: "if" exp "then" exp • "else" exp
203         Example: "if" exp "then" "if" exp "then" exp • "else" exp
204         Shift derivation
205           exp
206           ↳ "if" exp "then" exp
207                             ↳ "if" exp "then" exp • "else" exp
208         Example: "if" exp "then" "if" exp "then" exp • "else" exp
209         Reduce derivation
210           exp
211           ↳ "if" exp "then" exp                     "else" exp
212                             ↳ "if" exp "then" exp •
214 *** File prefix mapping
216   Contributed by Joshua Watt.
218   Bison learned a new argument, `--file-prefix-map OLD=NEW`.  Any file path
219   in the output (specifically `#line` directives and `#ifdef` header guards)
220   that begins with the prefix OLD will have it replaced with the prefix NEW,
221   similar to the `-ffile-prefix-map` in GCC.  This option can be used to
222   make bison output reproducible.
224 ** Changes
226 *** Diagnostics
228   When text styling is enabled and the terminal supports it, the warnings
229   now include hyperlinks to the documentation.
231 *** Relocatable installation
233   When installed to be relocatable (via `configure --enable-relocatable`),
234   bison will now also look for a relocated m4.
236 *** C++ file names
238   The `filename_type` %define variable was renamed `api.filename.type`.
239   Instead of
241     %define filename_type "symbol"
243   write
245     %define api.filename.type {symbol}
247   (Or let `bison --update` do it for you).
249   It now defaults to `const std::string` instead of `std::string`.
251 *** Deprecated %define variable names
253   The following variables have been renamed for consistency.  Backward
254   compatibility is ensured, but upgrading is recommended.
256     filename_type       -> api.filename.type
257     package             -> api.package
259 *** Push parsers no longer clear their state when parsing is finished
261   Previously push-parsers cleared their state when parsing was finished (on
262   success and on failure).  This made it impossible to check if there were
263   parse errors, since `yynerrs` was also reset.  This can be especially
264   troublesome when used in autocompletion, since a parser with error
265   recovery would suggest (irrelevant) expected tokens even if there were
266   failure.
268   Now the parser state can be examined when parsing is finished.  The parser
269   state is reset when starting a new parse.
271 ** Documentation
273 *** Examples
275   The bistromathic demonstrates %param and how to quote sources in the error
276   messages:
278     > 123 456
279     1.5-7: syntax error: expected end of file or + or - or * or / or ^ before number
280         1 | 123 456
281           |     ^~~
283 ** Bug fixes
285 *** Include the generated header (yacc.c)
287   Historically, when --defines was used, bison generated a header and pasted
288   an exact copy of it into the generated parser implementation file.  Since
289   Bison 3.4 it is possible to specify that the header should be `#include`d,
290   and how.  For instance
292     %define api.header.include {"parse.h"}
294   or
296     %define api.header.include {<parser/parse.h>}
298   Now api.header.include defaults to `"header-basename"`, as was intended in
299   Bison 3.4, where `header-basename` is the basename of the generated
300   header.  This is disabled when the generated header is `y.tab.h`, to
301   comply with Automake's ylwrap.
303 *** String aliases are faithfully propagated
305   Bison used to interpret user strings (i.e., decoding backslash escapes)
306   when reading them, and to escape them (i.e., issue non-printable
307   characters as backslash escapes, taking the locale into account) when
308   outputting them.  As a consequence non-ASCII strings (say in UTF-8) ended
309   up "ciphered" as sequences of backslash escapes.  This happened not only
310   in the generated sources (where the compiler will reinterpret them), but
311   also in all the generated reports (text, xml, html, dot, etc.).  Reports
312   were therefore not readable when string aliases were not pure ASCII.
313   Worse yet: the output depended on the user's locale.
315   Now Bison faithfully treats the string aliases exactly the way the user
316   spelled them.  This fixes all the aforementioned problems.  However, now,
317   string aliases semantically equivalent but syntactically different (e.g.,
318   "A", "\x41", "\101") are considered to be different.
320 *** Crash when generating IELR
322   An old, well hidden, bug in the generation of IELR parsers was fixed.
325 * Noteworthy changes in release 3.6.4 (2020-06-15) [stable]
327 ** Bug fixes
329   In glr.cc some internal macros leaked in the user's code, and could damage
330   access to the token kinds.
333 * Noteworthy changes in release 3.6.3 (2020-06-03) [stable]
335 ** Bug fixes
337   Incorrect comments in the generated parsers.
339   Warnings in push parsers (yacc.c).
341   Incorrect display of gotos in LAC traces (lalr1.cc).
344 * Noteworthy changes in release 3.6.2 (2020-05-17) [stable]
346 ** Bug fixes
348   Some tests were fixed.
350   When token aliases contain comment delimiters:
352     %token FOO "/* foo */"
354   bison used to emit "nested" comments, which is invalid C.
357 * Noteworthy changes in release 3.6.1 (2020-05-10) [stable]
359 ** Bug fixes
361   Restored ANSI-C compliance in yacc.c.
363   GNU readline portability issues.
365   In C++, yy::parser::symbol_name is now a public member, as was intended.
367 ** New features
369   In C++, yy::parser::symbol_type now has a public name() member function.
372 * Noteworthy changes in release 3.6 (2020-05-08) [stable]
374 ** Backward incompatible changes
376   TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose".
378   The YYERROR_VERBOSE macro is no longer supported; the parsers that still
379   depend on it will now produce Yacc-like error messages (just "syntax
380   error").  It was superseded by the "%error-verbose" directive in Bison
381   1.875 (2003-01-01).  Bison 2.6 (2012-07-19) clearly announced that support
382   for YYERROR_VERBOSE would be removed.  Note that since Bison 3.0
383   (2013-07-25), "%error-verbose" is deprecated in favor of "%define
384   parse.error verbose".
386 ** Deprecated features
388   The YYPRINT macro, which works only with yacc.c and only for tokens, was
389   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
390   It is deprecated and its support will be removed eventually.
392 ** New features
394 *** Improved syntax error messages
396   Two new values for the %define parse.error variable offer more control to
397   the user.  Available in all the skeletons (C, C++, Java).
399 **** %define parse.error detailed
401   The behavior of "%define parse.error detailed" is closely resembling that
402   of "%define parse.error verbose" with a few exceptions.  First, it is safe
403   to use non-ASCII characters in token aliases (with 'verbose', the result
404   depends on the locale with which bison was run).  Second, a yysymbol_name
405   function is exposed to the user, instead of the yytnamerr function and the
406   yytname table.  Third, token internationalization is supported (see
407   below).
409 **** %define parse.error custom
411   With this directive, the user forges and emits the syntax error message
412   herself by defining the yyreport_syntax_error function.  A new type,
413   yypcontext_t, captures the circumstances of the error, and provides the
414   user with functions to get details, such as yypcontext_expected_tokens to
415   get the list of expected token kinds.
417   A possible implementation of yyreport_syntax_error is:
419     int
420     yyreport_syntax_error (const yypcontext_t *ctx)
421     {
422       int res = 0;
423       YY_LOCATION_PRINT (stderr, *yypcontext_location (ctx));
424       fprintf (stderr, ": syntax error");
425       // Report the tokens expected at this point.
426       {
427         enum { TOKENMAX = 10 };
428         yysymbol_kind_t expected[TOKENMAX];
429         int n = yypcontext_expected_tokens (ctx, expected, TOKENMAX);
430         if (n < 0)
431           // Forward errors to yyparse.
432           res = n;
433         else
434           for (int i = 0; i < n; ++i)
435             fprintf (stderr, "%s %s",
436                      i == 0 ? ": expected" : " or", yysymbol_name (expected[i]));
437       }
438       // Report the unexpected token.
439       {
440         yysymbol_kind_t lookahead = yypcontext_token (ctx);
441         if (lookahead != YYSYMBOL_YYEMPTY)
442           fprintf (stderr, " before %s", yysymbol_name (lookahead));
443       }
444       fprintf (stderr, "\n");
445       return res;
446     }
448 **** Token aliases internationalization
450   When the %define variable parse.error is set to `custom` or `detailed`,
451   one may specify which token aliases are to be translated using _().  For
452   instance
454     %token
455         PLUS   "+"
456         MINUS  "-"
457       <double>
458         NUM _("number")
459       <symrec*>
460         FUN _("function")
461         VAR _("variable")
463   In that case the user must define _() and N_(), and yysymbol_name returns
464   the translated symbol (i.e., it returns '_("variable")' rather that
465   '"variable"').  In Java, the user must provide an i18n() function.
467 *** List of expected tokens (yacc.c)
469   Push parsers may invoke yypstate_expected_tokens at any point during
470   parsing (including even before submitting the first token) to get the list
471   of possible tokens.  This feature can be used to propose autocompletion
472   (see below the "bistromathic" example).
474   It makes little sense to use this feature without enabling LAC (lookahead
475   correction).
477 *** Returning the error token
479   When the scanner returns an invalid token or the undefined token
480   (YYUNDEF), the parser generates an error message and enters error
481   recovery.  Because of that error message, most scanners that find lexical
482   errors generate an error message, and then ignore the invalid input
483   without entering the error-recovery.
485   The scanners may now return YYerror, the error token, to enter the
486   error-recovery mode without triggering an additional error message.  See
487   the bistromathic for an example.
489 *** Deep overhaul of the symbol and token kinds
491   To avoid the confusion with types in programming languages, we now refer
492   to token and symbol "kinds" instead of token and symbol "types".  The
493   documentation and error messages have been revised.
495   All the skeletons have been updated to use dedicated enum types rather
496   than integral types.  Special symbols are now regular citizens, instead of
497   being declared in ad hoc ways.
499 **** Token kinds
501   The "token kind" is what is returned by the scanner, e.g., PLUS, NUMBER,
502   LPAREN, etc.  While backward compatibility is of course ensured, users are
503   nonetheless invited to replace their uses of "enum yytokentype" by
504   "yytoken_kind_t".
506   This type now also includes tokens that were previously hidden: YYEOF (end
507   of input), YYUNDEF (undefined token), and YYerror (error token).  They
508   now have string aliases, internationalized when internationalization is
509   enabled.  Therefore, by default, error messages now refer to "end of file"
510   (internationalized) rather than the cryptic "$end", or to "invalid token"
511   rather than "$undefined".
513   Therefore in most cases it is now useless to define the end-of-line token
514   as follows:
516     %token T_EOF 0 "end of file"
518   Rather simply use "YYEOF" in your scanner.
520 **** Symbol kinds
522   The "symbol kinds" is what the parser actually uses.  (Unless the
523   api.token.raw %define variable is used, the symbol kind of a terminal
524   differs from the corresponding token kind.)
526   They are now exposed as a enum, "yysymbol_kind_t".
528   This allows users to tailor the error messages the way they want, or to
529   process some symbols in a specific way in autocompletion (see the
530   bistromathic example below).
532 *** Modernize display of explanatory statements in diagnostics
534   Since Bison 2.7, output was indented four spaces for explanatory
535   statements.  For example:
537     input.y:2.7-13: error: %type redeclaration for exp
538     input.y:1.7-11:     previous declaration
540   Since the introduction of caret-diagnostics, it became less clear.  This
541   indentation has been removed and submessages are displayed similarly as in
542   GCC:
544     input.y:2.7-13: error: %type redeclaration for exp
545         2 | %type <float> exp
546           |       ^~~~~~~
547     input.y:1.7-11: note: previous declaration
548         1 | %type <int> exp
549           |       ^~~~~
551   Contributed by Victor Morales Cayuela.
553 *** C++
555   The token and symbol kinds are yy::parser::token_kind_type and
556   yy::parser::symbol_kind_type.
558   The symbol_type::kind() member function allows to get the kind of a
559   symbol.  This can be used to write unit tests for scanners, e.g.,
561     yy::parser::symbol_type t = make_NUMBER ("123");
562     assert (t.kind () == yy::parser::symbol_kind::S_NUMBER);
563     assert (t.value.as<int> () == 123);
565 ** Documentation
567 *** User Manual
569   In order to avoid ambiguities with "type" as in "typing", we now refer to
570   the "token kind" (e.g., `PLUS`, `NUMBER`, etc.) rather than the "token
571   type".  We now also refer to the "symbol type" (e.g., `PLUS`, `expr`,
572   etc.).
574 *** Examples
576   There are now examples/java: a very simple calculator, and a more complete
577   one (push-parser, location tracking, and debug traces).
579   The lexcalc example (a simple example in C based on Flex and Bison) now
580   also demonstrates location tracking.
583   A new C example, bistromathic, is a fully featured interactive calculator
584   using many Bison features: pure interface, push parser, autocompletion
585   based on the current parser state (using yypstate_expected_tokens),
586   location tracking, internationalized custom error messages, lookahead
587   correction, rich debug traces, etc.
589   It shows how to depend on the symbol kinds to tailor autocompletion.  For
590   instance it recognizes the symbol kind "VARIABLE" to propose
591   autocompletion on the existing variables, rather than of the word
592   "variable".
595 * Noteworthy changes in release 3.5.4 (2020-04-05) [stable]
597 ** WARNING: Future backward-incompatibilities!
599   TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose".
601   Bison 3.6 will no longer support the YYERROR_VERBOSE macro; the parsers
602   that still depend on it will produce Yacc-like error messages (just
603   "syntax error").  It was superseded by the "%error-verbose" directive in
604   Bison 1.875 (2003-01-01).  Bison 2.6 (2012-07-19) clearly announced that
605   support for YYERROR_VERBOSE would be removed.  Note that since Bison 3.0
606   (2013-07-25), "%error-verbose" is deprecated in favor of "%define
607   parse.error verbose".
609 ** Bug fixes
611   Fix portability issues of the package itself on old compilers.
613   Fix api.token.raw support in Java.
616 * Noteworthy changes in release 3.5.3 (2020-03-08) [stable]
618 ** Bug fixes
620   Error messages could quote lines containing zero-width characters (such as
621   \005) with incorrect styling.  Fixes for similar issues with unexpectedly
622   short lines (e.g., the file was changed between parsing and diagnosing).
624   Some unlikely crashes found by fuzzing have been fixed.  This is only
625   about bison itself, not the generated parsers.
628 * Noteworthy changes in release 3.5.2 (2020-02-13) [stable]
630 ** Bug fixes
632   Portability issues and minor cosmetic issues.
634   The lalr1.cc skeleton properly rejects unsupported values for parse.lac
635   (as yacc.c does).
638 * Noteworthy changes in release 3.5.1 (2020-01-19) [stable]
640 ** Bug fixes
642   Portability fixes.
644   Fix compiler warnings.
647 * Noteworthy changes in release 3.5 (2019-12-11) [stable]
649 ** Backward incompatible changes
651   Lone carriage-return characters (aka \r or ^M) in the grammar files are no
652   longer treated as end-of-lines.  This changes the diagnostics, and in
653   particular their locations.
655   In C++, line numbers and columns are now represented as 'int' not
656   'unsigned', so that integer overflow on positions is easily checkable via
657   'gcc -fsanitize=undefined' and the like.  This affects the API for
658   positions.  The default position and location classes now expose
659   'counter_type' (int), used to define line and column numbers.
661 ** Deprecated features
663   The YYPRINT macro, which works only with yacc.c and only for tokens, was
664   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
665   It is deprecated and its support will be removed eventually.
667 ** New features
669 *** Lookahead correction in C++
671   Contributed by Adrian Vogelsgesang.
673   The C++ deterministic skeleton (lalr1.cc) now supports LAC, via the
674   %define variable parse.lac.
676 *** Variable api.token.raw: Optimized token numbers (all skeletons)
678   In the generated parsers, tokens have two numbers: the "external" token
679   number as returned by yylex (which starts at 257), and the "internal"
680   symbol number (which starts at 3).  Each time yylex is called, a table
681   lookup maps the external token number to the internal symbol number.
683   When the %define variable api.token.raw is set, tokens are assigned their
684   internal number, which saves one table lookup per token, and also saves
685   the generation of the mapping table.
687   The gain is typically moderate, but in extreme cases (very simple user
688   actions), a 10% improvement can be observed.
690 *** Generated parsers use better types for states
692   Stacks now use the best integral type for state numbers, instead of always
693   using 15 bits.  As a result "small" parsers now have a smaller memory
694   footprint (they use 8 bits), and there is support for large automata (16
695   bits), and extra large (using int, i.e., typically 31 bits).
697 *** Generated parsers prefer signed integer types
699   Bison skeletons now prefer signed to unsigned integer types when either
700   will do, as the signed types are less error-prone and allow for better
701   checking with 'gcc -fsanitize=undefined'.  Also, the types chosen are now
702   portable to unusual machines where char, short and int are all the same
703   width.  On non-GNU platforms this may entail including <limits.h> and (if
704   available) <stdint.h> to define integer types and constants.
706 *** A skeleton for the D programming language
708   For the last few releases, Bison has shipped a stealth experimental
709   skeleton: lalr1.d.  It was first contributed by Oliver Mangold, based on
710   Paolo Bonzini's lalr1.java, and was cleaned and improved thanks to
711   H. S. Teoh.
713   However, because nobody has committed to improving, testing, and
714   documenting this skeleton, it is not clear that it will be supported in
715   the future.
717   The lalr1.d skeleton *is functional*, and works well, as demonstrated in
718   examples/d/calc.d.  Please try it, enjoy it, and... commit to support it.
720 *** Debug traces in Java
722   The Java backend no longer emits code and data for parser tracing if the
723   %define variable parse.trace is not defined.
725 ** Diagnostics
727 *** New diagnostic: -Wdangling-alias
729   String literals, which allow for better error messages, are (too)
730   liberally accepted by Bison, which might result in silent errors.  For
731   instance
733     %type <exVal> cond "condition"
735   does not define "condition" as a string alias to 'cond' (nonterminal
736   symbols do not have string aliases).  It is rather equivalent to
738     %nterm <exVal> cond
739     %token <exVal> "condition"
741   i.e., it gives the type 'exVal' to the "condition" token, which was
742   clearly not the intention.
744   Also, because string aliases need not be defined, typos such as "baz"
745   instead of "bar" will be not reported.
747   The option -Wdangling-alias catches these situations.  On
749     %token BAR "bar"
750     %type <ival> foo "foo"
751     %%
752     foo: "baz" {}
754   bison -Wdangling-alias reports
756     warning: string literal not attached to a symbol
757           | %type <ival> foo "foo"
758           |                  ^~~~~
759     warning: string literal not attached to a symbol
760           | foo: "baz" {}
761           |      ^~~~~
763    The -Wall option does not (yet?) include -Wdangling-alias.
765 *** Better POSIX Yacc compatibility diagnostics
767   POSIX Yacc restricts %type to nonterminals.  This is now diagnosed by
768   -Wyacc.
770     %token TOKEN1
771     %type  <ival> TOKEN1 TOKEN2 't'
772     %token TOKEN2
773     %%
774     expr:
776   gives with -Wyacc
778     input.y:2.15-20: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
779         2 | %type  <ival> TOKEN1 TOKEN2 't'
780           |               ^~~~~~
781     input.y:2.29-31: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
782         2 | %type  <ival> TOKEN1 TOKEN2 't'
783           |                             ^~~
784     input.y:2.22-27: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
785         2 | %type  <ival> TOKEN1 TOKEN2 't'
786           |                      ^~~~~~
788 *** Diagnostics with insertion
790   The diagnostics now display the suggestion below the underlined source.
791   Replacement for undeclared symbols are now also suggested.
793     $ cat /tmp/foo.y
794     %%
795     list: lis '.' |
797     $ bison -Wall foo.y
798     foo.y:2.7-9: error: symbol 'lis' is used, but is not defined as a token and has no rules; did you mean 'list'?
799         2 | list: lis '.' |
800           |       ^~~
801           |       list
802     foo.y:2.16: warning: empty rule without %empty [-Wempty-rule]
803         2 | list: lis '.' |
804           |                ^
805           |                %empty
806     foo.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
808 *** Diagnostics about long lines
810   Quoted sources may now be truncated to fit the screen.  For instance, on a
811   30-column wide terminal:
813     $ cat foo.y
814     %token FOO                       FOO                         FOO
815     %%
816     exp: FOO
817     $ bison foo.y
818     foo.y:1.34-36: warning: symbol FOO redeclared [-Wother]
819         1 | …         FOO                  …
820           |           ^~~
821     foo.y:1.8-10:      previous declaration
822         1 | %token FOO                     …
823           |        ^~~
824     foo.y:1.62-64: warning: symbol FOO redeclared [-Wother]
825         1 | …         FOO
826           |           ^~~
827     foo.y:1.8-10:      previous declaration
828         1 | %token FOO                     …
829           |        ^~~
831 ** Changes
833 *** Debugging glr.c and glr.cc
835   The glr.c skeleton always had asserts to check its own behavior (not the
836   user's).  These assertions are now under the control of the parse.assert
837   %define variable (disabled by default).
839 *** Clean up
841   Several new compiler warnings in the generated output have been avoided.
842   Some unused features are no longer emitted.  Cleaner generated code in
843   general.
845 ** Bug Fixes
847   Portability issues in the test suite.
849   In theory, parsers using %nonassoc could crash when reporting verbose
850   error messages. This unlikely bug has been fixed.
852   In Java, %define api.prefix was ignored.  It now behaves as expected.
855 * Noteworthy changes in release 3.4.2 (2019-09-12) [stable]
857 ** Bug fixes
859   In some cases, when warnings are disabled, bison could emit tons of white
860   spaces as diagnostics.
862   When running out of memory, bison could crash (found by fuzzing).
864   When defining twice the EOF token, bison would crash.
866   New warnings from recent compilers have been addressed in the generated
867   parsers (yacc.c, glr.c, glr.cc).
869   When lone carriage-return characters appeared in the input file,
870   diagnostics could hang forever.
873 * Noteworthy changes in release 3.4.1 (2019-05-22) [stable]
875 ** Bug fixes
877   Portability fixes.
880 * Noteworthy changes in release 3.4 (2019-05-19) [stable]
882 ** Deprecated features
884   The %pure-parser directive is deprecated in favor of '%define api.pure'
885   since Bison 2.3b (2008-05-27), but no warning was issued; there is one
886   now.  Note that since Bison 2.7 you are strongly encouraged to use
887   '%define api.pure full' instead of '%define api.pure'.
889 ** New features
891 *** Colored diagnostics
893   As an experimental feature, diagnostics are now colored, controlled by the
894   new options --color and --style.
896   To use them, install the libtextstyle library before configuring Bison.
897   It is available from
899     https://alpha.gnu.org/gnu/gettext/
901   for instance
903     https://alpha.gnu.org/gnu/gettext/libtextstyle-0.8.tar.gz
905   The option --color supports the following arguments:
906     - always, yes: Enable colors.
907     - never, no: Disable colors.
908     - auto, tty (default): Enable colors if the output device is a tty.
910   To customize the styles, create a CSS file similar to
912     /* bison-bw.css */
913     .warning   { }
914     .error     { font-weight: 800; text-decoration: underline; }
915     .note      { }
917   then invoke bison with --style=bison-bw.css, or set the BISON_STYLE
918   environment variable to "bison-bw.css".
920 *** Disabling output
922   When given -fsyntax-only, the diagnostics are reported, but no output is
923   generated.
925   The name of this option is somewhat misleading as bison does more than
926   just checking the syntax: every stage is run (including checking for
927   conflicts for instance), except the generation of the output files.
929 *** Include the generated header (yacc.c)
931   Before, when --defines is used, bison generated a header, and pasted an
932   exact copy of it into the generated parser implementation file.  If the
933   header name is not "y.tab.h", it is now #included instead of being
934   duplicated.
936   To use an '#include' even if the header name is "y.tab.h" (which is what
937   happens with --yacc, or when using the Autotools' ylwrap), define
938   api.header.include to the exact argument to pass to #include.  For
939   instance:
941     %define api.header.include {"parse.h"}
943   or
945     %define api.header.include {<parser/parse.h>}
947 *** api.location.type is now supported in C (yacc.c, glr.c)
949   The %define variable api.location.type defines the name of the type to use
950   for locations.  When defined, Bison no longer defines YYLTYPE.
952   This can be used in programs with several parsers to factor their
953   definition of locations: let one of them generate them, and the others
954   just use them.
956 ** Changes
958 *** Graphviz output
960   In conformance with the recommendations of the Graphviz team, if %require
961   "3.4" (or better) is specified, the option --graph generates a *.gv file
962   by default, instead of *.dot.
964 *** Diagnostics overhaul
966   Column numbers were wrong with multibyte characters, which would also
967   result in skewed diagnostics with carets.  Beside, because we were
968   indenting the quoted source with a single space, lines with tab characters
969   were incorrectly underlined.
971   To address these issues, and to be clearer, Bison now issues diagnostics
972   as GCC9 does.  For instance it used to display (there's a tab before the
973   opening brace):
975     foo.y:3.37-38: error: $2 of ‘expr’ has no declared type
976      expr: expr '+' "number"        { $$ = $1 + $2; }
977                                          ^~
978   It now reports
980     foo.y:3.37-38: error: $2 of ‘expr’ has no declared type
981         3 | expr: expr '+' "number" { $$ = $1 + $2; }
982           |                                     ^~
984   Other constructs now also have better locations, resulting in more precise
985   diagnostics.
987 *** Fix-it hints for %empty
989   Running Bison with -Wempty-rules and --update will remove incorrect %empty
990   annotations, and add the missing ones.
992 *** Generated reports
994   The format of the reports (parse.output) was improved for readability.
996 *** Better support for --no-line.
998   When --no-line is used, the generated files are now cleaner: no lines are
999   generated instead of empty lines.  Together with using api.header.include,
1000   that should help people saving the generated files into version control
1001   systems get smaller diffs.
1003 ** Documentation
1005   A new example in C shows an simple infix calculator with a hand-written
1006   scanner (examples/c/calc).
1008   A new example in C shows a reentrant parser (capable of recursive calls)
1009   built with Flex and Bison (examples/c/reccalc).
1011   There is a new section about the history of Yaccs and Bison.
1013 ** Bug fixes
1015   A few obscure bugs were fixed, including the second oldest (known) bug in
1016   Bison: it was there when Bison was entered in the RCS version control
1017   system, in December 1987.  See the NEWS of Bison 3.3 for the previous
1018   oldest bug.
1021 * Noteworthy changes in release 3.3.2 (2019-02-03) [stable]
1023 ** Bug fixes
1025   Bison 3.3 failed to generate parsers for grammars with unused nonterminal
1026   symbols.
1029 * Noteworthy changes in release 3.3.1 (2019-01-27) [stable]
1031 ** Changes
1033   The option -y/--yacc used to imply -Werror=yacc, which turns uses of Bison
1034   extensions into errors.  It now makes them simple warnings (-Wyacc).
1037 * Noteworthy changes in release 3.3 (2019-01-26) [stable]
1039   A new mailing list was created, Bison Announce.  It is low traffic, and is
1040   only about announcing new releases and important messages (e.g., polls
1041   about major decisions to make).
1043   https://lists.gnu.org/mailman/listinfo/bison-announce
1045 ** Backward incompatible changes
1047   Support for DJGPP, which has been unmaintained and untested for years, is
1048   removed.
1050 ** Deprecated features
1052   A new feature, --update (see below) helps adjusting existing grammars to
1053   deprecations.
1055 *** Deprecated directives
1057   The %error-verbose directive is deprecated in favor of '%define
1058   parse.error verbose' since Bison 3.0, but no warning was issued.
1060   The '%name-prefix "xx"' directive is deprecated in favor of '%define
1061   api.prefix {xx}' since Bison 3.0, but no warning was issued.  These
1062   directives are slightly different, you might need to adjust your code.
1063   %name-prefix renames only symbols with external linkage, while api.prefix
1064   also renames types and macros, including YYDEBUG, YYTOKENTYPE,
1065   yytokentype, YYSTYPE, YYLTYPE, etc.
1067   Users of Flex that move from '%name-prefix "xx"' to '%define api.prefix
1068   {xx}' will typically have to update YY_DECL from
1070     #define YY_DECL int xxlex (YYSTYPE *yylval, YYLTYPE *yylloc)
1072   to
1074     #define YY_DECL int xxlex (XXSTYPE *yylval, XXLTYPE *yylloc)
1076 *** Deprecated %define variable names
1078   The following variables, mostly related to parsers in Java, have been
1079   renamed for consistency.  Backward compatibility is ensured, but upgrading
1080   is recommended.
1082     abstract           -> api.parser.abstract
1083     annotations        -> api.parser.annotations
1084     extends            -> api.parser.extends
1085     final              -> api.parser.final
1086     implements         -> api.parser.implements
1087     parser_class_name  -> api.parser.class
1088     public             -> api.parser.public
1089     strictfp           -> api.parser.strictfp
1091 ** New features
1093 *** Generation of fix-its for IDEs/Editors
1095   When given the new option -ffixit (aka -fdiagnostics-parseable-fixits),
1096   bison now generates machine readable editing instructions to fix some
1097   issues.  Currently, this is mostly limited to updating deprecated
1098   directives and removing duplicates.  For instance:
1100     $ cat foo.y
1101     %error-verbose
1102     %define parser_class_name "Parser"
1103     %define api.parser.class "Parser"
1104     %%
1105     exp:;
1107   See the "fix-it:" lines below:
1109     $ bison -ffixit foo.y
1110     foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated]
1111      %error-verbose
1112      ^~~~~~~~~~~~~~
1113     fix-it:"foo.y":{1:1-1:15}:"%define parse.error verbose"
1114     foo.y:2.1-34: warning: deprecated directive, use '%define api.parser.class {Parser}' [-Wdeprecated]
1115      %define parser_class_name "Parser"
1116      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1117     fix-it:"foo.y":{2:1-2:35}:"%define api.parser.class {Parser}"
1118     foo.y:3.1-33: error: %define variable 'api.parser.class' redefined
1119      %define api.parser.class "Parser"
1120      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1121     foo.y:2.1-34:     previous definition
1122      %define parser_class_name "Parser"
1123      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1124     fix-it:"foo.y":{3:1-3:34}:""
1125     foo.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
1127   This uses the same output format as GCC and Clang.
1129 *** Updating grammar files
1131   Fixes can be applied on the fly.  The previous example ends with the
1132   suggestion to re-run bison with the option -u/--update, which results in a
1133   cleaner grammar file.
1135     $ bison --update foo.y
1136     [...]
1137     bison: file 'foo.y' was updated (backup: 'foo.y~')
1139     $ cat foo.y
1140     %define parse.error verbose
1141     %define api.parser.class {Parser}
1142     %%
1143     exp:;
1145 *** Bison is now relocatable
1147   If you pass '--enable-relocatable' to 'configure', Bison is relocatable.
1149   A relocatable program can be moved or copied to a different location on
1150   the file system.  It can also be used through mount points for network
1151   sharing.  It is possible to make symbolic links to the installed and moved
1152   programs, and invoke them through the symbolic link.
1154 *** %expect and %expect-rr modifiers on individual rules
1156   One can now document (and check) which rules participate in shift/reduce
1157   and reduce/reduce conflicts.  This is particularly important GLR parsers,
1158   where conflicts are a normal occurrence.  For example,
1160       %glr-parser
1161       %expect 1
1162       %%
1164       ...
1166       argument_list:
1167         arguments %expect 1
1168       | arguments ','
1169       | %empty
1170       ;
1172       arguments:
1173         expression
1174       | argument_list ',' expression
1175       ;
1177       ...
1179   Looking at the output from -v, one can see that the shift/reduce conflict
1180   here is due to the fact that the parser does not know whether to reduce
1181   arguments to argument_list until it sees the token _after_ the following
1182   ','.  By marking the rule with %expect 1 (because there is a conflict in
1183   one state), we document the source of the 1 overall shift/reduce conflict.
1185   In GLR parsers, we can use %expect-rr in a rule for reduce/reduce
1186   conflicts.  In this case, we mark each of the conflicting rules.  For
1187   example,
1189       %glr-parser
1190       %expect-rr 1
1192       %%
1194       stmt:
1195         target_list '=' expr ';'
1196       | expr_list ';'
1197       ;
1199       target_list:
1200         target
1201       | target ',' target_list
1202       ;
1204       target:
1205         ID %expect-rr 1
1206       ;
1208       expr_list:
1209         expr
1210       | expr ',' expr_list
1211       ;
1213       expr:
1214         ID %expect-rr 1
1215       | ...
1216       ;
1218   In a statement such as
1220       x, y = 3, 4;
1222   the parser must reduce x to a target or an expr, but does not know which
1223   until it sees the '='.  So we notate the two possible reductions to
1224   indicate that each conflicts in one rule.
1226   This feature needs user feedback, and might evolve in the future.
1228 *** C++: Actual token constructors
1230   When variants and token constructors are enabled, in addition to the
1231   type-safe named token constructors (make_ID, make_INT, etc.), we now
1232   generate genuine constructors for symbol_type.
1234   For instance with these declarations
1236     %token           ':'
1237        <std::string> ID
1238        <int>         INT;
1240   you may use these constructors:
1242     symbol_type (int token, const std::string&);
1243     symbol_type (int token, const int&);
1244     symbol_type (int token);
1246   Correct matching between token types and value types is checked via
1247   'assert'; for instance, 'symbol_type (ID, 42)' would abort.  Named
1248   constructors are preferable, as they offer better type safety (for
1249   instance 'make_ID (42)' would not even compile), but symbol_type
1250   constructors may help when token types are discovered at run-time, e.g.,
1252      [a-z]+   {
1253                 if (auto i = lookup_keyword (yytext))
1254                   return yy::parser::symbol_type (i);
1255                 else
1256                   return yy::parser::make_ID (yytext);
1257               }
1259 *** C++: Variadic emplace
1261   If your application requires C++11 and you don't use symbol constructors,
1262   you may now use a variadic emplace for semantic values:
1264     %define api.value.type variant
1265     %token <std::pair<int, int>> PAIR
1267   in your scanner:
1269     int yylex (parser::semantic_type *lvalp)
1270     {
1271       lvalp->emplace <std::pair<int, int>> (1, 2);
1272       return parser::token::PAIR;
1273     }
1275 *** C++: Syntax error exceptions in GLR
1277   The glr.cc skeleton now supports syntax_error exceptions thrown from user
1278   actions, or from the scanner.
1280 *** More POSIX Yacc compatibility warnings
1282   More Bison specific directives are now reported with -y or -Wyacc.  This
1283   change was ready since the release of Bison 3.0 in September 2015.  It was
1284   delayed because Autoconf used to define YACC as `bison -y`, which resulted
1285   in numerous warnings for Bison users that use the GNU Build System.
1287   If you still experience that problem, either redefine YACC as `bison -o
1288   y.tab.c`, or pass -Wno-yacc to Bison.
1290 *** The tables yyrhs and yyphrs are back
1292   Because no Bison skeleton uses them, these tables were removed (no longer
1293   passed to the skeletons, not even computed) in 2008.  However, some users
1294   have expressed interest in being able to use them in their own skeletons.
1296 ** Bug fixes
1298 *** Incorrect number of reduce/reduce conflicts
1300   On a grammar such as
1302      exp: "num" | "num" | "num"
1304   bison used to report a single RR conflict, instead of two.  This is now
1305   fixed.  This was the oldest (known) bug in Bison: it was there when Bison
1306   was entered in the RCS version control system, in December 1987.
1308   Some grammar files might have to adjust their %expect-rr.
1310 *** Parser directives that were not careful enough
1312   Passing invalid arguments to %nterm, for instance character literals, used
1313   to result in unclear error messages.
1315 ** Documentation
1317   The examples/ directory (installed in .../share/doc/bison/examples) has
1318   been restructured per language for clarity.  The examples come with a
1319   README and a Makefile.  Not only can they be used to toy with Bison, they
1320   can also be starting points for your own grammars.
1322   There is now a Java example, and a simple example in C based on Flex and
1323   Bison (examples/c/lexcalc/).
1325 ** Changes
1327 *** Parsers in C++
1329   They now use noexcept and constexpr.  Please, report missing annotations.
1331 *** Symbol Declarations
1333   The syntax of the variation directives to declare symbols was overhauled
1334   for more consistency, and also better POSIX Yacc compliance (which, for
1335   instance, allows "%type" without actually providing a type).  The %nterm
1336   directive, supported by Bison since its inception, is now documented and
1337   officially supported.
1339   The syntax is now as follows:
1341     %token TAG? ( ID NUMBER? STRING? )+ ( TAG ( ID NUMBER? STRING? )+ )*
1342     %left  TAG? ( ID NUMBER? )+ ( TAG ( ID NUMBER? )+ )*
1343     %type  TAG? ( ID | CHAR | STRING )+ ( TAG ( ID | CHAR | STRING )+ )*
1344     %nterm TAG? ID+ ( TAG ID+ )*
1346   where TAG denotes a type tag such as ‘<ival>’, ID denotes an identifier
1347   such as ‘NUM’, NUMBER a decimal or hexadecimal integer such as ‘300’ or
1348   ‘0x12d’, CHAR a character literal such as ‘'+'’, and STRING a string
1349   literal such as ‘"number"’.  The post-fix quantifiers are ‘?’ (zero or
1350   one), ‘*’ (zero or more) and ‘+’ (one or more).
1353 * Noteworthy changes in release 3.2.4 (2018-12-24) [stable]
1355 ** Bug fixes
1357   Fix the move constructor of symbol_type.
1359   Always provide a copy constructor for symbol_type, even in modern C++.
1362 * Noteworthy changes in release 3.2.3 (2018-12-18) [stable]
1364 ** Bug fixes
1366   Properly support token constructors in C++ with types that include commas
1367   (e.g., std::pair<int, int>).  A regression introduced in Bison 3.2.
1370 * Noteworthy changes in release 3.2.2 (2018-11-21) [stable]
1372 ** Bug fixes
1374   C++ portability issues.
1377 * Noteworthy changes in release 3.2.1 (2018-11-09) [stable]
1379 ** Bug fixes
1381   Several portability issues have been fixed in the build system, in the
1382   test suite, and in the generated parsers in C++.
1385 * Noteworthy changes in release 3.2 (2018-10-29) [stable]
1387 ** Backward incompatible changes
1389   Support for DJGPP, which has been unmaintained and untested for years, is
1390   obsolete.  Unless there is activity to revive it, it will be removed.
1392 ** Changes
1394   %printers should use yyo rather than yyoutput to denote the output stream.
1396   Variant-based symbols in C++ should use emplace() rather than build().
1398   In C++ parsers, parser::operator() is now a synonym for the parser::parse.
1400 ** Documentation
1402   A new section, "A Simple C++ Example", is a tutorial for parsers in C++.
1404   A comment in the generated code now emphasizes that users should not
1405   depend upon non-documented implementation details, such as macros starting
1406   with YY_.
1408 ** New features
1410 *** C++: Support for move semantics (lalr1.cc)
1412   The lalr1.cc skeleton now fully supports C++ move semantics, while
1413   maintaining compatibility with C++98.  You may now store move-only types
1414   when using Bison's variants.  For instance:
1416     %code {
1417       #include <memory>
1418       #include <vector>
1419     }
1421     %skeleton "lalr1.cc"
1422     %define api.value.type variant
1424     %%
1426     %token <int> INT "int";
1427     %type <std::unique_ptr<int>> int;
1428     %type <std::vector<std::unique_ptr<int>>> list;
1430     list:
1431       %empty    {}
1432     | list int  { $$ = std::move($1); $$.emplace_back(std::move($2)); }
1434     int: "int"  { $$ = std::make_unique<int>($1); }
1436 *** C++: Implicit move of right-hand side values (lalr1.cc)
1438   In modern C++ (C++11 and later), you should always use 'std::move' with
1439   the values of the right-hand side symbols ($1, $2, etc.), as they will be
1440   popped from the stack anyway.  Using 'std::move' is mandatory for
1441   move-only types such as unique_ptr, and it provides a significant speedup
1442   for large types such as std::string, or std::vector, etc.
1444   If '%define api.value.automove' is set, every occurrence '$n' is replaced
1445   by 'std::move ($n)'.  The second rule in the previous grammar can be
1446   simplified to:
1448     list: list int  { $$ = $1; $$.emplace_back($2); }
1450   With automove enabled, the semantic values are no longer lvalues, so do
1451   not use the swap idiom:
1453     list: list int  { std::swap($$, $1); $$.emplace_back($2); }
1455   This idiom is anyway obsolete: it is preferable to move than to swap.
1457   A warning is issued when automove is enabled, and a value is used several
1458   times.
1460     input.yy:16.31-32: warning: multiple occurrences of $2 with api.value.automove enabled [-Wother]
1461     exp: "twice" exp   { $$ = $2 + $2; }
1462                                    ^^
1464   Enabling api.value.automove does not require support for modern C++.  The
1465   generated code is valid C++98/03, but will use copies instead of moves.
1467   The new examples/c++/variant-11.yy shows these features in action.
1469 *** C++: The implicit default semantic action is always run
1471   When variants are enabled, the default action was not run, so
1473     exp: "number"
1475   was equivalent to
1477     exp: "number"  {}
1479   It now behaves like in all the other cases, as
1481     exp: "number"  { $$ = $1; }
1483   possibly using std::move if automove is enabled.
1485   We do not expect backward compatibility issues.  However, beware of
1486   forward compatibility issues: if you rely on default actions with
1487   variants, be sure to '%require "3.2"' to avoid older versions of Bison to
1488   generate incorrect parsers.
1490 *** C++: Renaming location.hh
1492   When both %defines and %locations are enabled, Bison generates a
1493   location.hh file.  If you don't use locations outside of the parser, you
1494   may avoid its creation with:
1496     %define api.location.file none
1498   However this file is useful if, for instance, your parser builds an AST
1499   decorated with locations: you may use Bison's location independently of
1500   Bison's parser.  You can now give it another name, for instance:
1502     %define api.location.file "my-location.hh"
1504   This name can have directory components, and even be absolute.  The name
1505   under which the location file is included is controlled by
1506   api.location.include.
1508   This way it is possible to have several parsers share the same location
1509   file.
1511   For instance, in src/foo/parser.hh, generate the include/ast/loc.hh file:
1513     %locations
1514     %define api.namespace {foo}
1515     %define api.location.file "include/ast/loc.hh"
1516     %define api.location.include {<ast/loc.hh>}
1518   and use it in src/bar/parser.hh:
1520     %locations
1521     %define api.namespace {bar}
1522     %code requires {#include <ast/loc.hh>}
1523     %define api.location.type {bar::location}
1525   Absolute file names are supported, so in your Makefile, passing the flag
1526   -Dapi.location.file='"$(top_srcdir)/include/ast/location.hh"' to bison is
1527   safe.
1529 *** C++: stack.hh and position.hh are deprecated
1531   When asked to generate a header file (%defines), the lalr1.cc skeleton
1532   generates a stack.hh file.  This file had no interest for users; it is now
1533   made useless: its content is included in the parser definition.  It is
1534   still generated for backward compatibility.
1536   When in addition to %defines, location support is requested (%locations),
1537   the file position.hh is also generated.  It is now also useless: its
1538   content is now included in location.hh.
1540   These files are no longer generated when your grammar file requires at
1541   least Bison 3.2 (%require "3.2").
1543 ** Bug fixes
1545   Portability issues on MinGW and VS2015.
1547   Portability issues in the test suite.
1549   Portability/warning issues with Flex.
1552 * Noteworthy changes in release 3.1 (2018-08-27) [stable]
1554 ** Backward incompatible changes
1556   Compiling Bison now requires a C99 compiler---as announced during the
1557   release of Bison 3.0, five years ago.  Generated parsers do not require a
1558   C99 compiler.
1560   Support for DJGPP, which has been unmaintained and untested for years, is
1561   obsolete. Unless there is activity to revive it, the next release of Bison
1562   will have it removed.
1564 ** New features
1566 *** Typed midrule actions
1568   Because their type is unknown to Bison, the values of midrule actions are
1569   not treated like the others: they don't have %printer and %destructor
1570   support.  It also prevents C++ (Bison) variants to handle them properly.
1572   Typed midrule actions address these issues.  Instead of:
1574     exp: { $<ival>$ = 1; } { $<ival>$ = 2; }   { $$ = $<ival>1 + $<ival>2; }
1576   write:
1578     exp: <ival>{ $$ = 1; } <ival>{ $$ = 2; }   { $$ = $1 + $2; }
1580 *** Reports include the type of the symbols
1582   The sections about terminal and nonterminal symbols of the '*.output' file
1583   now specify their declared type.  For instance, for:
1585     %token <ival> NUM
1587   the report now shows '<ival>':
1589     Terminals, with rules where they appear
1591     NUM <ival> (258) 5
1593 *** Diagnostics about useless rules
1595   In the following grammar, the 'exp' nonterminal is trivially useless.  So,
1596   of course, its rules are useless too.
1598     %%
1599     input: '0' | exp
1600     exp: exp '+' exp | exp '-' exp | '(' exp ')'
1602   Previously all the useless rules were reported, including those whose
1603   left-hand side is the 'exp' nonterminal:
1605     warning: 1 nonterminal useless in grammar [-Wother]
1606     warning: 4 rules useless in grammar [-Wother]
1607     2.14-16: warning: nonterminal useless in grammar: exp [-Wother]
1608      input: '0' | exp
1609                   ^^^
1610     2.14-16: warning: rule useless in grammar [-Wother]
1611      input: '0' | exp
1612                   ^^^
1613     3.6-16: warning: rule useless in grammar [-Wother]
1614      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1615           ^^^^^^^^^^^
1616     3.20-30: warning: rule useless in grammar [-Wother]
1617      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1618                         ^^^^^^^^^^^
1619     3.34-44: warning: rule useless in grammar [-Wother]
1620      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1621                                       ^^^^^^^^^^^
1623   Now, rules whose left-hand side symbol is useless are no longer reported
1624   as useless.  The locations of the errors have also been adjusted to point
1625   to the first use of the nonterminal as a left-hand side of a rule:
1627     warning: 1 nonterminal useless in grammar [-Wother]
1628     warning: 4 rules useless in grammar [-Wother]
1629     3.1-3: warning: nonterminal useless in grammar: exp [-Wother]
1630      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1631      ^^^
1632     2.14-16: warning: rule useless in grammar [-Wother]
1633      input: '0' | exp
1634                   ^^^
1636 *** C++: Generated parsers can be compiled with -fno-exceptions (lalr1.cc)
1638   When compiled with exceptions disabled, the generated parsers no longer
1639   uses try/catch clauses.
1641   Currently only GCC and Clang are supported.
1643 ** Documentation
1645 *** A demonstration of variants
1647   A new example was added (installed in .../share/doc/bison/examples),
1648   'variant.yy', which shows how to use (Bison) variants in C++.
1650   The other examples were made nicer to read.
1652 *** Some features are no longer 'experimental'
1654   The following features, mature enough, are no longer flagged as
1655   experimental in the documentation: push parsers, default %printer and
1656   %destructor (typed: <*> and untyped: <>), %define api.value.type union and
1657   variant, Java parsers, XML output, LR family (lr, ielr, lalr), and
1658   semantic predicates (%?).
1660 ** Bug fixes
1662 *** GLR: Predicates support broken by #line directives
1664   Predicates (%?) in GLR such as
1666     widget:
1667       %? {new_syntax} 'w' id new_args
1668     | %?{!new_syntax} 'w' id old_args
1670   were issued with #lines in the middle of C code.
1672 *** Printer and destructor with broken #line directives
1674   The #line directives were not properly escaped when emitting the code for
1675   %printer/%destructor, which resulted in compiler errors if there are
1676   backslashes or double-quotes in the grammar file name.
1678 *** Portability on ICC
1680   The Intel compiler claims compatibility with GCC, yet rejects its _Pragma.
1681   Generated parsers now work around this.
1683 *** Various
1685   There were several small fixes in the test suite and in the build system,
1686   many warnings in bison and in the generated parsers were eliminated.  The
1687   documentation also received its share of minor improvements.
1689   Useless code was removed from C++ parsers, and some of the generated
1690   constructors are more 'natural'.
1693 * Noteworthy changes in release 3.0.5 (2018-05-27) [stable]
1695 ** Bug fixes
1697 *** C++: Fix support of 'syntax_error'
1699   One incorrect 'inline' resulted in linking errors about the constructor of
1700   the syntax_error exception.
1702 *** C++: Fix warnings
1704   GCC 7.3 (with -O1 or -O2 but not -O0 or -O3) issued null-dereference
1705   warnings about yyformat being possibly null.  It also warned about the
1706   deprecated implicit definition of copy constructors when there's a
1707   user-defined (copy) assignment operator.
1709 *** Location of errors
1711   In C++ parsers, out-of-bounds errors can happen when a rule with an empty
1712   ride-hand side raises a syntax error.  The behavior of the default parser
1713   (yacc.c) in such a condition was undefined.
1715   Now all the parsers match the behavior of glr.c: @$ is used as the
1716   location of the error.  This handles gracefully rules with and without
1717   rhs.
1719 *** Portability fixes in the test suite
1721   On some platforms, some Java and/or C++ tests were failing.
1724 * Noteworthy changes in release 3.0.4 (2015-01-23) [stable]
1726 ** Bug fixes
1728 *** C++ with Variants (lalr1.cc)
1730   Fix a compiler warning when no %destructor use $$.
1732 *** Test suites
1734   Several portability issues in tests were fixed.
1737 * Noteworthy changes in release 3.0.3 (2015-01-15) [stable]
1739 ** Bug fixes
1741 *** C++ with Variants (lalr1.cc)
1743   Problems with %destructor and '%define parse.assert' have been fixed.
1745 *** Named %union support (yacc.c, glr.c)
1747   Bison 3.0 introduced a regression on named %union such as
1749     %union foo { int ival; };
1751   The possibility to use a name was introduced "for Yacc compatibility".
1752   It is however not required by POSIX Yacc, and its usefulness is not clear.
1754 *** %define api.value.type union with %defines (yacc.c, glr.c)
1756   The C parsers were broken when %defines was used together with "%define
1757   api.value.type union".
1759 *** Redeclarations are reported in proper order
1761   On
1763     %token FOO "foo"
1764     %printer {} "foo"
1765     %printer {} FOO
1767   bison used to report:
1769     foo.yy:2.10-11: error: %printer redeclaration for FOO
1770      %printer {} "foo"
1771               ^^
1772     foo.yy:3.10-11:     previous declaration
1773      %printer {} FOO
1774               ^^
1776   Now, the "previous" declaration is always the first one.
1779 ** Documentation
1781   Bison now installs various files in its docdir (which defaults to
1782   '/usr/local/share/doc/bison'), including the three fully blown examples
1783   extracted from the documentation:
1785    - rpcalc
1786      Reverse Polish Calculator, a simple introductory example.
1787    - mfcalc
1788      Multi-function Calc, a calculator with memory and functions and located
1789      error messages.
1790    - calc++
1791      a calculator in C++ using variant support and token constructors.
1794 * Noteworthy changes in release 3.0.2 (2013-12-05) [stable]
1796 ** Bug fixes
1798 *** Generated source files when errors are reported
1800   When warnings are issued and -Werror is set, bison would still generate
1801   the source files (*.c, *.h...).  As a consequence, some runs of "make"
1802   could fail the first time, but not the second (as the files were generated
1803   anyway).
1805   This is fixed: bison no longer generates this source files, but, of
1806   course, still produces the various reports (*.output, *.xml, etc.).
1808 *** %empty is used in reports
1810   Empty right-hand sides are denoted by '%empty' in all the reports (text,
1811   dot, XML and formats derived from it).
1813 *** YYERROR and variants
1815   When C++ variant support is enabled, an error triggered via YYERROR, but
1816   not caught via error recovery, resulted in a double deletion.
1819 * Noteworthy changes in release 3.0.1 (2013-11-12) [stable]
1821 ** Bug fixes
1823 *** Errors in caret diagnostics
1825   On some platforms, some errors could result in endless diagnostics.
1827 *** Fixes of the -Werror option
1829   Options such as "-Werror -Wno-error=foo" were still turning "foo"
1830   diagnostics into errors instead of warnings.  This is fixed.
1832   Actually, for consistency with GCC, "-Wno-error=foo -Werror" now also
1833   leaves "foo" diagnostics as warnings.  Similarly, with "-Werror=foo
1834   -Wno-error", "foo" diagnostics are now errors.
1836 *** GLR Predicates
1838   As demonstrated in the documentation, one can now leave spaces between
1839   "%?" and its "{".
1841 *** Installation
1843   The yacc.1 man page is no longer installed if --disable-yacc was
1844   specified.
1846 *** Fixes in the test suite
1848   Bugs and portability issues.
1851 * Noteworthy changes in release 3.0 (2013-07-25) [stable]
1853 ** WARNING: Future backward-incompatibilities!
1855   Like other GNU packages, Bison will start using some of the C99 features
1856   for its own code, especially the definition of variables after statements.
1857   The generated C parsers still aim at C90.
1859 ** Backward incompatible changes
1861 *** Obsolete features
1863   Support for YYFAIL is removed (deprecated in Bison 2.4.2): use YYERROR.
1865   Support for yystype and yyltype is removed (deprecated in Bison 1.875):
1866   use YYSTYPE and YYLTYPE.
1868   Support for YYLEX_PARAM and YYPARSE_PARAM is removed (deprecated in Bison
1869   1.875): use %lex-param, %parse-param, or %param.
1871   Missing semicolons at the end of actions are no longer added (as announced
1872   in the release 2.5).
1874 *** Use of YACC='bison -y'
1876   TL;DR: With Autoconf <= 2.69, pass -Wno-yacc to (AM_)YFLAGS if you use
1877   Bison extensions.
1879   Traditional Yacc generates 'y.tab.c' whatever the name of the input file.
1880   Therefore Makefiles written for Yacc expect 'y.tab.c' (and possibly
1881   'y.tab.h' and 'y.output') to be generated from 'foo.y'.
1883   To this end, for ages, AC_PROG_YACC, Autoconf's macro to look for an
1884   implementation of Yacc, was using Bison as 'bison -y'.  While it does
1885   ensure compatible output file names, it also enables warnings for
1886   incompatibilities with POSIX Yacc.  In other words, 'bison -y' triggers
1887   warnings for Bison extensions.
1889   Autoconf 2.70+ fixes this incompatibility by using YACC='bison -o y.tab.c'
1890   (which also generates 'y.tab.h' and 'y.output' when needed).
1891   Alternatively, disable Yacc warnings by passing '-Wno-yacc' to your Yacc
1892   flags (YFLAGS, or AM_YFLAGS with Automake).
1894 ** Bug fixes
1896 *** The epilogue is no longer affected by internal #defines (glr.c)
1898   The glr.c skeleton uses defines such as #define yylval (yystackp->yyval) in
1899   generated code.  These weren't properly undefined before the inclusion of
1900   the user epilogue, so functions such as the following were butchered by the
1901   preprocessor expansion:
1903     int yylex (YYSTYPE *yylval);
1905   This is fixed: yylval, yynerrs, yychar, and yylloc are now valid
1906   identifiers for user-provided variables.
1908 *** stdio.h is no longer needed when locations are enabled (yacc.c)
1910   Changes in Bison 2.7 introduced a dependency on FILE and fprintf when
1911   locations are enabled.  This is fixed.
1913 *** Warnings about useless %pure-parser/%define api.pure are restored
1915 ** Diagnostics reported by Bison
1917   Most of these features were contributed by Théophile Ranquet and Victor
1918   Santet.
1920 *** Carets
1922   Version 2.7 introduced caret errors, for a prettier output.  These are now
1923   activated by default.  The old format can still be used by invoking Bison
1924   with -fno-caret (or -fnone).
1926   Some error messages that reproduced excerpts of the grammar are now using
1927   the caret information only.  For instance on:
1929     %%
1930     exp: 'a' | 'a';
1932   Bison 2.7 reports:
1934     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
1935     in.y:2.12-14: warning: rule useless in parser due to conflicts: exp: 'a' [-Wother]
1937   Now bison reports:
1939     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
1940     in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
1941      exp: 'a' | 'a';
1942                 ^^^
1944   and "bison -fno-caret" reports:
1946     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
1947     in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
1949 *** Enhancements of the -Werror option
1951   The -Werror=CATEGORY option is now recognized, and will treat specified
1952   warnings as errors. The warnings need not have been explicitly activated
1953   using the -W option, this is similar to what GCC 4.7 does.
1955   For example, given the following command line, Bison will treat both
1956   warnings related to POSIX Yacc incompatibilities and S/R conflicts as
1957   errors (and only those):
1959     $ bison -Werror=yacc,error=conflicts-sr input.y
1961   If no categories are specified, -Werror will make all active warnings into
1962   errors. For example, the following line does the same the previous example:
1964     $ bison -Werror -Wnone -Wyacc -Wconflicts-sr input.y
1966   (By default -Wconflicts-sr,conflicts-rr,deprecated,other is enabled.)
1968   Note that the categories in this -Werror option may not be prefixed with
1969   "no-". However, -Wno-error[=CATEGORY] is valid.
1971   Note that -y enables -Werror=yacc. Therefore it is now possible to require
1972   Yacc-like behavior (e.g., always generate y.tab.c), but to report
1973   incompatibilities as warnings: "-y -Wno-error=yacc".
1975 *** The display of warnings is now richer
1977   The option that controls a given warning is now displayed:
1979     foo.y:4.6: warning: type clash on default action: <foo> != <bar> [-Wother]
1981   In the case of warnings treated as errors, the prefix is changed from
1982   "warning: " to "error: ", and the suffix is displayed, in a manner similar
1983   to GCC, as [-Werror=CATEGORY].
1985   For instance, where the previous version of Bison would report (and exit
1986   with failure):
1988     bison: warnings being treated as errors
1989     input.y:1.1: warning: stray ',' treated as white space
1991   it now reports:
1993     input.y:1.1: error: stray ',' treated as white space [-Werror=other]
1995 *** Deprecated constructs
1997   The new 'deprecated' warning category flags obsolete constructs whose
1998   support will be discontinued.  It is enabled by default.  These warnings
1999   used to be reported as 'other' warnings.
2001 *** Useless semantic types
2003   Bison now warns about useless (uninhabited) semantic types.  Since
2004   semantic types are not declared to Bison (they are defined in the opaque
2005   %union structure), it is %printer/%destructor directives about useless
2006   types that trigger the warning:
2008     %token <type1> term
2009     %type  <type2> nterm
2010     %printer    {} <type1> <type3>
2011     %destructor {} <type2> <type4>
2012     %%
2013     nterm: term { $$ = $1; };
2015     3.28-34: warning: type <type3> is used, but is not associated to any symbol
2016     4.28-34: warning: type <type4> is used, but is not associated to any symbol
2018 *** Undefined but unused symbols
2020   Bison used to raise an error for undefined symbols that are not used in
2021   the grammar.  This is now only a warning.
2023     %printer    {} symbol1
2024     %destructor {} symbol2
2025     %type <type>   symbol3
2026     %%
2027     exp: "a";
2029 *** Useless destructors or printers
2031   Bison now warns about useless destructors or printers.  In the following
2032   example, the printer for <type1>, and the destructor for <type2> are
2033   useless: all symbols of <type1> (token1) already have a printer, and all
2034   symbols of type <type2> (token2) already have a destructor.
2036     %token <type1> token1
2037            <type2> token2
2038            <type3> token3
2039            <type4> token4
2040     %printer    {} token1 <type1> <type3>
2041     %destructor {} token2 <type2> <type4>
2043 *** Conflicts
2045   The warnings and error messages about shift/reduce and reduce/reduce
2046   conflicts have been normalized.  For instance on the following foo.y file:
2048     %glr-parser
2049     %%
2050     exp: exp '+' exp | '0' | '0';
2052   compare the previous version of bison:
2054     $ bison foo.y
2055     foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2056     $ bison -Werror foo.y
2057     bison: warnings being treated as errors
2058     foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2060   with the new behavior:
2062     $ bison foo.y
2063     foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
2064     foo.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
2065     $ bison -Werror foo.y
2066     foo.y: error: 1 shift/reduce conflict [-Werror=conflicts-sr]
2067     foo.y: error: 2 reduce/reduce conflicts [-Werror=conflicts-rr]
2069   When %expect or %expect-rr is used, such as with bar.y:
2071     %expect 0
2072     %glr-parser
2073     %%
2074     exp: exp '+' exp | '0' | '0';
2076   Former behavior:
2078     $ bison bar.y
2079     bar.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2080     bar.y: expected 0 shift/reduce conflicts
2081     bar.y: expected 0 reduce/reduce conflicts
2083   New one:
2085     $ bison bar.y
2086     bar.y: error: shift/reduce conflicts: 1 found, 0 expected
2087     bar.y: error: reduce/reduce conflicts: 2 found, 0 expected
2089 ** Incompatibilities with POSIX Yacc
2091   The 'yacc' category is no longer part of '-Wall', enable it explicitly
2092   with '-Wyacc'.
2094 ** Additional yylex/yyparse arguments
2096   The new directive %param declares additional arguments to both yylex and
2097   yyparse.  The %lex-param, %parse-param, and %param directives support one
2098   or more arguments.  Instead of
2100     %lex-param   {arg1_type *arg1}
2101     %lex-param   {arg2_type *arg2}
2102     %parse-param {arg1_type *arg1}
2103     %parse-param {arg2_type *arg2}
2105   one may now declare
2107     %param {arg1_type *arg1} {arg2_type *arg2}
2109 ** Types of values for %define variables
2111   Bison used to make no difference between '%define foo bar' and '%define
2112   foo "bar"'.  The former is now called a 'keyword value', and the latter a
2113   'string value'.  A third kind was added: 'code values', such as '%define
2114   foo {bar}'.
2116   Keyword variables are used for fixed value sets, e.g.,
2118     %define lr.type lalr
2120   Code variables are used for value in the target language, e.g.,
2122     %define api.value.type {struct semantic_type}
2124   String variables are used remaining cases, e.g. file names.
2126 ** Variable api.token.prefix
2128   The variable api.token.prefix changes the way tokens are identified in
2129   the generated files.  This is especially useful to avoid collisions
2130   with identifiers in the target language.  For instance
2132     %token FILE for ERROR
2133     %define api.token.prefix {TOK_}
2134     %%
2135     start: FILE for ERROR;
2137   will generate the definition of the symbols TOK_FILE, TOK_for, and
2138   TOK_ERROR in the generated sources.  In particular, the scanner must
2139   use these prefixed token names, although the grammar itself still
2140   uses the short names (as in the sample rule given above).
2142 ** Variable api.value.type
2144   This new %define variable supersedes the #define macro YYSTYPE.  The use
2145   of YYSTYPE is discouraged.  In particular, #defining YYSTYPE *and* either
2146   using %union or %defining api.value.type results in undefined behavior.
2148   Either define api.value.type, or use "%union":
2150     %union
2151     {
2152       int ival;
2153       char *sval;
2154     }
2155     %token <ival> INT "integer"
2156     %token <sval> STRING "string"
2157     %printer { fprintf (yyo, "%d", $$); } <ival>
2158     %destructor { free ($$); } <sval>
2160     /* In yylex().  */
2161     yylval.ival = 42; return INT;
2162     yylval.sval = "42"; return STRING;
2164   The %define variable api.value.type supports both keyword and code values.
2166   The keyword value 'union' means that the user provides genuine types, not
2167   union member names such as "ival" and "sval" above (WARNING: will fail if
2168   -y/--yacc/%yacc is enabled).
2170     %define api.value.type union
2171     %token <int> INT "integer"
2172     %token <char *> STRING "string"
2173     %printer { fprintf (yyo, "%d", $$); } <int>
2174     %destructor { free ($$); } <char *>
2176     /* In yylex().  */
2177     yylval.INT = 42; return INT;
2178     yylval.STRING = "42"; return STRING;
2180   The keyword value variant is somewhat equivalent, but for C++ special
2181   provision is made to allow classes to be used (more about this below).
2183     %define api.value.type variant
2184     %token <int> INT "integer"
2185     %token <std::string> STRING "string"
2187   Code values (in braces) denote user defined types.  This is where YYSTYPE
2188   used to be used.
2190     %code requires
2191     {
2192       struct my_value
2193       {
2194         enum
2195         {
2196           is_int, is_string
2197         } kind;
2198         union
2199         {
2200           int ival;
2201           char *sval;
2202         } u;
2203       };
2204     }
2205     %define api.value.type {struct my_value}
2206     %token <u.ival> INT "integer"
2207     %token <u.sval> STRING "string"
2208     %printer { fprintf (yyo, "%d", $$); } <u.ival>
2209     %destructor { free ($$); } <u.sval>
2211     /* In yylex().  */
2212     yylval.u.ival = 42; return INT;
2213     yylval.u.sval = "42"; return STRING;
2215 ** Variable parse.error
2217   This variable controls the verbosity of error messages.  The use of the
2218   %error-verbose directive is deprecated in favor of "%define parse.error
2219   verbose".
2221 ** Deprecated %define variable names
2223   The following variables have been renamed for consistency.  Backward
2224   compatibility is ensured, but upgrading is recommended.
2226     lr.default-reductions      -> lr.default-reduction
2227     lr.keep-unreachable-states -> lr.keep-unreachable-state
2228     namespace                  -> api.namespace
2229     stype                      -> api.value.type
2231 ** Semantic predicates
2233   Contributed by Paul Hilfinger.
2235   The new, experimental, semantic-predicate feature allows actions of the
2236   form "%?{ BOOLEAN-EXPRESSION }", which cause syntax errors (as for
2237   YYERROR) if the expression evaluates to 0, and are evaluated immediately
2238   in GLR parsers, rather than being deferred.  The result is that they allow
2239   the programmer to prune possible parses based on the values of run-time
2240   expressions.
2242 ** The directive %expect-rr is now an error in non GLR mode
2244   It used to be an error only if used in non GLR mode, _and_ if there are
2245   reduce/reduce conflicts.
2247 ** Tokens are numbered in their order of appearance
2249   Contributed by Valentin Tolmer.
2251   With '%token A B', A had a number less than the one of B.  However,
2252   precedence declarations used to generate a reversed order.  This is now
2253   fixed, and introducing tokens with any of %token, %left, %right,
2254   %precedence, or %nonassoc yields the same result.
2256   When mixing declarations of tokens with a literal character (e.g., 'a') or
2257   with an identifier (e.g., B) in a precedence declaration, Bison numbered
2258   the literal characters first.  For example
2260     %right A B 'c' 'd'
2262   would lead to the tokens declared in this order: 'c' 'd' A B.  Again, the
2263   input order is now preserved.
2265   These changes were made so that one can remove useless precedence and
2266   associativity declarations (i.e., map %nonassoc, %left or %right to
2267   %precedence, or to %token) and get exactly the same output.
2269 ** Useless precedence and associativity
2271   Contributed by Valentin Tolmer.
2273   When developing and maintaining a grammar, useless associativity and
2274   precedence directives are common.  They can be a nuisance: new ambiguities
2275   arising are sometimes masked because their conflicts are resolved due to
2276   the extra precedence or associativity information.  Furthermore, it can
2277   hinder the comprehension of a new grammar: one will wonder about the role
2278   of a precedence, where in fact it is useless.  The following changes aim
2279   at detecting and reporting these extra directives.
2281 *** Precedence warning category
2283   A new category of warning, -Wprecedence, was introduced. It flags the
2284   useless precedence and associativity directives.
2286 *** Useless associativity
2288   Bison now warns about symbols with a declared associativity that is never
2289   used to resolve conflicts.  In that case, using %precedence is sufficient;
2290   the parsing tables will remain unchanged.  Solving these warnings may raise
2291   useless precedence warnings, as the symbols no longer have associativity.
2292   For example:
2294     %left '+'
2295     %left '*'
2296     %%
2297     exp:
2298       "number"
2299     | exp '+' "number"
2300     | exp '*' exp
2301     ;
2303   will produce a
2305     warning: useless associativity for '+', use %precedence [-Wprecedence]
2306      %left '+'
2307            ^^^
2309 *** Useless precedence
2311   Bison now warns about symbols with a declared precedence and no declared
2312   associativity (i.e., declared with %precedence), and whose precedence is
2313   never used.  In that case, the symbol can be safely declared with %token
2314   instead, without modifying the parsing tables.  For example:
2316     %precedence '='
2317     %%
2318     exp: "var" '=' "number";
2320   will produce a
2322     warning: useless precedence for '=' [-Wprecedence]
2323      %precedence '='
2324                  ^^^
2326 *** Useless precedence and associativity
2328   In case of both useless precedence and associativity, the issue is flagged
2329   as follows:
2331     %nonassoc '='
2332     %%
2333     exp: "var" '=' "number";
2335   The warning is:
2337     warning: useless precedence and associativity for '=' [-Wprecedence]
2338      %nonassoc '='
2339                ^^^
2341 ** Empty rules
2343   With help from Joel E. Denny and Gabriel Rassoul.
2345   Empty rules (i.e., with an empty right-hand side) can now be explicitly
2346   marked by the new %empty directive.  Using %empty on a non-empty rule is
2347   an error.  The new -Wempty-rule warning reports empty rules without
2348   %empty.  On the following grammar:
2350     %%
2351     s: a b c;
2352     a: ;
2353     b: %empty;
2354     c: 'a' %empty;
2356   bison reports:
2358     3.4-5: warning: empty rule without %empty [-Wempty-rule]
2359      a: {}
2360         ^^
2361     5.8-13: error: %empty on non-empty rule
2362      c: 'a' %empty {};
2363             ^^^^^^
2365 ** Java skeleton improvements
2367   The constants for token names were moved to the Lexer interface.  Also, it
2368   is possible to add code to the parser's constructors using "%code init"
2369   and "%define init_throws".
2370   Contributed by Paolo Bonzini.
2372   The Java skeleton now supports push parsing.
2373   Contributed by Dennis Heimbigner.
2375 ** C++ skeletons improvements
2377 *** The parser header is no longer mandatory (lalr1.cc, glr.cc)
2379   Using %defines is now optional.  Without it, the needed support classes
2380   are defined in the generated parser, instead of additional files (such as
2381   location.hh, position.hh and stack.hh).
2383 *** Locations are no longer mandatory (lalr1.cc, glr.cc)
2385   Both lalr1.cc and glr.cc no longer require %location.
2387 *** syntax_error exception (lalr1.cc)
2389   The C++ parser features a syntax_error exception, which can be
2390   thrown from the scanner or from user rules to raise syntax errors.
2391   This facilitates reporting errors caught in sub-functions (e.g.,
2392   rejecting too large integral literals from a conversion function
2393   used by the scanner, or rejecting invalid combinations from a
2394   factory invoked by the user actions).
2396 *** %define api.value.type variant
2398   This is based on a submission from Michiel De Wilde.  With help
2399   from Théophile Ranquet.
2401   In this mode, complex C++ objects can be used as semantic values.  For
2402   instance:
2404     %token <::std::string> TEXT;
2405     %token <int> NUMBER;
2406     %token SEMICOLON ";"
2407     %type <::std::string> item;
2408     %type <::std::list<std::string>> list;
2409     %%
2410     result:
2411       list  { std::cout << $1 << std::endl; }
2412     ;
2414     list:
2415       %empty        { /* Generates an empty string list. */ }
2416     | list item ";" { std::swap ($$, $1); $$.push_back ($2); }
2417     ;
2419     item:
2420       TEXT    { std::swap ($$, $1); }
2421     | NUMBER  { $$ = string_cast ($1); }
2422     ;
2424 *** %define api.token.constructor
2426   When variants are enabled, Bison can generate functions to build the
2427   tokens.  This guarantees that the token type (e.g., NUMBER) is consistent
2428   with the semantic value (e.g., int):
2430     parser::symbol_type yylex ()
2431     {
2432       parser::location_type loc = ...;
2433       ...
2434       return parser::make_TEXT ("Hello, world!", loc);
2435       ...
2436       return parser::make_NUMBER (42, loc);
2437       ...
2438       return parser::make_SEMICOLON (loc);
2439       ...
2440     }
2442 *** C++ locations
2444   There are operator- and operator-= for 'location'.  Negative line/column
2445   increments can no longer underflow the resulting value.
2448 * Noteworthy changes in release 2.7.1 (2013-04-15) [stable]
2450 ** Bug fixes
2452 *** Fix compiler attribute portability (yacc.c)
2454   With locations enabled, __attribute__ was used unprotected.
2456 *** Fix some compiler warnings (lalr1.cc)
2459 * Noteworthy changes in release 2.7 (2012-12-12) [stable]
2461 ** Bug fixes
2463   Warnings about uninitialized yylloc in yyparse have been fixed.
2465   Restored C90 compliance (yet no report was ever made).
2467 ** Diagnostics are improved
2469   Contributed by Théophile Ranquet.
2471 *** Changes in the format of error messages
2473   This used to be the format of many error reports:
2475     input.y:2.7-12: %type redeclaration for exp
2476     input.y:1.7-12: previous declaration
2478   It is now:
2480     input.y:2.7-12: error: %type redeclaration for exp
2481     input.y:1.7-12:     previous declaration
2483 *** New format for error reports: carets
2485   Caret errors have been added to Bison:
2487     input.y:2.7-12: error: %type redeclaration for exp
2488      %type <sval> exp
2489            ^^^^^^
2490     input.y:1.7-12:     previous declaration
2491      %type <ival> exp
2492            ^^^^^^
2494   or
2496     input.y:3.20-23: error: ambiguous reference: '$exp'
2497      exp: exp '+' exp { $exp = $1 + $3; };
2498                         ^^^^
2499     input.y:3.1-3:       refers to: $exp at $$
2500      exp: exp '+' exp { $exp = $1 + $3; };
2501      ^^^
2502     input.y:3.6-8:       refers to: $exp at $1
2503      exp: exp '+' exp { $exp = $1 + $3; };
2504           ^^^
2505     input.y:3.14-16:     refers to: $exp at $3
2506      exp: exp '+' exp { $exp = $1 + $3; };
2507                   ^^^
2509   The default behavior for now is still not to display these unless
2510   explicitly asked with -fcaret (or -fall). However, in a later release, it
2511   will be made the default behavior (but may still be deactivated with
2512   -fno-caret).
2514 ** New value for %define variable: api.pure full
2516   The %define variable api.pure requests a pure (reentrant) parser. However,
2517   for historical reasons, using it in a location-tracking Yacc parser
2518   resulted in a yyerror function that did not take a location as a
2519   parameter. With this new value, the user may request a better pure parser,
2520   where yyerror does take a location as a parameter (in location-tracking
2521   parsers).
2523   The use of "%define api.pure true" is deprecated in favor of this new
2524   "%define api.pure full".
2526 ** New %define variable: api.location.type (glr.cc, lalr1.cc, lalr1.java)
2528   The %define variable api.location.type defines the name of the type to use
2529   for locations.  When defined, Bison no longer generates the position.hh
2530   and location.hh files, nor does the parser will include them: the user is
2531   then responsible to define her type.
2533   This can be used in programs with several parsers to factor their location
2534   and position files: let one of them generate them, and the others just use
2535   them.
2537   This feature was actually introduced, but not documented, in Bison 2.5,
2538   under the name "location_type" (which is maintained for backward
2539   compatibility).
2541   For consistency, lalr1.java's %define variables location_type and
2542   position_type are deprecated in favor of api.location.type and
2543   api.position.type.
2545 ** Exception safety (lalr1.cc)
2547   The parse function now catches exceptions, uses the %destructors to
2548   release memory (the lookahead symbol and the symbols pushed on the stack)
2549   before re-throwing the exception.
2551   This feature is somewhat experimental.  User feedback would be
2552   appreciated.
2554 ** Graph improvements in DOT and XSLT
2556   Contributed by Théophile Ranquet.
2558   The graphical presentation of the states is more readable: their shape is
2559   now rectangular, the state number is clearly displayed, and the items are
2560   numbered and left-justified.
2562   The reductions are now explicitly represented as transitions to other
2563   diamond shaped nodes.
2565   These changes are present in both --graph output and xml2dot.xsl XSLT
2566   processing, with minor (documented) differences.
2568 ** %language is no longer an experimental feature.
2570   The introduction of this feature, in 2.4, was four years ago. The
2571   --language option and the %language directive are no longer experimental.
2573 ** Documentation
2575   The sections about shift/reduce and reduce/reduce conflicts resolution
2576   have been fixed and extended.
2578   Although introduced more than four years ago, XML and Graphviz reports
2579   were not properly documented.
2581   The translation of midrule actions is now described.
2584 * Noteworthy changes in release 2.6.5 (2012-11-07) [stable]
2586   We consider compiler warnings about Bison generated parsers to be bugs.
2587   Rather than working around them in your own project, please consider
2588   reporting them to us.
2590 ** Bug fixes
2592   Warnings about uninitialized yylval and/or yylloc for push parsers with a
2593   pure interface have been fixed for GCC 4.0 up to 4.8, and Clang 2.9 to
2594   3.2.
2596   Other issues in the test suite have been addressed.
2598   Null characters are correctly displayed in error messages.
2600   When possible, yylloc is correctly initialized before calling yylex.  It
2601   is no longer necessary to initialize it in the %initial-action.
2604 * Noteworthy changes in release 2.6.4 (2012-10-23) [stable]
2606   Bison 2.6.3's --version was incorrect.  This release fixes this issue.
2609 * Noteworthy changes in release 2.6.3 (2012-10-22) [stable]
2611 ** Bug fixes
2613   Bugs and portability issues in the test suite have been fixed.
2615   Some errors in translations have been addressed, and --help now directs
2616   users to the appropriate place to report them.
2618   Stray Info files shipped by accident are removed.
2620   Incorrect definitions of YY_, issued by yacc.c when no parser header is
2621   generated, are removed.
2623   All the generated headers are self-contained.
2625 ** Header guards (yacc.c, glr.c, glr.cc)
2627   In order to avoid collisions, the header guards are now
2628   YY_<PREFIX>_<FILE>_INCLUDED, instead of merely <PREFIX>_<FILE>.
2629   For instance the header generated from
2631     %define api.prefix "calc"
2632     %defines "lib/parse.h"
2634   will use YY_CALC_LIB_PARSE_H_INCLUDED as guard.
2636 ** Fix compiler warnings in the generated parser (yacc.c, glr.c)
2638   The compilation of pure parsers (%define api.pure) can trigger GCC
2639   warnings such as:
2641     input.c: In function 'yyparse':
2642     input.c:1503:12: warning: 'yylval' may be used uninitialized in this
2643                               function [-Wmaybe-uninitialized]
2644        *++yyvsp = yylval;
2645                 ^
2647   This is now fixed; pragmas to avoid these warnings are no longer needed.
2649   Warnings from clang ("equality comparison with extraneous parentheses" and
2650   "function declared 'noreturn' should not return") have also been
2651   addressed.
2654 * Noteworthy changes in release 2.6.2 (2012-08-03) [stable]
2656 ** Bug fixes
2658   Buffer overruns, complaints from Flex, and portability issues in the test
2659   suite have been fixed.
2661 ** Spaces in %lex- and %parse-param (lalr1.cc, glr.cc)
2663   Trailing end-of-lines in %parse-param or %lex-param would result in
2664   invalid C++.  This is fixed.
2666 ** Spurious spaces and end-of-lines
2668   The generated files no longer end (nor start) with empty lines.
2671 * Noteworthy changes in release 2.6.1 (2012-07-30) [stable]
2673  Bison no longer executes user-specified M4 code when processing a grammar.
2675 ** Future Changes
2677   In addition to the removal of the features announced in Bison 2.6, the
2678   next major release will remove the "Temporary hack for adding a semicolon
2679   to the user action", as announced in the release 2.5.  Instead of:
2681     exp: exp "+" exp { $$ = $1 + $3 };
2683   write:
2685     exp: exp "+" exp { $$ = $1 + $3; };
2687 ** Bug fixes
2689 *** Type names are now properly escaped.
2691 *** glr.cc: set_debug_level and debug_level work as expected.
2693 *** Stray @ or $ in actions
2695   While Bison used to warn about stray $ or @ in action rules, it did not
2696   for other actions such as printers, destructors, or initial actions.  It
2697   now does.
2699 ** Type names in actions
2701   For consistency with rule actions, it is now possible to qualify $$ by a
2702   type-name in destructors, printers, and initial actions.  For instance:
2704     %printer { fprintf (yyo, "(%d, %f)", $<ival>$, $<fval>$); } <*> <>;
2706   will display two values for each typed and untyped symbol (provided
2707   that YYSTYPE has both "ival" and "fval" fields).
2710 * Noteworthy changes in release 2.6 (2012-07-19) [stable]
2712 ** Future changes
2714   The next major release of Bison will drop support for the following
2715   deprecated features.  Please report disagreements to bug-bison@gnu.org.
2717 *** K&R C parsers
2719   Support for generating parsers in K&R C will be removed.  Parsers
2720   generated for C support ISO C90, and are tested with ISO C99 and ISO C11
2721   compilers.
2723 *** Features deprecated since Bison 1.875
2725   The definitions of yystype and yyltype will be removed; use YYSTYPE and
2726   YYLTYPE.
2728   YYPARSE_PARAM and YYLEX_PARAM, deprecated in favor of %parse-param and
2729   %lex-param, will no longer be supported.
2731   Support for the preprocessor symbol YYERROR_VERBOSE will be removed, use
2732   %error-verbose.
2734 *** The generated header will be included (yacc.c)
2736   Instead of duplicating the content of the generated header (definition of
2737   YYSTYPE, yyparse declaration etc.), the generated parser will include it,
2738   as is already the case for GLR or C++ parsers.  This change is deferred
2739   because existing versions of ylwrap (e.g., Automake 1.12.1) do not support
2740   it.
2742 ** Generated Parser Headers
2744 *** Guards (yacc.c, glr.c, glr.cc)
2746   The generated headers are now guarded, as is already the case for C++
2747   parsers (lalr1.cc).  For instance, with --defines=foo.h:
2749     #ifndef YY_FOO_H
2750     # define YY_FOO_H
2751     ...
2752     #endif /* !YY_FOO_H  */
2754 *** New declarations (yacc.c, glr.c)
2756   The generated header now declares yydebug and yyparse.  Both honor
2757   --name-prefix=bar_, and yield
2759     int bar_parse (void);
2761   rather than
2763     #define yyparse bar_parse
2764     int yyparse (void);
2766   in order to facilitate the inclusion of several parser headers inside a
2767   single compilation unit.
2769 *** Exported symbols in C++
2771   The symbols YYTOKEN_TABLE and YYERROR_VERBOSE, which were defined in the
2772   header, are removed, as they prevent the possibility of including several
2773   generated headers from a single compilation unit.
2775 *** YYLSP_NEEDED
2777   For the same reasons, the undocumented and unused macro YYLSP_NEEDED is no
2778   longer defined.
2780 ** New %define variable: api.prefix
2782   Now that the generated headers are more complete and properly protected
2783   against multiple inclusions, constant names, such as YYSTYPE are a
2784   problem.  While yyparse and others are properly renamed by %name-prefix,
2785   YYSTYPE, YYDEBUG and others have never been affected by it.  Because it
2786   would introduce backward compatibility issues in projects not expecting
2787   YYSTYPE to be renamed, instead of changing the behavior of %name-prefix,
2788   it is deprecated in favor of a new %define variable: api.prefix.
2790   The following examples compares both:
2792     %name-prefix "bar_"               | %define api.prefix "bar_"
2793     %token <ival> FOO                   %token <ival> FOO
2794     %union { int ival; }                %union { int ival; }
2795     %%                                  %%
2796     exp: 'a';                           exp: 'a';
2798   bison generates:
2800     #ifndef BAR_FOO_H                   #ifndef BAR_FOO_H
2801     # define BAR_FOO_H                  # define BAR_FOO_H
2803     /* Enabling traces.  */             /* Enabling traces.  */
2804     # ifndef YYDEBUG                  | # ifndef BAR_DEBUG
2805                                       > #  if defined YYDEBUG
2806                                       > #   if YYDEBUG
2807                                       > #    define BAR_DEBUG 1
2808                                       > #   else
2809                                       > #    define BAR_DEBUG 0
2810                                       > #   endif
2811                                       > #  else
2812     #  define YYDEBUG 0               | #   define BAR_DEBUG 0
2813                                       > #  endif
2814     # endif                           | # endif
2816     # if YYDEBUG                      | # if BAR_DEBUG
2817     extern int bar_debug;               extern int bar_debug;
2818     # endif                             # endif
2820     /* Tokens.  */                      /* Tokens.  */
2821     # ifndef YYTOKENTYPE              | # ifndef BAR_TOKENTYPE
2822     #  define YYTOKENTYPE             | #  define BAR_TOKENTYPE
2823        enum yytokentype {             |    enum bar_tokentype {
2824          FOO = 258                           FOO = 258
2825        };                                  };
2826     # endif                             # endif
2828     #if ! defined YYSTYPE \           | #if ! defined BAR_STYPE \
2829      && ! defined YYSTYPE_IS_DECLARED |  && ! defined BAR_STYPE_IS_DECLARED
2830     typedef union YYSTYPE             | typedef union BAR_STYPE
2831     {                                   {
2832      int ival;                           int ival;
2833     } YYSTYPE;                        | } BAR_STYPE;
2834     # define YYSTYPE_IS_DECLARED 1    | # define BAR_STYPE_IS_DECLARED 1
2835     #endif                              #endif
2837     extern YYSTYPE bar_lval;          | extern BAR_STYPE bar_lval;
2839     int bar_parse (void);               int bar_parse (void);
2841     #endif /* !BAR_FOO_H  */            #endif /* !BAR_FOO_H  */
2844 * Noteworthy changes in release 2.5.1 (2012-06-05) [stable]
2846 ** Future changes:
2848   The next major release will drop support for generating parsers in K&R C.
2850 ** yacc.c: YYBACKUP works as expected.
2852 ** glr.c improvements:
2854 *** Location support is eliminated when not requested:
2856   GLR parsers used to include location-related code even when locations were
2857   not requested, and therefore not even usable.
2859 *** __attribute__ is preserved:
2861   __attribute__ is no longer disabled when __STRICT_ANSI__ is defined (i.e.,
2862   when -std is passed to GCC).
2864 ** lalr1.java: several fixes:
2866   The Java parser no longer throws ArrayIndexOutOfBoundsException if the
2867   first token leads to a syntax error.  Some minor clean ups.
2869 ** Changes for C++:
2871 *** C++11 compatibility:
2873   C and C++ parsers use "nullptr" instead of "0" when __cplusplus is 201103L
2874   or higher.
2876 *** Header guards
2878   The header files such as "parser.hh", "location.hh", etc. used a constant
2879   name for preprocessor guards, for instance:
2881     #ifndef BISON_LOCATION_HH
2882     # define BISON_LOCATION_HH
2883     ...
2884     #endif // !BISON_LOCATION_HH
2886   The inclusion guard is now computed from "PREFIX/FILE-NAME", where lower
2887   case characters are converted to upper case, and series of
2888   non-alphanumerical characters are converted to an underscore.
2890   With "bison -o lang++/parser.cc", "location.hh" would now include:
2892     #ifndef YY_LANG_LOCATION_HH
2893     # define YY_LANG_LOCATION_HH
2894     ...
2895     #endif // !YY_LANG_LOCATION_HH
2897 *** C++ locations:
2899   The position and location constructors (and their initialize methods)
2900   accept new arguments for line and column.  Several issues in the
2901   documentation were fixed.
2903 ** liby is no longer asking for "rpl_fprintf" on some platforms.
2905 ** Changes in the manual:
2907 *** %printer is documented
2909   The "%printer" directive, supported since at least Bison 1.50, is finally
2910   documented.  The "mfcalc" example is extended to demonstrate it.
2912   For consistency with the C skeletons, the C++ parsers now also support
2913   "yyoutput" (as an alias to "debug_stream ()").
2915 *** Several improvements have been made:
2917   The layout for grammar excerpts was changed to a more compact scheme.
2918   Named references are motivated.  The description of the automaton
2919   description file (*.output) is updated to the current format.  Incorrect
2920   index entries were fixed.  Some other errors were fixed.
2922 ** Building bison:
2924 *** Conflicting prototypes with recent/modified Flex.
2926   Fixed build problems with the current, unreleased, version of Flex, and
2927   some modified versions of 2.5.35, which have modified function prototypes.
2929 *** Warnings during the build procedure have been eliminated.
2931 *** Several portability problems in the test suite have been fixed:
2933   This includes warnings with some compilers, unexpected behavior of tools
2934   such as diff, warning messages from the test suite itself, etc.
2936 *** The install-pdf target works properly:
2938   Running "make install-pdf" (or -dvi, -html, -info, and -ps) no longer
2939   halts in the middle of its course.
2942 * Noteworthy changes in release 2.5 (2011-05-14)
2944 ** Grammar symbol names can now contain non-initial dashes:
2946   Consistently with directives (such as %error-verbose) and with
2947   %define variables (e.g. push-pull), grammar symbol names may contain
2948   dashes in any position except the beginning.  This is a GNU
2949   extension over POSIX Yacc.  Thus, use of this extension is reported
2950   by -Wyacc and rejected in Yacc mode (--yacc).
2952 ** Named references:
2954   Historically, Yacc and Bison have supported positional references
2955   ($n, $$) to allow access to symbol values from inside of semantic
2956   actions code.
2958   Starting from this version, Bison can also accept named references.
2959   When no ambiguity is possible, original symbol names may be used
2960   as named references:
2962     if_stmt : "if" cond_expr "then" then_stmt ';'
2963     { $if_stmt = mk_if_stmt($cond_expr, $then_stmt); }
2965   In the more common case, explicit names may be declared:
2967     stmt[res] : "if" expr[cond] "then" stmt[then] "else" stmt[else] ';'
2968     { $res = mk_if_stmt($cond, $then, $else); }
2970   Location information is also accessible using @name syntax.  When
2971   accessing symbol names containing dots or dashes, explicit bracketing
2972   ($[sym.1]) must be used.
2974   These features are experimental in this version.  More user feedback
2975   will help to stabilize them.
2976   Contributed by Alex Rozenman.
2978 ** IELR(1) and canonical LR(1):
2980   IELR(1) is a minimal LR(1) parser table generation algorithm.  That
2981   is, given any context-free grammar, IELR(1) generates parser tables
2982   with the full language-recognition power of canonical LR(1) but with
2983   nearly the same number of parser states as LALR(1).  This reduction
2984   in parser states is often an order of magnitude.  More importantly,
2985   because canonical LR(1)'s extra parser states may contain duplicate
2986   conflicts in the case of non-LR(1) grammars, the number of conflicts
2987   for IELR(1) is often an order of magnitude less as well.  This can
2988   significantly reduce the complexity of developing of a grammar.
2990   Bison can now generate IELR(1) and canonical LR(1) parser tables in
2991   place of its traditional LALR(1) parser tables, which remain the
2992   default.  You can specify the type of parser tables in the grammar
2993   file with these directives:
2995     %define lr.type lalr
2996     %define lr.type ielr
2997     %define lr.type canonical-lr
2999   The default-reduction optimization in the parser tables can also be
3000   adjusted using "%define lr.default-reductions".  For details on both
3001   of these features, see the new section "Tuning LR" in the Bison
3002   manual.
3004   These features are experimental.  More user feedback will help to
3005   stabilize them.
3007 ** LAC (Lookahead Correction) for syntax error handling
3009   Contributed by Joel E. Denny.
3011   Canonical LR, IELR, and LALR can suffer from a couple of problems
3012   upon encountering a syntax error.  First, the parser might perform
3013   additional parser stack reductions before discovering the syntax
3014   error.  Such reductions can perform user semantic actions that are
3015   unexpected because they are based on an invalid token, and they
3016   cause error recovery to begin in a different syntactic context than
3017   the one in which the invalid token was encountered.  Second, when
3018   verbose error messages are enabled (with %error-verbose or the
3019   obsolete "#define YYERROR_VERBOSE"), the expected token list in the
3020   syntax error message can both contain invalid tokens and omit valid
3021   tokens.
3023   The culprits for the above problems are %nonassoc, default
3024   reductions in inconsistent states, and parser state merging.  Thus,
3025   IELR and LALR suffer the most.  Canonical LR can suffer only if
3026   %nonassoc is used or if default reductions are enabled for
3027   inconsistent states.
3029   LAC is a new mechanism within the parsing algorithm that solves
3030   these problems for canonical LR, IELR, and LALR without sacrificing
3031   %nonassoc, default reductions, or state merging.  When LAC is in
3032   use, canonical LR and IELR behave almost exactly the same for both
3033   syntactically acceptable and syntactically unacceptable input.
3034   While LALR still does not support the full language-recognition
3035   power of canonical LR and IELR, LAC at least enables LALR's syntax
3036   error handling to correctly reflect LALR's language-recognition
3037   power.
3039   Currently, LAC is only supported for deterministic parsers in C.
3040   You can enable LAC with the following directive:
3042     %define parse.lac full
3044   See the new section "LAC" in the Bison manual for additional
3045   details including a few caveats.
3047   LAC is an experimental feature.  More user feedback will help to
3048   stabilize it.
3050 ** %define improvements:
3052 *** Can now be invoked via the command line:
3054   Each of these command-line options
3056     -D NAME[=VALUE]
3057     --define=NAME[=VALUE]
3059     -F NAME[=VALUE]
3060     --force-define=NAME[=VALUE]
3062   is equivalent to this grammar file declaration
3064     %define NAME ["VALUE"]
3066   except that the manner in which Bison processes multiple definitions
3067   for the same NAME differs.  Most importantly, -F and --force-define
3068   quietly override %define, but -D and --define do not.  For further
3069   details, see the section "Bison Options" in the Bison manual.
3071 *** Variables renamed:
3073   The following %define variables
3075     api.push_pull
3076     lr.keep_unreachable_states
3078   have been renamed to
3080     api.push-pull
3081     lr.keep-unreachable-states
3083   The old names are now deprecated but will be maintained indefinitely
3084   for backward compatibility.
3086 *** Values no longer need to be quoted in the grammar file:
3088   If a %define value is an identifier, it no longer needs to be placed
3089   within quotations marks.  For example,
3091     %define api.push-pull "push"
3093   can be rewritten as
3095     %define api.push-pull push
3097 *** Unrecognized variables are now errors not warnings.
3099 *** Multiple invocations for any variable is now an error not a warning.
3101 ** Unrecognized %code qualifiers are now errors not warnings.
3103 ** Character literals not of length one:
3105   Previously, Bison quietly converted all character literals to length
3106   one.  For example, without warning, Bison interpreted the operators in
3107   the following grammar to be the same token:
3109     exp: exp '++'
3110        | exp '+' exp
3111        ;
3113   Bison now warns when a character literal is not of length one.  In
3114   some future release, Bison will start reporting an error instead.
3116 ** Destructor calls fixed for lookaheads altered in semantic actions:
3118   Previously for deterministic parsers in C, if a user semantic action
3119   altered yychar, the parser in some cases used the old yychar value to
3120   determine which destructor to call for the lookahead upon a syntax
3121   error or upon parser return.  This bug has been fixed.
3123 ** C++ parsers use YYRHSLOC:
3125   Similarly to the C parsers, the C++ parsers now define the YYRHSLOC
3126   macro and use it in the default YYLLOC_DEFAULT.  You are encouraged
3127   to use it.  If, for instance, your location structure has "first"
3128   and "last" members, instead of
3130     # define YYLLOC_DEFAULT(Current, Rhs, N)                             \
3131       do                                                                 \
3132         if (N)                                                           \
3133           {                                                              \
3134             (Current).first = (Rhs)[1].location.first;                   \
3135             (Current).last  = (Rhs)[N].location.last;                    \
3136           }                                                              \
3137         else                                                             \
3138           {                                                              \
3139             (Current).first = (Current).last = (Rhs)[0].location.last;   \
3140           }                                                              \
3141       while (false)
3143   use:
3145     # define YYLLOC_DEFAULT(Current, Rhs, N)                             \
3146       do                                                                 \
3147         if (N)                                                           \
3148           {                                                              \
3149             (Current).first = YYRHSLOC (Rhs, 1).first;                   \
3150             (Current).last  = YYRHSLOC (Rhs, N).last;                    \
3151           }                                                              \
3152         else                                                             \
3153           {                                                              \
3154             (Current).first = (Current).last = YYRHSLOC (Rhs, 0).last;   \
3155           }                                                              \
3156       while (false)
3158 ** YYLLOC_DEFAULT in C++:
3160   The default implementation of YYLLOC_DEFAULT used to be issued in
3161   the header file.  It is now output in the implementation file, after
3162   the user %code sections so that its #ifndef guard does not try to
3163   override the user's YYLLOC_DEFAULT if provided.
3165 ** YYFAIL now produces warnings and Java parsers no longer implement it:
3167   YYFAIL has existed for many years as an undocumented feature of
3168   deterministic parsers in C generated by Bison.  More recently, it was
3169   a documented feature of Bison's experimental Java parsers.  As
3170   promised in Bison 2.4.2's NEWS entry, any appearance of YYFAIL in a
3171   semantic action now produces a deprecation warning, and Java parsers
3172   no longer implement YYFAIL at all.  For further details, including a
3173   discussion of how to suppress C preprocessor warnings about YYFAIL
3174   being unused, see the Bison 2.4.2 NEWS entry.
3176 ** Temporary hack for adding a semicolon to the user action:
3178   Previously, Bison appended a semicolon to every user action for
3179   reductions when the output language defaulted to C (specifically, when
3180   neither %yacc, %language, %skeleton, or equivalent command-line
3181   options were specified).  This allowed actions such as
3183     exp: exp "+" exp { $$ = $1 + $3 };
3185   instead of
3187     exp: exp "+" exp { $$ = $1 + $3; };
3189   As a first step in removing this misfeature, Bison now issues a
3190   warning when it appends a semicolon.  Moreover, in cases where Bison
3191   cannot easily determine whether a semicolon is needed (for example, an
3192   action ending with a cpp directive or a braced compound initializer),
3193   it no longer appends one.  Thus, the C compiler might now complain
3194   about a missing semicolon where it did not before.  Future releases of
3195   Bison will cease to append semicolons entirely.
3197 ** Verbose syntax error message fixes:
3199   When %error-verbose or the obsolete "#define YYERROR_VERBOSE" is
3200   specified, syntax error messages produced by the generated parser
3201   include the unexpected token as well as a list of expected tokens.
3202   The effect of %nonassoc on these verbose messages has been corrected
3203   in two ways, but a more complete fix requires LAC, described above:
3205 *** When %nonassoc is used, there can exist parser states that accept no
3206     tokens, and so the parser does not always require a lookahead token
3207     in order to detect a syntax error.  Because no unexpected token or
3208     expected tokens can then be reported, the verbose syntax error
3209     message described above is suppressed, and the parser instead
3210     reports the simpler message, "syntax error".  Previously, this
3211     suppression was sometimes erroneously triggered by %nonassoc when a
3212     lookahead was actually required.  Now verbose messages are
3213     suppressed only when all previous lookaheads have already been
3214     shifted or discarded.
3216 *** Previously, the list of expected tokens erroneously included tokens
3217     that would actually induce a syntax error because conflicts for them
3218     were resolved with %nonassoc in the current parser state.  Such
3219     tokens are now properly omitted from the list.
3221 *** Expected token lists are still often wrong due to state merging
3222     (from LALR or IELR) and default reductions, which can both add
3223     invalid tokens and subtract valid tokens.  Canonical LR almost
3224     completely fixes this problem by eliminating state merging and
3225     default reductions.  However, there is one minor problem left even
3226     when using canonical LR and even after the fixes above.  That is,
3227     if the resolution of a conflict with %nonassoc appears in a later
3228     parser state than the one at which some syntax error is
3229     discovered, the conflicted token is still erroneously included in
3230     the expected token list.  Bison's new LAC implementation,
3231     described above, eliminates this problem and the need for
3232     canonical LR.  However, LAC is still experimental and is disabled
3233     by default.
3235 ** Java skeleton fixes:
3237 *** A location handling bug has been fixed.
3239 *** The top element of each of the value stack and location stack is now
3240     cleared when popped so that it can be garbage collected.
3242 *** Parser traces now print the top element of the stack.
3244 ** -W/--warnings fixes:
3246 *** Bison now properly recognizes the "no-" versions of categories:
3248   For example, given the following command line, Bison now enables all
3249   warnings except warnings for incompatibilities with POSIX Yacc:
3251     bison -Wall,no-yacc gram.y
3253 *** Bison now treats S/R and R/R conflicts like other warnings:
3255   Previously, conflict reports were independent of Bison's normal
3256   warning system.  Now, Bison recognizes the warning categories
3257   "conflicts-sr" and "conflicts-rr".  This change has important
3258   consequences for the -W and --warnings command-line options.  For
3259   example:
3261     bison -Wno-conflicts-sr gram.y  # S/R conflicts not reported
3262     bison -Wno-conflicts-rr gram.y  # R/R conflicts not reported
3263     bison -Wnone            gram.y  # no conflicts are reported
3264     bison -Werror           gram.y  # any conflict is an error
3266   However, as before, if the %expect or %expect-rr directive is
3267   specified, an unexpected number of conflicts is an error, and an
3268   expected number of conflicts is not reported, so -W and --warning
3269   then have no effect on the conflict report.
3271 *** The "none" category no longer disables a preceding "error":
3273   For example, for the following command line, Bison now reports
3274   errors instead of warnings for incompatibilities with POSIX Yacc:
3276     bison -Werror,none,yacc gram.y
3278 *** The "none" category now disables all Bison warnings:
3280   Previously, the "none" category disabled only Bison warnings for
3281   which there existed a specific -W/--warning category.  However,
3282   given the following command line, Bison is now guaranteed to
3283   suppress all warnings:
3285     bison -Wnone gram.y
3287 ** Precedence directives can now assign token number 0:
3289   Since Bison 2.3b, which restored the ability of precedence
3290   directives to assign token numbers, doing so for token number 0 has
3291   produced an assertion failure.  For example:
3293     %left END 0
3295   This bug has been fixed.
3298 * Noteworthy changes in release 2.4.3 (2010-08-05)
3300 ** Bison now obeys -Werror and --warnings=error for warnings about
3301    grammar rules that are useless in the parser due to conflicts.
3303 ** Problems with spawning M4 on at least FreeBSD 8 and FreeBSD 9 have
3304    been fixed.
3306 ** Failures in the test suite for GCC 4.5 have been fixed.
3308 ** Failures in the test suite for some versions of Sun Studio C++ have
3309    been fixed.
3311 ** Contrary to Bison 2.4.2's NEWS entry, it has been decided that
3312    warnings about undefined %prec identifiers will not be converted to
3313    errors in Bison 2.5.  They will remain warnings, which should be
3314    sufficient for POSIX while avoiding backward compatibility issues.
3316 ** Minor documentation fixes.
3319 * Noteworthy changes in release 2.4.2 (2010-03-20)
3321 ** Some portability problems that resulted in failures and livelocks
3322    in the test suite on some versions of at least Solaris, AIX, HP-UX,
3323    RHEL4, and Tru64 have been addressed.  As a result, fatal Bison
3324    errors should no longer cause M4 to report a broken pipe on the
3325    affected platforms.
3327 ** "%prec IDENTIFIER" requires IDENTIFIER to be defined separately.
3329   POSIX specifies that an error be reported for any identifier that does
3330   not appear on the LHS of a grammar rule and that is not defined by
3331   %token, %left, %right, or %nonassoc.  Bison 2.3b and later lost this
3332   error report for the case when an identifier appears only after a
3333   %prec directive.  It is now restored.  However, for backward
3334   compatibility with recent Bison releases, it is only a warning for
3335   now.  In Bison 2.5 and later, it will return to being an error.
3336   [Between the 2.4.2 and 2.4.3 releases, it was decided that this
3337   warning will not be converted to an error in Bison 2.5.]
3339 ** Detection of GNU M4 1.4.6 or newer during configure is improved.
3341 ** Warnings from gcc's -Wundef option about undefined YYENABLE_NLS,
3342    YYLTYPE_IS_TRIVIAL, and __STRICT_ANSI__ in C/C++ parsers are now
3343    avoided.
3345 ** %code is now a permanent feature.
3347   A traditional Yacc prologue directive is written in the form:
3349     %{CODE%}
3351   To provide a more flexible alternative, Bison 2.3b introduced the
3352   %code directive with the following forms for C/C++:
3354     %code          {CODE}
3355     %code requires {CODE}
3356     %code provides {CODE}
3357     %code top      {CODE}
3359   These forms are now considered permanent features of Bison.  See the
3360   %code entries in the section "Bison Declaration Summary" in the Bison
3361   manual for a summary of their functionality.  See the section
3362   "Prologue Alternatives" for a detailed discussion including the
3363   advantages of %code over the traditional Yacc prologue directive.
3365   Bison's Java feature as a whole including its current usage of %code
3366   is still considered experimental.
3368 ** YYFAIL is deprecated and will eventually be removed.
3370   YYFAIL has existed for many years as an undocumented feature of
3371   deterministic parsers in C generated by Bison.  Previously, it was
3372   documented for Bison's experimental Java parsers.  YYFAIL is no longer
3373   documented for Java parsers and is formally deprecated in both cases.
3374   Users are strongly encouraged to migrate to YYERROR, which is
3375   specified by POSIX.
3377   Like YYERROR, you can invoke YYFAIL from a semantic action in order to
3378   induce a syntax error.  The most obvious difference from YYERROR is
3379   that YYFAIL will automatically invoke yyerror to report the syntax
3380   error so that you don't have to.  However, there are several other
3381   subtle differences between YYERROR and YYFAIL, and YYFAIL suffers from
3382   inherent flaws when %error-verbose or "#define YYERROR_VERBOSE" is
3383   used.  For a more detailed discussion, see:
3385     http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html
3387   The upcoming Bison 2.5 will remove YYFAIL from Java parsers, but
3388   deterministic parsers in C will continue to implement it.  However,
3389   because YYFAIL is already flawed, it seems futile to try to make new
3390   Bison features compatible with it.  Thus, during parser generation,
3391   Bison 2.5 will produce a warning whenever it discovers YYFAIL in a
3392   rule action.  In a later release, YYFAIL will be disabled for
3393   %error-verbose and "#define YYERROR_VERBOSE".  Eventually, YYFAIL will
3394   be removed altogether.
3396   There exists at least one case where Bison 2.5's YYFAIL warning will
3397   be a false positive.  Some projects add phony uses of YYFAIL and other
3398   Bison-defined macros for the sole purpose of suppressing C
3399   preprocessor warnings (from GCC cpp's -Wunused-macros, for example).
3400   To avoid Bison's future warning, such YYFAIL uses can be moved to the
3401   epilogue (that is, after the second "%%") in the Bison input file.  In
3402   this release (2.4.2), Bison already generates its own code to suppress
3403   C preprocessor warnings for YYFAIL, so projects can remove their own
3404   phony uses of YYFAIL if compatibility with Bison releases prior to
3405   2.4.2 is not necessary.
3407 ** Internationalization.
3409   Fix a regression introduced in Bison 2.4: Under some circumstances,
3410   message translations were not installed although supported by the
3411   host system.
3414 * Noteworthy changes in release 2.4.1 (2008-12-11)
3416 ** In the GLR defines file, unexpanded M4 macros in the yylval and yylloc
3417    declarations have been fixed.
3419 ** Temporary hack for adding a semicolon to the user action.
3421   Bison used to prepend a trailing semicolon at the end of the user
3422   action for reductions.  This allowed actions such as
3424     exp: exp "+" exp { $$ = $1 + $3 };
3426   instead of
3428     exp: exp "+" exp { $$ = $1 + $3; };
3430   Some grammars still depend on this "feature".  Bison 2.4.1 restores
3431   the previous behavior in the case of C output (specifically, when
3432   neither %language or %skeleton or equivalent command-line options
3433   are used) to leave more time for grammars depending on the old
3434   behavior to be adjusted.  Future releases of Bison will disable this
3435   feature.
3437 ** A few minor improvements to the Bison manual.
3440 * Noteworthy changes in release 2.4 (2008-11-02)
3442 ** %language is an experimental feature.
3444   We first introduced this feature in test release 2.3b as a cleaner
3445   alternative to %skeleton.  Since then, we have discussed the possibility of
3446   modifying its effect on Bison's output file names.  Thus, in this release,
3447   we consider %language to be an experimental feature that will likely evolve
3448   in future releases.
3450 ** Forward compatibility with GNU M4 has been improved.
3452 ** Several bugs in the C++ skeleton and the experimental Java skeleton have been
3453   fixed.
3456 * Noteworthy changes in release 2.3b (2008-05-27)
3458 ** The quotes around NAME that used to be required in the following directive
3459   are now deprecated:
3461     %define NAME "VALUE"
3463 ** The directive "%pure-parser" is now deprecated in favor of:
3465     %define api.pure
3467   which has the same effect except that Bison is more careful to warn about
3468   unreasonable usage in the latter case.
3470 ** Push Parsing
3472   Bison can now generate an LALR(1) parser in C with a push interface.  That
3473   is, instead of invoking "yyparse", which pulls tokens from "yylex", you can
3474   push one token at a time to the parser using "yypush_parse", which will
3475   return to the caller after processing each token.  By default, the push
3476   interface is disabled.  Either of the following directives will enable it:
3478     %define api.push_pull "push" // Just push; does not require yylex.
3479     %define api.push_pull "both" // Push and pull; requires yylex.
3481   See the new section "A Push Parser" in the Bison manual for details.
3483   The current push parsing interface is experimental and may evolve.  More user
3484   feedback will help to stabilize it.
3486 ** The -g and --graph options now output graphs in Graphviz DOT format,
3487   not VCG format.  Like --graph, -g now also takes an optional FILE argument
3488   and thus cannot be bundled with other short options.
3490 ** Java
3492   Bison can now generate an LALR(1) parser in Java.  The skeleton is
3493   "data/lalr1.java".  Consider using the new %language directive instead of
3494   %skeleton to select it.
3496   See the new section "Java Parsers" in the Bison manual for details.
3498   The current Java interface is experimental and may evolve.  More user
3499   feedback will help to stabilize it.
3500   Contributed by Paolo Bonzini.
3502 ** %language
3504   This new directive specifies the programming language of the generated
3505   parser, which can be C (the default), C++, or Java.  Besides the skeleton
3506   that Bison uses, the directive affects the names of the generated files if
3507   the grammar file's name ends in ".y".
3509 ** XML Automaton Report
3511   Bison can now generate an XML report of the LALR(1) automaton using the new
3512   "--xml" option.  The current XML schema is experimental and may evolve.  More
3513   user feedback will help to stabilize it.
3514   Contributed by Wojciech Polak.
3516 ** The grammar file may now specify the name of the parser header file using
3517   %defines.  For example:
3519     %defines "parser.h"
3521 ** When reporting useless rules, useless nonterminals, and unused terminals,
3522   Bison now employs the terms "useless in grammar" instead of "useless",
3523   "useless in parser" instead of "never reduced", and "unused in grammar"
3524   instead of "unused".
3526 ** Unreachable State Removal
3528   Previously, Bison sometimes generated parser tables containing unreachable
3529   states.  A state can become unreachable during conflict resolution if Bison
3530   disables a shift action leading to it from a predecessor state.  Bison now:
3532     1. Removes unreachable states.
3534     2. Does not report any conflicts that appeared in unreachable states.
3535        WARNING: As a result, you may need to update %expect and %expect-rr
3536        directives in existing grammar files.
3538     3. For any rule used only in such states, Bison now reports the rule as
3539        "useless in parser due to conflicts".
3541   This feature can be disabled with the following directive:
3543     %define lr.keep_unreachable_states
3545   See the %define entry in the "Bison Declaration Summary" in the Bison manual
3546   for further discussion.
3548 ** Lookahead Set Correction in the ".output" Report
3550   When instructed to generate a ".output" file including lookahead sets
3551   (using "--report=lookahead", for example), Bison now prints each reduction's
3552   lookahead set only next to the associated state's one item that (1) is
3553   associated with the same rule as the reduction and (2) has its dot at the end
3554   of its RHS.  Previously, Bison also erroneously printed the lookahead set
3555   next to all of the state's other items associated with the same rule.  This
3556   bug affected only the ".output" file and not the generated parser source
3557   code.
3559 ** --report-file=FILE is a new option to override the default ".output" file
3560   name.
3562 ** The "=" that used to be required in the following directives is now
3563   deprecated:
3565     %file-prefix "parser"
3566     %name-prefix "c_"
3567     %output "parser.c"
3569 ** An Alternative to "%{...%}" -- "%code QUALIFIER {CODE}"
3571   Bison 2.3a provided a new set of directives as a more flexible alternative to
3572   the traditional Yacc prologue blocks.  Those have now been consolidated into
3573   a single %code directive with an optional qualifier field, which identifies
3574   the purpose of the code and thus the location(s) where Bison should generate
3575   it:
3577     1. "%code          {CODE}" replaces "%after-header  {CODE}"
3578     2. "%code requires {CODE}" replaces "%start-header  {CODE}"
3579     3. "%code provides {CODE}" replaces "%end-header    {CODE}"
3580     4. "%code top      {CODE}" replaces "%before-header {CODE}"
3582   See the %code entries in section "Bison Declaration Summary" in the Bison
3583   manual for a summary of the new functionality.  See the new section "Prologue
3584   Alternatives" for a detailed discussion including the advantages of %code
3585   over the traditional Yacc prologues.
3587   The prologue alternatives are experimental.  More user feedback will help to
3588   determine whether they should become permanent features.
3590 ** Revised warning: unset or unused midrule values
3592   Since Bison 2.2, Bison has warned about midrule values that are set but not
3593   used within any of the actions of the parent rule.  For example, Bison warns
3594   about unused $2 in:
3596     exp: '1' { $$ = 1; } '+' exp { $$ = $1 + $4; };
3598   Now, Bison also warns about midrule values that are used but not set.  For
3599   example, Bison warns about unset $$ in the midrule action in:
3601     exp: '1' { $1 = 1; } '+' exp { $$ = $2 + $4; };
3603   However, Bison now disables both of these warnings by default since they
3604   sometimes prove to be false alarms in existing grammars employing the Yacc
3605   constructs $0 or $-N (where N is some positive integer).
3607   To enable these warnings, specify the option "--warnings=midrule-values" or
3608   "-W", which is a synonym for "--warnings=all".
3610 ** Default %destructor or %printer with "<*>" or "<>"
3612   Bison now recognizes two separate kinds of default %destructor's and
3613   %printer's:
3615     1. Place "<*>" in a %destructor/%printer symbol list to define a default
3616        %destructor/%printer for all grammar symbols for which you have formally
3617        declared semantic type tags.
3619     2. Place "<>" in a %destructor/%printer symbol list to define a default
3620        %destructor/%printer for all grammar symbols without declared semantic
3621        type tags.
3623   Bison no longer supports the "%symbol-default" notation from Bison 2.3a.
3624   "<*>" and "<>" combined achieve the same effect with one exception: Bison no
3625   longer applies any %destructor to a midrule value if that midrule value is
3626   not actually ever referenced using either $$ or $n in a semantic action.
3628   The default %destructor's and %printer's are experimental.  More user
3629   feedback will help to determine whether they should become permanent
3630   features.
3632   See the section "Freeing Discarded Symbols" in the Bison manual for further
3633   details.
3635 ** %left, %right, and %nonassoc can now declare token numbers.  This is required
3636   by POSIX.  However, see the end of section "Operator Precedence" in the Bison
3637   manual for a caveat concerning the treatment of literal strings.
3639 ** The nonfunctional --no-parser, -n, and %no-parser options have been
3640   completely removed from Bison.
3643 * Noteworthy changes in release 2.3a (2006-09-13)
3645 ** Instead of %union, you can define and use your own union type
3646   YYSTYPE if your grammar contains at least one <type> tag.
3647   Your YYSTYPE need not be a macro; it can be a typedef.
3648   This change is for compatibility with other Yacc implementations,
3649   and is required by POSIX.
3651 ** Locations columns and lines start at 1.
3652   In accordance with the GNU Coding Standards and Emacs.
3654 ** You may now declare per-type and default %destructor's and %printer's:
3656   For example:
3658     %union { char *string; }
3659     %token <string> STRING1
3660     %token <string> STRING2
3661     %type  <string> string1
3662     %type  <string> string2
3663     %union { char character; }
3664     %token <character> CHR
3665     %type  <character> chr
3666     %destructor { free ($$); } %symbol-default
3667     %destructor { free ($$); printf ("%d", @$.first_line); } STRING1 string1
3668     %destructor { } <character>
3670   guarantees that, when the parser discards any user-defined symbol that has a
3671   semantic type tag other than "<character>", it passes its semantic value to
3672   "free".  However, when the parser discards a "STRING1" or a "string1", it
3673   also prints its line number to "stdout".  It performs only the second
3674   "%destructor" in this case, so it invokes "free" only once.
3676   [Although we failed to mention this here in the 2.3a release, the default
3677   %destructor's and %printer's were experimental, and they were rewritten in
3678   future versions.]
3680 ** Except for LALR(1) parsers in C with POSIX Yacc emulation enabled (with "-y",
3681   "--yacc", or "%yacc"), Bison no longer generates #define statements for
3682   associating token numbers with token names.  Removing the #define statements
3683   helps to sanitize the global namespace during preprocessing, but POSIX Yacc
3684   requires them.  Bison still generates an enum for token names in all cases.
3686 ** Handling of traditional Yacc prologue blocks is now more consistent but
3687   potentially incompatible with previous releases of Bison.
3689   As before, you declare prologue blocks in your grammar file with the
3690   "%{ ... %}" syntax.  To generate the pre-prologue, Bison concatenates all
3691   prologue blocks that you've declared before the first %union.  To generate
3692   the post-prologue, Bison concatenates all prologue blocks that you've
3693   declared after the first %union.
3695   Previous releases of Bison inserted the pre-prologue into both the header
3696   file and the code file in all cases except for LALR(1) parsers in C.  In the
3697   latter case, Bison inserted it only into the code file.  For parsers in C++,
3698   the point of insertion was before any token definitions (which associate
3699   token numbers with names).  For parsers in C, the point of insertion was
3700   after the token definitions.
3702   Now, Bison never inserts the pre-prologue into the header file.  In the code
3703   file, it always inserts it before the token definitions.
3705 ** Bison now provides a more flexible alternative to the traditional Yacc
3706   prologue blocks: %before-header, %start-header, %end-header, and
3707   %after-header.
3709   For example, the following declaration order in the grammar file reflects the
3710   order in which Bison will output these code blocks.  However, you are free to
3711   declare these code blocks in your grammar file in whatever order is most
3712   convenient for you:
3714     %before-header {
3715       /* Bison treats this block like a pre-prologue block: it inserts it into
3716        * the code file before the contents of the header file.  It does *not*
3717        * insert it into the header file.  This is a good place to put
3718        * #include's that you want at the top of your code file.  A common
3719        * example is '#include "system.h"'.  */
3720     }
3721     %start-header {
3722       /* Bison inserts this block into both the header file and the code file.
3723        * In both files, the point of insertion is before any Bison-generated
3724        * token, semantic type, location type, and class definitions.  This is a
3725        * good place to define %union dependencies, for example.  */
3726     }
3727     %union {
3728       /* Unlike the traditional Yacc prologue blocks, the output order for the
3729        * new %*-header blocks is not affected by their declaration position
3730        * relative to any %union in the grammar file.  */
3731     }
3732     %end-header {
3733       /* Bison inserts this block into both the header file and the code file.
3734        * In both files, the point of insertion is after the Bison-generated
3735        * definitions.  This is a good place to declare or define public
3736        * functions or data structures that depend on the Bison-generated
3737        * definitions.  */
3738     }
3739     %after-header {
3740       /* Bison treats this block like a post-prologue block: it inserts it into
3741        * the code file after the contents of the header file.  It does *not*
3742        * insert it into the header file.  This is a good place to declare or
3743        * define internal functions or data structures that depend on the
3744        * Bison-generated definitions.  */
3745     }
3747   If you have multiple occurrences of any one of the above declarations, Bison
3748   will concatenate the contents in declaration order.
3750   [Although we failed to mention this here in the 2.3a release, the prologue
3751   alternatives were experimental, and they were rewritten in future versions.]
3753 ** The option "--report=look-ahead" has been changed to "--report=lookahead".
3754   The old spelling still works, but is not documented and may be removed
3755   in a future release.
3758 * Noteworthy changes in release 2.3 (2006-06-05)
3760 ** GLR grammars should now use "YYRECOVERING ()" instead of "YYRECOVERING",
3761   for compatibility with LALR(1) grammars.
3763 ** It is now documented that any definition of YYSTYPE or YYLTYPE should
3764   be to a type name that does not contain parentheses or brackets.
3767 * Noteworthy changes in release 2.2 (2006-05-19)
3769 ** The distribution terms for all Bison-generated parsers now permit
3770   using the parsers in nonfree programs.  Previously, this permission
3771   was granted only for Bison-generated LALR(1) parsers in C.
3773 ** %name-prefix changes the namespace name in C++ outputs.
3775 ** The C++ parsers export their token_type.
3777 ** Bison now allows multiple %union declarations, and concatenates
3778   their contents together.
3780 ** New warning: unused values
3781   Right-hand side symbols whose values are not used are reported,
3782   if the symbols have destructors.  For instance:
3784      exp: exp "?" exp ":" exp { $1 ? $1 : $3; }
3785         | exp "+" exp
3786         ;
3788   will trigger a warning about $$ and $5 in the first rule, and $3 in
3789   the second ($1 is copied to $$ by the default rule).  This example
3790   most likely contains three errors, and could be rewritten as:
3792      exp: exp "?" exp ":" exp
3793             { $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); }
3794         | exp "+" exp
3795             { $$ = $1 ? $1 : $3; if ($1) free ($3); }
3796         ;
3798   However, if the original actions were really intended, memory leaks
3799   and all, the warnings can be suppressed by letting Bison believe the
3800   values are used, e.g.:
3802      exp: exp "?" exp ":" exp { $1 ? $1 : $3; (void) ($$, $5); }
3803         | exp "+" exp         { $$ = $1; (void) $3; }
3804         ;
3806   If there are midrule actions, the warning is issued if no action
3807   uses it.  The following triggers no warning: $1 and $3 are used.
3809      exp: exp { push ($1); } '+' exp { push ($3); sum (); };
3811   The warning is intended to help catching lost values and memory leaks.
3812   If a value is ignored, its associated memory typically is not reclaimed.
3814 ** %destructor vs. YYABORT, YYACCEPT, and YYERROR.
3815   Destructors are now called when user code invokes YYABORT, YYACCEPT,
3816   and YYERROR, for all objects on the stack, other than objects
3817   corresponding to the right-hand side of the current rule.
3819 ** %expect, %expect-rr
3820   Incorrect numbers of expected conflicts are now actual errors,
3821   instead of warnings.
3823 ** GLR, YACC parsers.
3824   The %parse-params are available in the destructors (and the
3825   experimental printers) as per the documentation.
3827 ** Bison now warns if it finds a stray "$" or "@" in an action.
3829 ** %require "VERSION"
3830   This specifies that the grammar file depends on features implemented
3831   in Bison version VERSION or higher.
3833 ** lalr1.cc: The token and value types are now class members.
3834   The tokens were defined as free form enums and cpp macros.  YYSTYPE
3835   was defined as a free form union.  They are now class members:
3836   tokens are enumerations of the "yy::parser::token" struct, and the
3837   semantic values have the "yy::parser::semantic_type" type.
3839   If you do not want or can update to this scheme, the directive
3840   '%define "global_tokens_and_yystype" "1"' triggers the global
3841   definition of tokens and YYSTYPE.  This change is suitable both
3842   for previous releases of Bison, and this one.
3844   If you wish to update, then make sure older version of Bison will
3845   fail using '%require "2.2"'.
3847 ** DJGPP support added.
3850 * Noteworthy changes in release 2.1 (2005-09-16)
3852 ** The C++ lalr1.cc skeleton supports %lex-param.
3854 ** Bison-generated parsers now support the translation of diagnostics like
3855   "syntax error" into languages other than English.  The default
3856   language is still English.  For details, please see the new
3857   Internationalization section of the Bison manual.  Software
3858   distributors should also see the new PACKAGING file.  Thanks to
3859   Bruno Haible for this new feature.
3861 ** Wording in the Bison-generated parsers has been changed slightly to
3862   simplify translation.  In particular, the message "memory exhausted"
3863   has replaced "parser stack overflow", as the old message was not
3864   always accurate for modern Bison-generated parsers.
3866 ** Destructors are now called when the parser aborts, for all symbols left
3867   behind on the stack.  Also, the start symbol is now destroyed after a
3868   successful parse.  In both cases, the behavior was formerly inconsistent.
3870 ** When generating verbose diagnostics, Bison-generated parsers no longer
3871   quote the literal strings associated with tokens.  For example, for
3872   a syntax error associated with '%token NUM "number"' they might
3873   print 'syntax error, unexpected number' instead of 'syntax error,
3874   unexpected "number"'.
3877 * Noteworthy changes in release 2.0 (2004-12-25)
3879 ** Possibly-incompatible changes
3881   - Bison-generated parsers no longer default to using the alloca function
3882     (when available) to extend the parser stack, due to widespread
3883     problems in unchecked stack-overflow detection.  You can "#define
3884     YYSTACK_USE_ALLOCA 1" to require the use of alloca, but please read
3885     the manual to determine safe values for YYMAXDEPTH in that case.
3887   - Error token location.
3888     During error recovery, the location of the syntax error is updated
3889     to cover the whole sequence covered by the error token: it includes
3890     the shifted symbols thrown away during the first part of the error
3891     recovery, and the lookahead rejected during the second part.
3893   - Semicolon changes:
3894     . Stray semicolons are no longer allowed at the start of a grammar.
3895     . Semicolons are now required after in-grammar declarations.
3897   - Unescaped newlines are no longer allowed in character constants or
3898     string literals.  They were never portable, and GCC 3.4.0 has
3899     dropped support for them.  Better diagnostics are now generated if
3900     forget a closing quote.
3902   - NUL bytes are no longer allowed in Bison string literals, unfortunately.
3904 ** New features
3906   - GLR grammars now support locations.
3908   - New directive: %initial-action.
3909     This directive allows the user to run arbitrary code (including
3910     initializing @$) from yyparse before parsing starts.
3912   - A new directive "%expect-rr N" specifies the expected number of
3913     reduce/reduce conflicts in GLR parsers.
3915   - %token numbers can now be hexadecimal integers, e.g., "%token FOO 0x12d".
3916     This is a GNU extension.
3918   - The option "--report=lookahead" was changed to "--report=look-ahead".
3919     [However, this was changed back after 2.3.]
3921   - Experimental %destructor support has been added to lalr1.cc.
3923   - New configure option --disable-yacc, to disable installation of the
3924     yacc command and -ly library introduced in 1.875 for POSIX conformance.
3926 ** Bug fixes
3928   - For now, %expect-count violations are now just warnings, not errors.
3929     This is for compatibility with Bison 1.75 and earlier (when there are
3930     reduce/reduce conflicts) and with Bison 1.30 and earlier (when there
3931     are too many or too few shift/reduce conflicts).  However, in future
3932     versions of Bison we plan to improve the %expect machinery so that
3933     these violations will become errors again.
3935   - Within Bison itself, numbers (e.g., goto numbers) are no longer
3936     arbitrarily limited to 16-bit counts.
3938   - Semicolons are now allowed before "|" in grammar rules, as POSIX requires.
3941 * Noteworthy changes in release 1.875 (2003-01-01)
3943 ** The documentation license has been upgraded to version 1.2
3944   of the GNU Free Documentation License.
3946 ** syntax error processing
3948   - In Yacc-style parsers YYLLOC_DEFAULT is now used to compute error
3949     locations too.  This fixes bugs in error-location computation.
3951   - %destructor
3952     It is now possible to reclaim the memory associated to symbols
3953     discarded during error recovery.  This feature is still experimental.
3955   - %error-verbose
3956     This new directive is preferred over YYERROR_VERBOSE.
3958   - #defining yyerror to steal internal variables is discouraged.
3959     It is not guaranteed to work forever.
3961 ** POSIX conformance
3963   - Semicolons are once again optional at the end of grammar rules.
3964     This reverts to the behavior of Bison 1.33 and earlier, and improves
3965     compatibility with Yacc.
3967   - "parse error" -> "syntax error"
3968     Bison now uniformly uses the term "syntax error"; formerly, the code
3969     and manual sometimes used the term "parse error" instead.  POSIX
3970     requires "syntax error" in diagnostics, and it was thought better to
3971     be consistent.
3973   - The documentation now emphasizes that yylex and yyerror must be
3974     declared before use.  C99 requires this.
3976   - Bison now parses C99 lexical constructs like UCNs and
3977     backslash-newline within C escape sequences, as POSIX 1003.1-2001 requires.
3979   - File names are properly escaped in C output.  E.g., foo\bar.y is
3980     output as "foo\\bar.y".
3982   - Yacc command and library now available
3983     The Bison distribution now installs a "yacc" command, as POSIX requires.
3984     Also, Bison now installs a small library liby.a containing
3985     implementations of Yacc-compatible yyerror and main functions.
3986     This library is normally not useful, but POSIX requires it.
3988   - Type clashes now generate warnings, not errors.
3990   - If the user does not define YYSTYPE as a macro, Bison now declares it
3991     using typedef instead of defining it as a macro.
3992     For consistency, YYLTYPE is also declared instead of defined.
3994 ** Other compatibility issues
3996   - %union directives can now have a tag before the "{", e.g., the
3997     directive "%union foo {...}" now generates the C code
3998     "typedef union foo { ... } YYSTYPE;"; this is for Yacc compatibility.
3999     The default union tag is "YYSTYPE", for compatibility with Solaris 9 Yacc.
4000     For consistency, YYLTYPE's struct tag is now "YYLTYPE" not "yyltype".
4001     This is for compatibility with both Yacc and Bison 1.35.
4003   - ";" is output before the terminating "}" of an action, for
4004     compatibility with Bison 1.35.
4006   - Bison now uses a Yacc-style format for conflict reports, e.g.,
4007     "conflicts: 2 shift/reduce, 1 reduce/reduce".
4009   - "yystype" and "yyltype" are now obsolescent macros instead of being
4010     typedefs or tags; they are no longer documented and are planned to be
4011     withdrawn in a future release.
4013 ** GLR parser notes
4015   - GLR and inline
4016     Users of Bison have to decide how they handle the portability of the
4017     C keyword "inline".
4019   - "parsing stack overflow..." -> "parser stack overflow"
4020     GLR parsers now report "parser stack overflow" as per the Bison manual.
4022 ** %parse-param and %lex-param
4023   The macros YYPARSE_PARAM and YYLEX_PARAM provide a means to pass
4024   additional context to yyparse and yylex.  They suffer from several
4025   shortcomings:
4027   - a single argument only can be added,
4028   - their types are weak (void *),
4029   - this context is not passed to ancillary functions such as yyerror,
4030   - only yacc.c parsers support them.
4032   The new %parse-param/%lex-param directives provide a more precise control.
4033   For instance:
4035     %parse-param {int *nastiness}
4036     %lex-param   {int *nastiness}
4037     %parse-param {int *randomness}
4039   results in the following signatures:
4041     int yylex   (int *nastiness);
4042     int yyparse (int *nastiness, int *randomness);
4044   or, if both %pure-parser and %locations are used:
4046     int yylex   (YYSTYPE *lvalp, YYLTYPE *llocp, int *nastiness);
4047     int yyparse (int *nastiness, int *randomness);
4049 ** Bison now warns if it detects conflicting outputs to the same file,
4050   e.g., it generates a warning for "bison -d -o foo.h foo.y" since
4051   that command outputs both code and header to foo.h.
4053 ** #line in output files
4054   - --no-line works properly.
4056 ** Bison can no longer be built by a K&R C compiler; it requires C89 or
4057   later to be built.  This change originally took place a few versions
4058   ago, but nobody noticed until we recently asked someone to try
4059   building Bison with a K&R C compiler.
4062 * Noteworthy changes in release 1.75 (2002-10-14)
4064 ** Bison should now work on 64-bit hosts.
4066 ** Indonesian translation thanks to Tedi Heriyanto.
4068 ** GLR parsers
4069   Fix spurious parse errors.
4071 ** Pure parsers
4072   Some people redefine yyerror to steal yyparse' private variables.
4073   Reenable this trick until an official feature replaces it.
4075 ** Type Clashes
4076   In agreement with POSIX and with other Yaccs, leaving a default
4077   action is valid when $$ is untyped, and $1 typed:
4079         untyped: ... typed;
4081   but the converse remains an error:
4083         typed: ... untyped;
4085 ** Values of midrule actions
4086   The following code:
4088         foo: { ... } { $$ = $1; } ...
4090   was incorrectly rejected: $1 is defined in the second midrule
4091   action, and is equal to the $$ of the first midrule action.
4094 * Noteworthy changes in release 1.50 (2002-10-04)
4096 ** GLR parsing
4097   The declaration
4098      %glr-parser
4099   causes Bison to produce a Generalized LR (GLR) parser, capable of handling
4100   almost any context-free grammar, ambiguous or not.  The new declarations
4101   %dprec and %merge on grammar rules allow parse-time resolution of
4102   ambiguities.  Contributed by Paul Hilfinger.
4104   Unfortunately Bison 1.50 does not work properly on 64-bit hosts
4105   like the Alpha, so please stick to 32-bit hosts for now.
4107 ** Output Directory
4108   When not in Yacc compatibility mode, when the output file was not
4109   specified, running "bison foo/bar.y" created "foo/bar.c".  It
4110   now creates "bar.c".
4112 ** Undefined token
4113   The undefined token was systematically mapped to 2 which prevented
4114   the use of 2 by the user.  This is no longer the case.
4116 ** Unknown token numbers
4117   If yylex returned an out of range value, yyparse could die.  This is
4118   no longer the case.
4120 ** Error token
4121   According to POSIX, the error token must be 256.
4122   Bison extends this requirement by making it a preference: *if* the
4123   user specified that one of her tokens is numbered 256, then error
4124   will be mapped onto another number.
4126 ** Verbose error messages
4127   They no longer report "..., expecting error or..." for states where
4128   error recovery is possible.
4130 ** End token
4131   Defaults to "$end" instead of "$".
4133 ** Error recovery now conforms to documentation and to POSIX
4134   When a Bison-generated parser encounters a syntax error, it now pops
4135   the stack until it finds a state that allows shifting the error
4136   token.  Formerly, it popped the stack until it found a state that
4137   allowed some non-error action other than a default reduction on the
4138   error token.  The new behavior has long been the documented behavior,
4139   and has long been required by POSIX.  For more details, please see
4140   Paul Eggert, "Reductions during Bison error handling" (2002-05-20)
4141   <http://lists.gnu.org/archive/html/bug-bison/2002-05/msg00038.html>.
4143 ** Traces
4144   Popped tokens and nonterminals are now reported.
4146 ** Larger grammars
4147   Larger grammars are now supported (larger token numbers, larger grammar
4148   size (= sum of the LHS and RHS lengths), larger LALR tables).
4149   Formerly, many of these numbers ran afoul of 16-bit limits;
4150   now these limits are 32 bits on most hosts.
4152 ** Explicit initial rule
4153   Bison used to play hacks with the initial rule, which the user does
4154   not write.  It is now explicit, and visible in the reports and
4155   graphs as rule 0.
4157 ** Useless rules
4158   Before, Bison reported the useless rules, but, although not used,
4159   included them in the parsers.  They are now actually removed.
4161 ** Useless rules, useless nonterminals
4162   They are now reported, as a warning, with their locations.
4164 ** Rules never reduced
4165   Rules that can never be reduced because of conflicts are now
4166   reported.
4168 ** Incorrect "Token not used"
4169   On a grammar such as
4171     %token useless useful
4172     %%
4173     exp: '0' %prec useful;
4175   where a token was used to set the precedence of the last rule,
4176   bison reported both "useful" and "useless" as useless tokens.
4178 ** Revert the C++ namespace changes introduced in 1.31
4179   as they caused too many portability hassles.
4181 ** Default locations
4182   By an accident of design, the default computation of @$ was
4183   performed after another default computation was performed: @$ = @1.
4184   The latter is now removed: YYLLOC_DEFAULT is fully responsible of
4185   the computation of @$.
4187 ** Token end-of-file
4188   The token end of file may be specified by the user, in which case,
4189   the user symbol is used in the reports, the graphs, and the verbose
4190   error messages instead of "$end", which remains being the default.
4191   For instance
4192     %token MYEOF 0
4193   or
4194     %token MYEOF 0 "end of file"
4196 ** Semantic parser
4197   This old option, which has been broken for ages, is removed.
4199 ** New translations
4200   Brazilian Portuguese, thanks to Alexandre Folle de Menezes.
4201   Croatian, thanks to Denis Lackovic.
4203 ** Incorrect token definitions
4204   When given
4205     %token 'a' "A"
4206   bison used to output
4207     #define 'a' 65
4209 ** Token definitions as enums
4210   Tokens are output both as the traditional #define's, and, provided
4211   the compiler supports ANSI C or is a C++ compiler, as enums.
4212   This lets debuggers display names instead of integers.
4214 ** Reports
4215   In addition to --verbose, bison supports --report=THINGS, which
4216   produces additional information:
4217   - itemset
4218     complete the core item sets with their closure
4219   - lookahead [changed to "look-ahead" in 1.875e through 2.3, but changed back]
4220     explicitly associate lookahead tokens to items
4221   - solved
4222     describe shift/reduce conflicts solving.
4223     Bison used to systematically output this information on top of
4224     the report.  Solved conflicts are now attached to their states.
4226 ** Type clashes
4227   Previous versions don't complain when there is a type clash on
4228   the default action if the rule has a midrule action, such as in:
4230     %type <foo> bar
4231     %%
4232     bar: '0' {} '0';
4234   This is fixed.
4236 ** GNU M4 is now required when using Bison.
4239 * Noteworthy changes in release 1.35 (2002-03-25)
4241 ** C Skeleton
4242   Some projects use Bison's C parser with C++ compilers, and define
4243   YYSTYPE as a class.  The recent adjustment of C parsers for data
4244   alignment and 64 bit architectures made this impossible.
4246   Because for the time being no real solution for C++ parser
4247   generation exists, kludges were implemented in the parser to
4248   maintain this use.  In the future, when Bison has C++ parsers, this
4249   kludge will be disabled.
4251   This kludge also addresses some C++ problems when the stack was
4252   extended.
4255 * Noteworthy changes in release 1.34 (2002-03-12)
4257 ** File name clashes are detected
4258   $ bison foo.y -d -o foo.x
4259   fatal error: header and parser would both be named "foo.x"
4261 ** A missing ";" at the end of a rule triggers a warning
4262   In accordance with POSIX, and in agreement with other
4263   Yacc implementations, Bison will mandate this semicolon in the near
4264   future.  This eases the implementation of a Bison parser of Bison
4265   grammars by making this grammar LALR(1) instead of LR(2).  To
4266   facilitate the transition, this release introduces a warning.
4268 ** Revert the C++ namespace changes introduced in 1.31, as they caused too
4269   many portability hassles.
4271 ** DJGPP support added.
4273 ** Fix test suite portability problems.
4276 * Noteworthy changes in release 1.33 (2002-02-07)
4278 ** Fix C++ issues
4279   Groff could not be compiled for the definition of size_t was lacking
4280   under some conditions.
4282 ** Catch invalid @n
4283   As is done with $n.
4286 * Noteworthy changes in release 1.32 (2002-01-23)
4288 ** Fix Yacc output file names
4290 ** Portability fixes
4292 ** Italian, Dutch translations
4295 * Noteworthy changes in release 1.31 (2002-01-14)
4297 ** Many Bug Fixes
4299 ** GNU Gettext and %expect
4300   GNU Gettext asserts 10 s/r conflicts, but there are 7.  Now that
4301   Bison dies on incorrect %expectations, we fear there will be
4302   too many bug reports for Gettext, so _for the time being_, %expect
4303   does not trigger an error when the input file is named "plural.y".
4305 ** Use of alloca in parsers
4306   If YYSTACK_USE_ALLOCA is defined to 0, then the parsers will use
4307   malloc exclusively.  Since 1.29, but was not NEWS'ed.
4309   alloca is used only when compiled with GCC, to avoid portability
4310   problems as on AIX.
4312 ** yyparse now returns 2 if memory is exhausted; formerly it dumped core.
4314 ** When the generated parser lacks debugging code, YYDEBUG is now 0
4315   (as POSIX requires) instead of being undefined.
4317 ** User Actions
4318   Bison has always permitted actions such as { $$ = $1 }: it adds the
4319   ending semicolon.  Now if in Yacc compatibility mode, the semicolon
4320   is no longer output: one has to write { $$ = $1; }.
4322 ** Better C++ compliance
4323   The output parsers try to respect C++ namespaces.
4324   [This turned out to be a failed experiment, and it was reverted later.]
4326 ** Reduced Grammars
4327   Fixed bugs when reporting useless nonterminals.
4329 ** 64 bit hosts
4330   The parsers work properly on 64 bit hosts.
4332 ** Error messages
4333   Some calls to strerror resulted in scrambled or missing error messages.
4335 ** %expect
4336   When the number of shift/reduce conflicts is correct, don't issue
4337   any warning.
4339 ** The verbose report includes the rule line numbers.
4341 ** Rule line numbers are fixed in traces.
4343 ** Swedish translation
4345 ** Parse errors
4346   Verbose parse error messages from the parsers are better looking.
4347   Before: parse error: unexpected `'/'', expecting `"number"' or `'-'' or `'(''
4348      Now: parse error: unexpected '/', expecting "number" or '-' or '('
4350 ** Fixed parser memory leaks.
4351   When the generated parser was using malloc to extend its stacks, the
4352   previous allocations were not freed.
4354 ** Fixed verbose output file.
4355   Some newlines were missing.
4356   Some conflicts in state descriptions were missing.
4358 ** Fixed conflict report.
4359   Option -v was needed to get the result.
4361 ** %expect
4362   Was not used.
4363   Mismatches are errors, not warnings.
4365 ** Fixed incorrect processing of some invalid input.
4367 ** Fixed CPP guards: 9foo.h uses BISON_9FOO_H instead of 9FOO_H.
4369 ** Fixed some typos in the documentation.
4371 ** %token MY_EOF 0 is supported.
4372   Before, MY_EOF was silently renumbered as 257.
4374 ** doc/refcard.tex is updated.
4376 ** %output, %file-prefix, %name-prefix.
4377   New.
4379 ** --output
4380   New, aliasing "--output-file".
4383 * Noteworthy changes in release 1.30 (2001-10-26)
4385 ** "--defines" and "--graph" have now an optional argument which is the
4386   output file name. "-d" and "-g" do not change; they do not take any
4387   argument.
4389 ** "%source_extension" and "%header_extension" are removed, failed
4390   experiment.
4392 ** Portability fixes.
4395 * Noteworthy changes in release 1.29 (2001-09-07)
4397 ** The output file does not define const, as this caused problems when used
4398   with common autoconfiguration schemes.  If you still use ancient compilers
4399   that lack const, compile with the equivalent of the C compiler option
4400   "-Dconst=".  Autoconf's AC_C_CONST macro provides one way to do this.
4402 ** Added "-g" and "--graph".
4404 ** The Bison manual is now distributed under the terms of the GNU FDL.
4406 ** The input and the output files has automatically a similar extension.
4408 ** Russian translation added.
4410 ** NLS support updated; should hopefully be less troublesome.
4412 ** Added the old Bison reference card.
4414 ** Added "--locations" and "%locations".
4416 ** Added "-S" and "--skeleton".
4418 ** "%raw", "-r", "--raw" is disabled.
4420 ** Special characters are escaped when output.  This solves the problems
4421   of the #line lines with path names including backslashes.
4423 ** New directives.
4424   "%yacc", "%fixed_output_files", "%defines", "%no_parser", "%verbose",
4425   "%debug", "%source_extension" and "%header_extension".
4427 ** @$
4428   Automatic location tracking.
4431 * Noteworthy changes in release 1.28 (1999-07-06)
4433 ** Should compile better now with K&R compilers.
4435 ** Added NLS.
4437 ** Fixed a problem with escaping the double quote character.
4439 ** There is now a FAQ.
4442 * Noteworthy changes in release 1.27
4444 ** The make rule which prevented bison.simple from being created on
4445   some systems has been fixed.
4448 * Noteworthy changes in release 1.26
4450 ** Bison now uses Automake.
4452 ** New mailing lists: <bug-bison@gnu.org> and <help-bison@gnu.org>.
4454 ** Token numbers now start at 257 as previously documented, not 258.
4456 ** Bison honors the TMPDIR environment variable.
4458 ** A couple of buffer overruns have been fixed.
4460 ** Problems when closing files should now be reported.
4462 ** Generated parsers should now work even on operating systems which do
4463   not provide alloca().
4466 * Noteworthy changes in release 1.25 (1995-10-16)
4468 ** Errors in the input grammar are not fatal; Bison keeps reading
4469 the grammar file, and reports all the errors found in it.
4471 ** Tokens can now be specified as multiple-character strings: for
4472 example, you could use "<=" for a token which looks like <=, instead
4473 of choosing a name like LESSEQ.
4475 ** The %token_table declaration says to write a table of tokens (names
4476 and numbers) into the parser file.  The yylex function can use this
4477 table to recognize multiple-character string tokens, or for other
4478 purposes.
4480 ** The %no_lines declaration says not to generate any #line preprocessor
4481 directives in the parser file.
4483 ** The %raw declaration says to use internal Bison token numbers, not
4484 Yacc-compatible token numbers, when token names are defined as macros.
4486 ** The --no-parser option produces the parser tables without including
4487 the parser engine; a project can now use its own parser engine.
4488 The actions go into a separate file called NAME.act, in the form of
4489 a switch statement body.
4492 * Noteworthy changes in release 1.23
4494 The user can define YYPARSE_PARAM as the name of an argument to be
4495 passed into yyparse.  The argument should have type void *.  It should
4496 actually point to an object.  Grammar actions can access the variable
4497 by casting it to the proper pointer type.
4499 Line numbers in output file corrected.
4502 * Noteworthy changes in release 1.22
4504 --help option added.
4507 * Noteworthy changes in release 1.20
4509 Output file does not redefine const for C++.
4511 -----
4513 LocalWords:  yacc YYBACKUP glr GCC lalr ArrayIndexOutOfBoundsException nullptr
4514 LocalWords:  cplusplus liby rpl fprintf mfcalc Wyacc stmt cond expr mk sym lr
4515 LocalWords:  IELR ielr Lookahead YYERROR nonassoc LALR's api lookaheads yychar
4516 LocalWords:  destructor lookahead YYRHSLOC YYLLOC Rhs ifndef YYFAIL cpp sr rr
4517 LocalWords:  preprocessor initializer Wno Wnone Werror FreeBSD prec livelocks
4518 LocalWords:  Solaris AIX UX RHEL Tru LHS gcc's Wundef YYENABLE NLS YYLTYPE VCG
4519 LocalWords:  yyerror cpp's Wunused yylval yylloc prepend yyparse yylex yypush
4520 LocalWords:  Graphviz xml nonterminals midrule destructor's YYSTYPE typedef ly
4521 LocalWords:  CHR chr printf stdout namespace preprocessing enum pre include's
4522 LocalWords:  YYRECOVERING nonfree destructors YYABORT YYACCEPT params enums de
4523 LocalWords:  struct yystype DJGPP lex param Haible NUM alloca YYSTACK NUL goto
4524 LocalWords:  YYMAXDEPTH Unescaped UCNs YYLTYPE's yyltype typedefs inline Yaccs
4525 LocalWords:  Heriyanto Reenable dprec Hilfinger Eggert MYEOF Folle Menezes EOF
4526 LocalWords:  Lackovic define's itemset Groff Gettext malloc NEWS'ed YYDEBUG YY
4527 LocalWords:  namespaces strerror const autoconfiguration Dconst Autoconf's FDL
4528 LocalWords:  Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
4529 LocalWords:  extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
4530 LocalWords:  lang yyoutput dvi html ps POSIX lvalp llocp Wother nterm arg init
4531 LocalWords:  TOK calc yyo fval Wconflicts parsers yystackp yyval yynerrs
4532 LocalWords:  Théophile Ranquet Santet fno fnone stype associativity Tolmer
4533 LocalWords:  Wprecedence Rassoul Wempty Paolo Bonzini parser's Michiel loc
4534 LocalWords:  redeclaration sval fcaret reentrant XSLT xsl Wmaybe yyvsp Tedi
4535 LocalWords:  pragmas noreturn untyped Rozenman unexpanded Wojciech Polak
4536 LocalWords:  Alexandre MERCHANTABILITY yytype emplace ptr automove lvalues
4537 LocalWords:  nonterminal yy args Pragma dereference yyformat rhs docdir bw
4538 LocalWords:  Redeclarations rpcalc Autoconf YFLAGS Makefiles PROG DECL num
4539 LocalWords:  Heimbigner AST src ast Makefile srcdir MinGW xxlex XXSTYPE
4540 LocalWords:  XXLTYPE strictfp IDEs ffixit fdiagnostics parseable fixits
4541 LocalWords:  Wdeprecated yytext Variadic variadic yyrhs yyphrs RCS README
4542 LocalWords:  noexcept constexpr ispell american deprecations backend Teoh
4543 LocalWords:  YYPRINT Mangold Bonzini's Wdangling exVal baz checkable gcc
4544 LocalWords:  fsanitize Vogelsgesang lis redeclared stdint automata yytname
4545 LocalWords:  yysymbol yytnamerr yyreport ctx ARGMAX yysyntax stderr LPAREN
4546 LocalWords:  symrec yypcontext TOKENMAX yyexpected YYEMPTY yypstate YYEOF
4547 LocalWords:  autocompletion bistromathic submessages Cayuela lexcalc hoc
4548 LocalWords:  yytoken YYUNDEF YYerror basename Automake's UTF ifdef ffile
4549 LocalWords:  gotos readline Imbimbo Wcounterexamples Wcex Nonunifying rcex
4551 Local Variables:
4552 ispell-dictionary: "american"
4553 mode: outline
4554 fill-column: 76
4555 End:
4557 Copyright (C) 1995-2015, 2018-2020 Free Software Foundation, Inc.
4559 This file is part of Bison, the GNU Parser Generator.
4561 Permission is granted to copy, distribute and/or modify this document
4562 under the terms of the GNU Free Documentation License, Version 1.3 or
4563 any later version published by the Free Software Foundation; with no
4564 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
4565 Texts.  A copy of the license is included in the "GNU Free
4566 Documentation License" file as part of this distribution.