regen
[bison.git] / NEWS
blobd1a178801b59559978aadb4bd1f52bb8cd81ade1
1 GNU Bison NEWS
3 * Noteworthy changes in release ?.? (????-??-??) [?]
6 * Noteworthy changes in release 3.8.1 (2021-09-11) [stable]
8   The generation of prototypes for yylex and yyerror in Yacc mode is
9   breaking existing grammar files.  To avoid breaking too many grammars, the
10   prototypes are now generated when `-y/--yacc` is used *and* the
11   `POSIXLY_CORRECT` environment variable is defined.
13   Avoid using `-y`/`--yacc` simply to comply with Yacc's file name
14   conventions, rather, use `-o y.tab.c`.  Autoconf's AC_PROG_YACC macro uses
15   `-y`.  Avoid it if possible, for instance by using gnulib's gl_PROG_BISON.
17 * Noteworthy changes in release 3.8 (2021-09-07) [stable]
19 ** Backward incompatible changes
21   In conformance with the recommendations of the Graphviz team
22   (https://marc.info/?l=graphviz-devel&m=129418103126092), `-g`/`--graph`
23   now generates a *.gv file by default, instead of *.dot.  A transition
24   started in Bison 3.4.
26   To comply with the latest POSIX standard, in Yacc compatibility mode
27   (options `-y`/`--yacc`) Bison now generates prototypes for yyerror and
28   yylex.  In some situations, this is breaking compatibility: if the user
29   has already declared these functions but with some differences (e.g., to
30   declare them as static, or to use specific attributes), the generated
31   parser will fail to compile.  To disable these prototypes, #define yyerror
32   (to `yyerror`), and likewise for yylex.
34 ** Deprecated features
36   Support for the YYPRINT macro is removed. It worked only with yacc.c and
37   only for tokens.  It was obsoleted by %printer, introduced in Bison 1.50
38   (November 2002).
40   It has always been recommended to prefer `%define api.value.type foo` to
41   `#define YYSTYPE foo`.  The latter is supported in C for compatibility
42   with Yacc, but not in C++.  Warnings are now issued if `#define YYSTYPE`
43   is used in C++, and eventually support will be removed.
45   In C++ code, prefer value_type to semantic_type to denote the semantic
46   value type, which is specified by the `api.value.type` %define variable.
48 ** New features
50 *** A skeleton for the D programming language
52   The "lalr1.d" skeleton is now officially part of Bison.
54   It was originally contributed by Oliver Mangold, based on Paolo Bonzini's
55   lalr1.java, and was improved by H. S. Teoh.  Adela Vais then took over
56   maintenance and invested a lot of efforts to complete, test and document
57   it.
59   It now supports all the bells and whistles of the other deterministic
60   parsers, which include: pull/push interfaces, verbose and custom error
61   messages, lookahead correction, token constructors, internationalization,
62   locations, printers, token and symbol prefixes, etc.
64   Two examples demonstrate the D parsers: a basic one (examples/d/simple),
65   and an advanced one (examples/d/calc).
67 *** Option -H, --header and directive %header
69   The option `-H`/`--header` supersedes the option `--defines`, and the
70   directive %header supersedes %defines.  Both `--defines` and `%defines`
71   are, of course, maintained for backward compatibility.
73 *** Option --html
75   Since version 2.4 Bison can be used to generate HTML reports.  However it
76   was a two-step process: first bison must be invoked with option `--xml`,
77   and then xsltproc must be run to the convert the XML reports into HTML.
79   The new option `--html` combines these steps.  The xsltproc program must
80   be available.
82 *** A C++ native GLR parser
84   A new version of the C++ GLR parser was added: "glr2.cc".  It generates
85   "true C++11", instead of a C++ wrapper around a C parser as does the
86   existing "glr.cc" parser.  As a first significant consequence, it supports
87   `%define api.value.type variant`, contrary to glr.cc.
89   It should be upward compatible in terms of interface, feature and
90   performance to "glr.cc". To try it out, simply use
92   %skeleton "glr2.cc"
94   It will eventually replace "glr.cc".  However we need user feedback on
95   this skeleton.  _Please_ report your results and comments about it.
97 *** Counterexamples
99   Counterexamples now show the rule numbers, and always show ε for rules
100   with an empty right-hand side.  For instance
102     exp
103     ↳ 1: e1       e2     "a"
104          ↳ 3: ε • ↳ 1: ε
106   instead of
108     exp
109     ↳ e1  e2  "a"
110       ↳ • ↳ ε
112 *** Lookahead correction in Java
114   The Java skeleton (lalr1.java) now supports LAC, via the `parse.lac`
115   %define variable.
117 *** Abort parsing for memory exhaustion (C)
119   User actions may now use `YYNOMEM` (similar to `YYACCEPT` and `YYABORT`)
120   to abort the current parse with memory exhaustion.
122 *** Printing locations in debug traces (C)
124   The `YYLOCATION_PRINT(File, Loc)` macro prints a location.  It is defined
125   when (i) locations are enabled, (ii) the default type for locations is
126   used, (iii) debug traces are enabled, and (iv) `YYLOCATION_PRINT` is not
127   already defined.
129   Users may define `YYLOCATION_PRINT` to cover other cases.
131 *** GLR traces
133   There were no debug traces for deferred calls to user actions.  They are
134   logged now.
137 * Noteworthy changes in release 3.7.6 (2021-03-08) [stable]
139 ** Bug fixes
141 *** Reused Push Parsers
143   When a push-parser state structure is used for multiple parses, it was
144   possible for some state to leak from one run into the following one.
146 *** Fix Table Generation
148   In some very rare conditions, when there are many useless tokens, it was
149   possible to generate incorrect parsers.
152 * Noteworthy changes in release 3.7.5 (2021-01-24) [stable]
154 ** Bug fixes
156 *** Counterexample Generation
158   In some cases counterexample generation could crash.  This is fixed.
160 *** Fix Table Generation
162   In some very rare conditions, when there are many useless tokens, it was
163   possible to generate incorrect parsers.
165 *** GLR parsers now support %merge together with api.value.type=union.
167 *** C++ parsers use noexcept in more places.
169 *** Generated parsers avoid some warnings about signedness issues.
171 *** C-language parsers now avoid warnings from pedantic clang.
173 *** C-language parsers now work around quirks of HP-UX 11.23 (2003).
176 * Noteworthy changes in release 3.7.4 (2020-11-14) [stable]
178 ** Bug fixes
180 *** Bug fixes in yacc.c
182   In Yacc mode, all the tokens are defined twice: once as an enum, and then
183   as a macro.  YYEMPTY was missing its macro.
185 *** Bug fixes in lalr1.cc
187   The lalr1.cc skeleton used to emit internal assertions (using YY_ASSERT)
188   even when the `parse.assert` %define variable is not enabled.  It no
189   longer does.
191   The private internal macro YY_ASSERT now obeys the `api.prefix` %define
192   variable.
194   When there is a very large number of tokens, some assertions could be long
195   enough to hit arbitrary limits in Visual C++.  They have been rewritten to
196   work around this limitation.
198 ** Changes
200   The YYBISON macro in generated "regular C parsers" (from the "yacc.c"
201   skeleton) used to be defined to 1.  It is now defined to the version of
202   Bison as an integer (e.g., 30704 for version 3.7.4).
205 * Noteworthy changes in release 3.7.3 (2020-10-13) [stable]
207 ** Bug fixes
209   Fix concurrent build issues.
211   The bison executable is no longer linked uselessly against libreadline.
213   Fix incorrect use of yytname in glr.cc.
216 * Noteworthy changes in release 3.7.2 (2020-09-05) [stable]
218   This release of Bison fixes all known bugs reported for Bison in MITRE's
219   Common Vulnerabilities and Exposures (CVE) system.  These vulnerabilities
220   are only about bison-the-program itself, not the generated code.
222   Although these bugs are typically irrelevant to how Bison is used, they
223   are worth fixing if only to give users peace of mind.
225   There is no known vulnerability in the generated parsers.
227 ** Bug fixes
229   Fix concurrent build issues (introduced in Bison 3.5).
231   Push parsers always use YYMALLOC/YYFREE (no direct calls to malloc/free).
233   Fix portability issues of the test suite, and of bison itself.
235   Some unlikely crashes found by fuzzing have been fixed.  This is only
236   about bison itself, not the generated parsers.
239 * Noteworthy changes in release 3.7.1 (2020-08-02) [stable]
241 ** Bug fixes
243   Crash when a token alias contains a NUL byte.
245   Portability issues with libtextstyle.
247   Portability issues of Bison itself with MSVC.
249 ** Changes
251   Improvements and fixes in the documentation.
253   More precise location about symbol type redefinitions.
256 * Noteworthy changes in release 3.7 (2020-07-23) [stable]
258 ** Deprecated features
260   The YYPRINT macro, which works only with yacc.c and only for tokens, was
261   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
262   It is deprecated and its support will be removed eventually.
264   In conformance with the recommendations of the Graphviz team, in the next
265   version Bison the option `--graph` will generate a *.gv file by default,
266   instead of *.dot.  A transition started in Bison 3.4.
268 ** New features
270 *** Counterexample Generation
272   Contributed by Vincent Imbimbo.
274   When given `-Wcounterexamples`/`-Wcex`, bison will now output
275   counterexamples for conflicts.
277 **** Unifying Counterexamples
279   Unifying counterexamples are strings which can be parsed in two ways due
280   to the conflict.  For example on a grammar that contains the usual
281   "dangling else" ambiguity:
283     $ bison else.y
284     else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
285     else.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
287     $ bison else.y -Wcex
288     else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
289     else.y: warning: shift/reduce conflict on token "else" [-Wcounterexamples]
290       Example: "if" exp "then" "if" exp "then" exp • "else" exp
291       Shift derivation
292         exp
293         ↳ "if" exp "then" exp
294                           ↳ "if" exp "then" exp • "else" exp
295       Example: "if" exp "then" "if" exp "then" exp • "else" exp
296       Reduce derivation
297         exp
298         ↳ "if" exp "then" exp                     "else" exp
299                           ↳ "if" exp "then" exp •
301   When text styling is enabled, colors are used in the examples and the
302   derivations to highlight the structure of both analyses.  In this case,
304     "if" exp "then" [ "if" exp "then" exp • ] "else" exp
306   vs.
308     "if" exp "then" [ "if" exp "then" exp • "else" exp ]
311   The counterexamples are "focused", in two different ways.  First, they do
312   not clutter the output with all the derivations from the start symbol,
313   rather they start on the "conflicted nonterminal". They go straight to the
314   point.  Second, they don't "expand" nonterminal symbols uselessly.
316 **** Nonunifying Counterexamples
318   In the case of the dangling else, Bison found an example that can be
319   parsed in two ways (therefore proving that the grammar is ambiguous).
320   When it cannot find such an example, it instead generates two examples
321   that are the same up until the dot:
323     $ bison foo.y
324     foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
325     foo.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
326     foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
327         4 | a: expr
328           |    ^~~~
330     $ bison -Wcex foo.y
331     foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
332     foo.y: warning: shift/reduce conflict on token ID [-Wcounterexamples]
333       First example: expr • ID ',' ID $end
334       Shift derivation
335         $accept
336         ↳ s                      $end
337           ↳ a                 ID
338             ↳ expr
339               ↳ expr • ID ','
340       Second example: expr • ID $end
341       Reduce derivation
342         $accept
343         ↳ s             $end
344           ↳ a        ID
345             ↳ expr •
346     foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
347         4 | a: expr
348           |    ^~~~
350   In these cases, the parser usually doesn't have enough lookahead to
351   differentiate the two given examples.
353 **** Reports
355   Counterexamples are also included in the report when given
356   `--report=counterexamples`/`-rcex` (or `--report=all`), with more
357   technical details:
359     State 7
361       1 exp: "if" exp "then" exp •  [$end, "then", "else"]
362       2    | "if" exp "then" exp • "else" exp
364       "else"  shift, and go to state 8
366       "else"    [reduce using rule 1 (exp)]
367       $default  reduce using rule 1 (exp)
369       shift/reduce conflict on token "else":
370           1 exp: "if" exp "then" exp •
371           2 exp: "if" exp "then" exp • "else" exp
372         Example: "if" exp "then" "if" exp "then" exp • "else" exp
373         Shift derivation
374           exp
375           ↳ "if" exp "then" exp
376                             ↳ "if" exp "then" exp • "else" exp
377         Example: "if" exp "then" "if" exp "then" exp • "else" exp
378         Reduce derivation
379           exp
380           ↳ "if" exp "then" exp                     "else" exp
381                             ↳ "if" exp "then" exp •
383 *** File prefix mapping
385   Contributed by Joshua Watt.
387   Bison learned a new argument, `--file-prefix-map OLD=NEW`.  Any file path
388   in the output (specifically `#line` directives and `#ifdef` header guards)
389   that begins with the prefix OLD will have it replaced with the prefix NEW,
390   similar to the `-ffile-prefix-map` in GCC.  This option can be used to
391   make bison output reproducible.
393 ** Changes
395 *** Diagnostics
397   When text styling is enabled and the terminal supports it, the warnings
398   now include hyperlinks to the documentation.
400 *** Relocatable installation
402   When installed to be relocatable (via `configure --enable-relocatable`),
403   bison will now also look for a relocated m4.
405 *** C++ file names
407   The `filename_type` %define variable was renamed `api.filename.type`.
408   Instead of
410     %define filename_type "symbol"
412   write
414     %define api.filename.type {symbol}
416   (Or let `bison --update` do it for you).
418   It now defaults to `const std::string` instead of `std::string`.
420 *** Deprecated %define variable names
422   The following variables have been renamed for consistency.  Backward
423   compatibility is ensured, but upgrading is recommended.
425     filename_type       -> api.filename.type
426     package             -> api.package
428 *** Push parsers no longer clear their state when parsing is finished
430   Previously push-parsers cleared their state when parsing was finished (on
431   success and on failure).  This made it impossible to check if there were
432   parse errors, since `yynerrs` was also reset.  This can be especially
433   troublesome when used in autocompletion, since a parser with error
434   recovery would suggest (irrelevant) expected tokens even if there were
435   failures.
437   Now the parser state can be examined when parsing is finished.  The parser
438   state is reset when starting a new parse.
440 ** Documentation
442 *** Examples
444   The bistromathic demonstrates %param and how to quote sources in the error
445   messages:
447     > 123 456
448     1.5-7: syntax error: expected end of file or + or - or * or / or ^ before number
449         1 | 123 456
450           |     ^~~
452 ** Bug fixes
454 *** Include the generated header (yacc.c)
456   Historically, when --defines was used, bison generated a header and pasted
457   an exact copy of it into the generated parser implementation file.  Since
458   Bison 3.4 it is possible to specify that the header should be `#include`d,
459   and how.  For instance
461     %define api.header.include {"parse.h"}
463   or
465     %define api.header.include {<parser/parse.h>}
467   Now api.header.include defaults to `"header-basename"`, as was intended in
468   Bison 3.4, where `header-basename` is the basename of the generated
469   header.  This is disabled when the generated header is `y.tab.h`, to
470   comply with Automake's ylwrap.
472 *** String aliases are faithfully propagated
474   Bison used to interpret user strings (i.e., decoding backslash escapes)
475   when reading them, and to escape them (i.e., issue non-printable
476   characters as backslash escapes, taking the locale into account) when
477   outputting them.  As a consequence non-ASCII strings (say in UTF-8) ended
478   up "ciphered" as sequences of backslash escapes.  This happened not only
479   in the generated sources (where the compiler will reinterpret them), but
480   also in all the generated reports (text, xml, html, dot, etc.).  Reports
481   were therefore not readable when string aliases were not pure ASCII.
482   Worse yet: the output depended on the user's locale.
484   Now Bison faithfully treats the string aliases exactly the way the user
485   spelled them.  This fixes all the aforementioned problems.  However, now,
486   string aliases semantically equivalent but syntactically different (e.g.,
487   "A", "\x41", "\101") are considered to be different.
489 *** Crash when generating IELR
491   An old, well hidden, bug in the generation of IELR parsers was fixed.
494 * Noteworthy changes in release 3.6.4 (2020-06-15) [stable]
496 ** Bug fixes
498   In glr.cc some internal macros leaked in the user's code, and could damage
499   access to the token kinds.
502 * Noteworthy changes in release 3.6.3 (2020-06-03) [stable]
504 ** Bug fixes
506   Incorrect comments in the generated parsers.
508   Warnings in push parsers (yacc.c).
510   Incorrect display of gotos in LAC traces (lalr1.cc).
513 * Noteworthy changes in release 3.6.2 (2020-05-17) [stable]
515 ** Bug fixes
517   Some tests were fixed.
519   When token aliases contain comment delimiters:
521     %token FOO "/* foo */"
523   bison used to emit "nested" comments, which is invalid C.
526 * Noteworthy changes in release 3.6.1 (2020-05-10) [stable]
528 ** Bug fixes
530   Restored ANSI-C compliance in yacc.c.
532   GNU readline portability issues.
534   In C++, yy::parser::symbol_name is now a public member, as was intended.
536 ** New features
538   In C++, yy::parser::symbol_type now has a public name() member function.
541 * Noteworthy changes in release 3.6 (2020-05-08) [stable]
543 ** Backward incompatible changes
545   TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose".
547   The YYERROR_VERBOSE macro is no longer supported; the parsers that still
548   depend on it will now produce Yacc-like error messages (just "syntax
549   error").  It was superseded by the "%error-verbose" directive in Bison
550   1.875 (2003-01-01).  Bison 2.6 (2012-07-19) clearly announced that support
551   for YYERROR_VERBOSE would be removed.  Note that since Bison 3.0
552   (2013-07-25), "%error-verbose" is deprecated in favor of "%define
553   parse.error verbose".
555 ** Deprecated features
557   The YYPRINT macro, which works only with yacc.c and only for tokens, was
558   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
559   It is deprecated and its support will be removed eventually.
561 ** New features
563 *** Improved syntax error messages
565   Two new values for the %define parse.error variable offer more control to
566   the user.  Available in all the skeletons (C, C++, Java).
568 **** %define parse.error detailed
570   The behavior of "%define parse.error detailed" is closely resembling that
571   of "%define parse.error verbose" with a few exceptions.  First, it is safe
572   to use non-ASCII characters in token aliases (with 'verbose', the result
573   depends on the locale with which bison was run).  Second, a yysymbol_name
574   function is exposed to the user, instead of the yytnamerr function and the
575   yytname table.  Third, token internationalization is supported (see
576   below).
578 **** %define parse.error custom
580   With this directive, the user forges and emits the syntax error message
581   herself by defining the yyreport_syntax_error function.  A new type,
582   yypcontext_t, captures the circumstances of the error, and provides the
583   user with functions to get details, such as yypcontext_expected_tokens to
584   get the list of expected token kinds.
586   A possible implementation of yyreport_syntax_error is:
588     int
589     yyreport_syntax_error (const yypcontext_t *ctx)
590     {
591       int res = 0;
592       YY_LOCATION_PRINT (stderr, *yypcontext_location (ctx));
593       fprintf (stderr, ": syntax error");
594       // Report the tokens expected at this point.
595       {
596         enum { TOKENMAX = 10 };
597         yysymbol_kind_t expected[TOKENMAX];
598         int n = yypcontext_expected_tokens (ctx, expected, TOKENMAX);
599         if (n < 0)
600           // Forward errors to yyparse.
601           res = n;
602         else
603           for (int i = 0; i < n; ++i)
604             fprintf (stderr, "%s %s",
605                      i == 0 ? ": expected" : " or", yysymbol_name (expected[i]));
606       }
607       // Report the unexpected token.
608       {
609         yysymbol_kind_t lookahead = yypcontext_token (ctx);
610         if (lookahead != YYSYMBOL_YYEMPTY)
611           fprintf (stderr, " before %s", yysymbol_name (lookahead));
612       }
613       fprintf (stderr, "\n");
614       return res;
615     }
617 **** Token aliases internationalization
619   When the %define variable parse.error is set to `custom` or `detailed`,
620   one may specify which token aliases are to be translated using _().  For
621   instance
623     %token
624         PLUS   "+"
625         MINUS  "-"
626       <double>
627         NUM _("number")
628       <symrec*>
629         FUN _("function")
630         VAR _("variable")
632   In that case the user must define _() and N_(), and yysymbol_name returns
633   the translated symbol (i.e., it returns '_("variable")' rather that
634   '"variable"').  In Java, the user must provide an i18n() function.
636 *** List of expected tokens (yacc.c)
638   Push parsers may invoke yypstate_expected_tokens at any point during
639   parsing (including even before submitting the first token) to get the list
640   of possible tokens.  This feature can be used to propose autocompletion
641   (see below the "bistromathic" example).
643   It makes little sense to use this feature without enabling LAC (lookahead
644   correction).
646 *** Returning the error token
648   When the scanner returns an invalid token or the undefined token
649   (YYUNDEF), the parser generates an error message and enters error
650   recovery.  Because of that error message, most scanners that find lexical
651   errors generate an error message, and then ignore the invalid input
652   without entering the error-recovery.
654   The scanners may now return YYerror, the error token, to enter the
655   error-recovery mode without triggering an additional error message.  See
656   the bistromathic for an example.
658 *** Deep overhaul of the symbol and token kinds
660   To avoid the confusion with types in programming languages, we now refer
661   to token and symbol "kinds" instead of token and symbol "types".  The
662   documentation and error messages have been revised.
664   All the skeletons have been updated to use dedicated enum types rather
665   than integral types.  Special symbols are now regular citizens, instead of
666   being declared in ad hoc ways.
668 **** Token kinds
670   The "token kind" is what is returned by the scanner, e.g., PLUS, NUMBER,
671   LPAREN, etc.  While backward compatibility is of course ensured, users are
672   nonetheless invited to replace their uses of "enum yytokentype" by
673   "yytoken_kind_t".
675   This type now also includes tokens that were previously hidden: YYEOF (end
676   of input), YYUNDEF (undefined token), and YYerror (error token).  They
677   now have string aliases, internationalized when internationalization is
678   enabled.  Therefore, by default, error messages now refer to "end of file"
679   (internationalized) rather than the cryptic "$end", or to "invalid token"
680   rather than "$undefined".
682   Therefore in most cases it is now useless to define the end-of-line token
683   as follows:
685     %token T_EOF 0 "end of file"
687   Rather simply use "YYEOF" in your scanner.
689 **** Symbol kinds
691   The "symbol kinds" is what the parser actually uses.  (Unless the
692   api.token.raw %define variable is used, the symbol kind of a terminal
693   differs from the corresponding token kind.)
695   They are now exposed as a enum, "yysymbol_kind_t".
697   This allows users to tailor the error messages the way they want, or to
698   process some symbols in a specific way in autocompletion (see the
699   bistromathic example below).
701 *** Modernize display of explanatory statements in diagnostics
703   Since Bison 2.7, output was indented four spaces for explanatory
704   statements.  For example:
706     input.y:2.7-13: error: %type redeclaration for exp
707     input.y:1.7-11:     previous declaration
709   Since the introduction of caret-diagnostics, it became less clear.  This
710   indentation has been removed and submessages are displayed similarly as in
711   GCC:
713     input.y:2.7-13: error: %type redeclaration for exp
714         2 | %type <float> exp
715           |       ^~~~~~~
716     input.y:1.7-11: note: previous declaration
717         1 | %type <int> exp
718           |       ^~~~~
720   Contributed by Victor Morales Cayuela.
722 *** C++
724   The token and symbol kinds are yy::parser::token_kind_type and
725   yy::parser::symbol_kind_type.
727   The symbol_type::kind() member function allows to get the kind of a
728   symbol.  This can be used to write unit tests for scanners, e.g.,
730     yy::parser::symbol_type t = make_NUMBER ("123");
731     assert (t.kind () == yy::parser::symbol_kind::S_NUMBER);
732     assert (t.value.as<int> () == 123);
734 ** Documentation
736 *** User Manual
738   In order to avoid ambiguities with "type" as in "typing", we now refer to
739   the "token kind" (e.g., `PLUS`, `NUMBER`, etc.) rather than the "token
740   type".  We now also refer to the "symbol type" (e.g., `PLUS`, `expr`,
741   etc.).
743 *** Examples
745   There are now examples/java: a very simple calculator, and a more complete
746   one (push-parser, location tracking, and debug traces).
748   The lexcalc example (a simple example in C based on Flex and Bison) now
749   also demonstrates location tracking.
752   A new C example, bistromathic, is a fully featured interactive calculator
753   using many Bison features: pure interface, push parser, autocompletion
754   based on the current parser state (using yypstate_expected_tokens),
755   location tracking, internationalized custom error messages, lookahead
756   correction, rich debug traces, etc.
758   It shows how to depend on the symbol kinds to tailor autocompletion.  For
759   instance it recognizes the symbol kind "VARIABLE" to propose
760   autocompletion on the existing variables, rather than of the word
761   "variable".
764 * Noteworthy changes in release 3.5.4 (2020-04-05) [stable]
766 ** WARNING: Future backward-incompatibilities!
768   TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose".
770   Bison 3.6 will no longer support the YYERROR_VERBOSE macro; the parsers
771   that still depend on it will produce Yacc-like error messages (just
772   "syntax error").  It was superseded by the "%error-verbose" directive in
773   Bison 1.875 (2003-01-01).  Bison 2.6 (2012-07-19) clearly announced that
774   support for YYERROR_VERBOSE would be removed.  Note that since Bison 3.0
775   (2013-07-25), "%error-verbose" is deprecated in favor of "%define
776   parse.error verbose".
778 ** Bug fixes
780   Fix portability issues of the package itself on old compilers.
782   Fix api.token.raw support in Java.
785 * Noteworthy changes in release 3.5.3 (2020-03-08) [stable]
787 ** Bug fixes
789   Error messages could quote lines containing zero-width characters (such as
790   \005) with incorrect styling.  Fixes for similar issues with unexpectedly
791   short lines (e.g., the file was changed between parsing and diagnosing).
793   Some unlikely crashes found by fuzzing have been fixed.  This is only
794   about bison itself, not the generated parsers.
797 * Noteworthy changes in release 3.5.2 (2020-02-13) [stable]
799 ** Bug fixes
801   Portability issues and minor cosmetic issues.
803   The lalr1.cc skeleton properly rejects unsupported values for parse.lac
804   (as yacc.c does).
807 * Noteworthy changes in release 3.5.1 (2020-01-19) [stable]
809 ** Bug fixes
811   Portability fixes.
813   Fix compiler warnings.
816 * Noteworthy changes in release 3.5 (2019-12-11) [stable]
818 ** Backward incompatible changes
820   Lone carriage-return characters (aka \r or ^M) in the grammar files are no
821   longer treated as end-of-lines.  This changes the diagnostics, and in
822   particular their locations.
824   In C++, line numbers and columns are now represented as 'int' not
825   'unsigned', so that integer overflow on positions is easily checkable via
826   'gcc -fsanitize=undefined' and the like.  This affects the API for
827   positions.  The default position and location classes now expose
828   'counter_type' (int), used to define line and column numbers.
830 ** Deprecated features
832   The YYPRINT macro, which works only with yacc.c and only for tokens, was
833   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
834   It is deprecated and its support will be removed eventually.
836 ** New features
838 *** Lookahead correction in C++
840   Contributed by Adrian Vogelsgesang.
842   The C++ deterministic skeleton (lalr1.cc) now supports LAC, via the
843   %define variable parse.lac.
845 *** Variable api.token.raw: Optimized token numbers (all skeletons)
847   In the generated parsers, tokens have two numbers: the "external" token
848   number as returned by yylex (which starts at 257), and the "internal"
849   symbol number (which starts at 3).  Each time yylex is called, a table
850   lookup maps the external token number to the internal symbol number.
852   When the %define variable api.token.raw is set, tokens are assigned their
853   internal number, which saves one table lookup per token, and also saves
854   the generation of the mapping table.
856   The gain is typically moderate, but in extreme cases (very simple user
857   actions), a 10% improvement can be observed.
859 *** Generated parsers use better types for states
861   Stacks now use the best integral type for state numbers, instead of always
862   using 15 bits.  As a result "small" parsers now have a smaller memory
863   footprint (they use 8 bits), and there is support for large automata (16
864   bits), and extra large (using int, i.e., typically 31 bits).
866 *** Generated parsers prefer signed integer types
868   Bison skeletons now prefer signed to unsigned integer types when either
869   will do, as the signed types are less error-prone and allow for better
870   checking with 'gcc -fsanitize=undefined'.  Also, the types chosen are now
871   portable to unusual machines where char, short and int are all the same
872   width.  On non-GNU platforms this may entail including <limits.h> and (if
873   available) <stdint.h> to define integer types and constants.
875 *** A skeleton for the D programming language
877   For the last few releases, Bison has shipped a stealth experimental
878   skeleton: lalr1.d.  It was first contributed by Oliver Mangold, based on
879   Paolo Bonzini's lalr1.java, and was cleaned and improved thanks to
880   H. S. Teoh.
882   However, because nobody has committed to improving, testing, and
883   documenting this skeleton, it is not clear that it will be supported in
884   the future.
886   The lalr1.d skeleton *is functional*, and works well, as demonstrated in
887   examples/d/calc.d.  Please try it, enjoy it, and... commit to support it.
889 *** Debug traces in Java
891   The Java backend no longer emits code and data for parser tracing if the
892   %define variable parse.trace is not defined.
894 ** Diagnostics
896 *** New diagnostic: -Wdangling-alias
898   String literals, which allow for better error messages, are (too)
899   liberally accepted by Bison, which might result in silent errors.  For
900   instance
902     %type <exVal> cond "condition"
904   does not define "condition" as a string alias to 'cond' (nonterminal
905   symbols do not have string aliases).  It is rather equivalent to
907     %nterm <exVal> cond
908     %token <exVal> "condition"
910   i.e., it gives the type 'exVal' to the "condition" token, which was
911   clearly not the intention.
913   Also, because string aliases need not be defined, typos such as "baz"
914   instead of "bar" will be not reported.
916   The option `-Wdangling-alias` catches these situations.  On
918     %token BAR "bar"
919     %type <ival> foo "foo"
920     %%
921     foo: "baz" {}
923   bison -Wdangling-alias reports
925     warning: string literal not attached to a symbol
926           | %type <ival> foo "foo"
927           |                  ^~~~~
928     warning: string literal not attached to a symbol
929           | foo: "baz" {}
930           |      ^~~~~
932    The `-Wall` option does not (yet?) include `-Wdangling-alias`.
934 *** Better POSIX Yacc compatibility diagnostics
936   POSIX Yacc restricts %type to nonterminals.  This is now diagnosed by
937   -Wyacc.
939     %token TOKEN1
940     %type  <ival> TOKEN1 TOKEN2 't'
941     %token TOKEN2
942     %%
943     expr:
945   gives with -Wyacc
947     input.y:2.15-20: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
948         2 | %type  <ival> TOKEN1 TOKEN2 't'
949           |               ^~~~~~
950     input.y:2.29-31: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
951         2 | %type  <ival> TOKEN1 TOKEN2 't'
952           |                             ^~~
953     input.y:2.22-27: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
954         2 | %type  <ival> TOKEN1 TOKEN2 't'
955           |                      ^~~~~~
957 *** Diagnostics with insertion
959   The diagnostics now display the suggestion below the underlined source.
960   Replacement for undeclared symbols are now also suggested.
962     $ cat /tmp/foo.y
963     %%
964     list: lis '.' |
966     $ bison -Wall foo.y
967     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'?
968         2 | list: lis '.' |
969           |       ^~~
970           |       list
971     foo.y:2.16: warning: empty rule without %empty [-Wempty-rule]
972         2 | list: lis '.' |
973           |                ^
974           |                %empty
975     foo.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
977 *** Diagnostics about long lines
979   Quoted sources may now be truncated to fit the screen.  For instance, on a
980   30-column wide terminal:
982     $ cat foo.y
983     %token FOO                       FOO                         FOO
984     %%
985     exp: FOO
986     $ bison foo.y
987     foo.y:1.34-36: warning: symbol FOO redeclared [-Wother]
988         1 | …         FOO                  …
989           |           ^~~
990     foo.y:1.8-10:      previous declaration
991         1 | %token FOO                     …
992           |        ^~~
993     foo.y:1.62-64: warning: symbol FOO redeclared [-Wother]
994         1 | …         FOO
995           |           ^~~
996     foo.y:1.8-10:      previous declaration
997         1 | %token FOO                     …
998           |        ^~~
1000 ** Changes
1002 *** Debugging glr.c and glr.cc
1004   The glr.c skeleton always had asserts to check its own behavior (not the
1005   user's).  These assertions are now under the control of the parse.assert
1006   %define variable (disabled by default).
1008 *** Clean up
1010   Several new compiler warnings in the generated output have been avoided.
1011   Some unused features are no longer emitted.  Cleaner generated code in
1012   general.
1014 ** Bug Fixes
1016   Portability issues in the test suite.
1018   In theory, parsers using %nonassoc could crash when reporting verbose
1019   error messages. This unlikely bug has been fixed.
1021   In Java, %define api.prefix was ignored.  It now behaves as expected.
1024 * Noteworthy changes in release 3.4.2 (2019-09-12) [stable]
1026 ** Bug fixes
1028   In some cases, when warnings are disabled, bison could emit tons of white
1029   spaces as diagnostics.
1031   When running out of memory, bison could crash (found by fuzzing).
1033   When defining twice the EOF token, bison would crash.
1035   New warnings from recent compilers have been addressed in the generated
1036   parsers (yacc.c, glr.c, glr.cc).
1038   When lone carriage-return characters appeared in the input file,
1039   diagnostics could hang forever.
1042 * Noteworthy changes in release 3.4.1 (2019-05-22) [stable]
1044 ** Bug fixes
1046   Portability fixes.
1049 * Noteworthy changes in release 3.4 (2019-05-19) [stable]
1051 ** Deprecated features
1053   The %pure-parser directive is deprecated in favor of '%define api.pure'
1054   since Bison 2.3b (2008-05-27), but no warning was issued; there is one
1055   now.  Note that since Bison 2.7 you are strongly encouraged to use
1056   '%define api.pure full' instead of '%define api.pure'.
1058 ** New features
1060 *** Colored diagnostics
1062   As an experimental feature, diagnostics are now colored, controlled by the
1063   new options --color and --style.
1065   To use them, install the libtextstyle library before configuring Bison.
1066   It is available from
1068     https://alpha.gnu.org/gnu/gettext/
1070   for instance
1072     https://alpha.gnu.org/gnu/gettext/libtextstyle-0.8.tar.gz
1074   The option --color supports the following arguments:
1075     - always, yes: Enable colors.
1076     - never, no: Disable colors.
1077     - auto, tty (default): Enable colors if the output device is a tty.
1079   To customize the styles, create a CSS file similar to
1081     /* bison-bw.css */
1082     .warning   { }
1083     .error     { font-weight: 800; text-decoration: underline; }
1084     .note      { }
1086   then invoke bison with --style=bison-bw.css, or set the BISON_STYLE
1087   environment variable to "bison-bw.css".
1089 *** Disabling output
1091   When given -fsyntax-only, the diagnostics are reported, but no output is
1092   generated.
1094   The name of this option is somewhat misleading as bison does more than
1095   just checking the syntax: every stage is run (including checking for
1096   conflicts for instance), except the generation of the output files.
1098 *** Include the generated header (yacc.c)
1100   Before, when --defines is used, bison generated a header, and pasted an
1101   exact copy of it into the generated parser implementation file.  If the
1102   header name is not "y.tab.h", it is now #included instead of being
1103   duplicated.
1105   To use an '#include' even if the header name is "y.tab.h" (which is what
1106   happens with --yacc, or when using the Autotools' ylwrap), define
1107   api.header.include to the exact argument to pass to #include.  For
1108   instance:
1110     %define api.header.include {"parse.h"}
1112   or
1114     %define api.header.include {<parser/parse.h>}
1116 *** api.location.type is now supported in C (yacc.c, glr.c)
1118   The %define variable api.location.type defines the name of the type to use
1119   for locations.  When defined, Bison no longer defines YYLTYPE.
1121   This can be used in programs with several parsers to factor their
1122   definition of locations: let one of them generate them, and the others
1123   just use them.
1125 ** Changes
1127 *** Graphviz output
1129   In conformance with the recommendations of the Graphviz team, if %require
1130   "3.4" (or better) is specified, the option --graph generates a *.gv file
1131   by default, instead of *.dot.
1133 *** Diagnostics overhaul
1135   Column numbers were wrong with multibyte characters, which would also
1136   result in skewed diagnostics with carets.  Beside, because we were
1137   indenting the quoted source with a single space, lines with tab characters
1138   were incorrectly underlined.
1140   To address these issues, and to be clearer, Bison now issues diagnostics
1141   as GCC9 does.  For instance it used to display (there's a tab before the
1142   opening brace):
1144     foo.y:3.37-38: error: $2 of ‘expr’ has no declared type
1145      expr: expr '+' "number"        { $$ = $1 + $2; }
1146                                          ^~
1147   It now reports
1149     foo.y:3.37-38: error: $2 of ‘expr’ has no declared type
1150         3 | expr: expr '+' "number" { $$ = $1 + $2; }
1151           |                                     ^~
1153   Other constructs now also have better locations, resulting in more precise
1154   diagnostics.
1156 *** Fix-it hints for %empty
1158   Running Bison with -Wempty-rules and --update will remove incorrect %empty
1159   annotations, and add the missing ones.
1161 *** Generated reports
1163   The format of the reports (parse.output) was improved for readability.
1165 *** Better support for --no-line.
1167   When --no-line is used, the generated files are now cleaner: no lines are
1168   generated instead of empty lines.  Together with using api.header.include,
1169   that should help people saving the generated files into version control
1170   systems get smaller diffs.
1172 ** Documentation
1174   A new example in C shows an simple infix calculator with a hand-written
1175   scanner (examples/c/calc).
1177   A new example in C shows a reentrant parser (capable of recursive calls)
1178   built with Flex and Bison (examples/c/reccalc).
1180   There is a new section about the history of Yaccs and Bison.
1182 ** Bug fixes
1184   A few obscure bugs were fixed, including the second oldest (known) bug in
1185   Bison: it was there when Bison was entered in the RCS version control
1186   system, in December 1987.  See the NEWS of Bison 3.3 for the previous
1187   oldest bug.
1190 * Noteworthy changes in release 3.3.2 (2019-02-03) [stable]
1192 ** Bug fixes
1194   Bison 3.3 failed to generate parsers for grammars with unused nonterminal
1195   symbols.
1198 * Noteworthy changes in release 3.3.1 (2019-01-27) [stable]
1200 ** Changes
1202   The option -y/--yacc used to imply -Werror=yacc, which turns uses of Bison
1203   extensions into errors.  It now makes them simple warnings (-Wyacc).
1206 * Noteworthy changes in release 3.3 (2019-01-26) [stable]
1208   A new mailing list was created, Bison Announce.  It is low traffic, and is
1209   only about announcing new releases and important messages (e.g., polls
1210   about major decisions to make).
1212   https://lists.gnu.org/mailman/listinfo/bison-announce
1214 ** Backward incompatible changes
1216   Support for DJGPP, which has been unmaintained and untested for years, is
1217   removed.
1219 ** Deprecated features
1221   A new feature, --update (see below) helps adjusting existing grammars to
1222   deprecations.
1224 *** Deprecated directives
1226   The %error-verbose directive is deprecated in favor of '%define
1227   parse.error verbose' since Bison 3.0, but no warning was issued.
1229   The '%name-prefix "xx"' directive is deprecated in favor of '%define
1230   api.prefix {xx}' since Bison 3.0, but no warning was issued.  These
1231   directives are slightly different, you might need to adjust your code.
1232   %name-prefix renames only symbols with external linkage, while api.prefix
1233   also renames types and macros, including YYDEBUG, YYTOKENTYPE,
1234   yytokentype, YYSTYPE, YYLTYPE, etc.
1236   Users of Flex that move from '%name-prefix "xx"' to '%define api.prefix
1237   {xx}' will typically have to update YY_DECL from
1239     #define YY_DECL int xxlex (YYSTYPE *yylval, YYLTYPE *yylloc)
1241   to
1243     #define YY_DECL int xxlex (XXSTYPE *yylval, XXLTYPE *yylloc)
1245 *** Deprecated %define variable names
1247   The following variables, mostly related to parsers in Java, have been
1248   renamed for consistency.  Backward compatibility is ensured, but upgrading
1249   is recommended.
1251     abstract           -> api.parser.abstract
1252     annotations        -> api.parser.annotations
1253     extends            -> api.parser.extends
1254     final              -> api.parser.final
1255     implements         -> api.parser.implements
1256     parser_class_name  -> api.parser.class
1257     public             -> api.parser.public
1258     strictfp           -> api.parser.strictfp
1260 ** New features
1262 *** Generation of fix-its for IDEs/Editors
1264   When given the new option -ffixit (aka -fdiagnostics-parseable-fixits),
1265   bison now generates machine readable editing instructions to fix some
1266   issues.  Currently, this is mostly limited to updating deprecated
1267   directives and removing duplicates.  For instance:
1269     $ cat foo.y
1270     %error-verbose
1271     %define parser_class_name "Parser"
1272     %define api.parser.class "Parser"
1273     %%
1274     exp:;
1276   See the "fix-it:" lines below:
1278     $ bison -ffixit foo.y
1279     foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated]
1280      %error-verbose
1281      ^~~~~~~~~~~~~~
1282     fix-it:"foo.y":{1:1-1:15}:"%define parse.error verbose"
1283     foo.y:2.1-34: warning: deprecated directive, use '%define api.parser.class {Parser}' [-Wdeprecated]
1284      %define parser_class_name "Parser"
1285      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1286     fix-it:"foo.y":{2:1-2:35}:"%define api.parser.class {Parser}"
1287     foo.y:3.1-33: error: %define variable 'api.parser.class' redefined
1288      %define api.parser.class "Parser"
1289      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1290     foo.y:2.1-34:     previous definition
1291      %define parser_class_name "Parser"
1292      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1293     fix-it:"foo.y":{3:1-3:34}:""
1294     foo.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
1296   This uses the same output format as GCC and Clang.
1298 *** Updating grammar files
1300   Fixes can be applied on the fly.  The previous example ends with the
1301   suggestion to re-run bison with the option -u/--update, which results in a
1302   cleaner grammar file.
1304     $ bison --update foo.y
1305     [...]
1306     bison: file 'foo.y' was updated (backup: 'foo.y~')
1308     $ cat foo.y
1309     %define parse.error verbose
1310     %define api.parser.class {Parser}
1311     %%
1312     exp:;
1314 *** Bison is now relocatable
1316   If you pass '--enable-relocatable' to 'configure', Bison is relocatable.
1318   A relocatable program can be moved or copied to a different location on
1319   the file system.  It can also be used through mount points for network
1320   sharing.  It is possible to make symbolic links to the installed and moved
1321   programs, and invoke them through the symbolic link.
1323 *** %expect and %expect-rr modifiers on individual rules
1325   One can now document (and check) which rules participate in shift/reduce
1326   and reduce/reduce conflicts.  This is particularly important GLR parsers,
1327   where conflicts are a normal occurrence.  For example,
1329       %glr-parser
1330       %expect 1
1331       %%
1333       ...
1335       argument_list:
1336         arguments %expect 1
1337       | arguments ','
1338       | %empty
1339       ;
1341       arguments:
1342         expression
1343       | argument_list ',' expression
1344       ;
1346       ...
1348   Looking at the output from -v, one can see that the shift/reduce conflict
1349   here is due to the fact that the parser does not know whether to reduce
1350   arguments to argument_list until it sees the token _after_ the following
1351   ','.  By marking the rule with %expect 1 (because there is a conflict in
1352   one state), we document the source of the 1 overall shift/reduce conflict.
1354   In GLR parsers, we can use %expect-rr in a rule for reduce/reduce
1355   conflicts.  In this case, we mark each of the conflicting rules.  For
1356   example,
1358       %glr-parser
1359       %expect-rr 1
1361       %%
1363       stmt:
1364         target_list '=' expr ';'
1365       | expr_list ';'
1366       ;
1368       target_list:
1369         target
1370       | target ',' target_list
1371       ;
1373       target:
1374         ID %expect-rr 1
1375       ;
1377       expr_list:
1378         expr
1379       | expr ',' expr_list
1380       ;
1382       expr:
1383         ID %expect-rr 1
1384       | ...
1385       ;
1387   In a statement such as
1389       x, y = 3, 4;
1391   the parser must reduce x to a target or an expr, but does not know which
1392   until it sees the '='.  So we notate the two possible reductions to
1393   indicate that each conflicts in one rule.
1395   This feature needs user feedback, and might evolve in the future.
1397 *** C++: Actual token constructors
1399   When variants and token constructors are enabled, in addition to the
1400   type-safe named token constructors (make_ID, make_INT, etc.), we now
1401   generate genuine constructors for symbol_type.
1403   For instance with these declarations
1405     %token           ':'
1406        <std::string> ID
1407        <int>         INT;
1409   you may use these constructors:
1411     symbol_type (int token, const std::string&);
1412     symbol_type (int token, const int&);
1413     symbol_type (int token);
1415   Correct matching between token types and value types is checked via
1416   'assert'; for instance, 'symbol_type (ID, 42)' would abort.  Named
1417   constructors are preferable, as they offer better type safety (for
1418   instance 'make_ID (42)' would not even compile), but symbol_type
1419   constructors may help when token types are discovered at run-time, e.g.,
1421      [a-z]+   {
1422                 if (auto i = lookup_keyword (yytext))
1423                   return yy::parser::symbol_type (i);
1424                 else
1425                   return yy::parser::make_ID (yytext);
1426               }
1428 *** C++: Variadic emplace
1430   If your application requires C++11 and you don't use symbol constructors,
1431   you may now use a variadic emplace for semantic values:
1433     %define api.value.type variant
1434     %token <std::pair<int, int>> PAIR
1436   in your scanner:
1438     int yylex (parser::semantic_type *lvalp)
1439     {
1440       lvalp->emplace <std::pair<int, int>> (1, 2);
1441       return parser::token::PAIR;
1442     }
1444 *** C++: Syntax error exceptions in GLR
1446   The glr.cc skeleton now supports syntax_error exceptions thrown from user
1447   actions, or from the scanner.
1449 *** More POSIX Yacc compatibility warnings
1451   More Bison specific directives are now reported with -y or -Wyacc.  This
1452   change was ready since the release of Bison 3.0 in September 2015.  It was
1453   delayed because Autoconf used to define YACC as `bison -y`, which resulted
1454   in numerous warnings for Bison users that use the GNU Build System.
1456   If you still experience that problem, either redefine YACC as `bison -o
1457   y.tab.c`, or pass -Wno-yacc to Bison.
1459 *** The tables yyrhs and yyphrs are back
1461   Because no Bison skeleton uses them, these tables were removed (no longer
1462   passed to the skeletons, not even computed) in 2008.  However, some users
1463   have expressed interest in being able to use them in their own skeletons.
1465 ** Bug fixes
1467 *** Incorrect number of reduce/reduce conflicts
1469   On a grammar such as
1471      exp: "num" | "num" | "num"
1473   bison used to report a single RR conflict, instead of two.  This is now
1474   fixed.  This was the oldest (known) bug in Bison: it was there when Bison
1475   was entered in the RCS version control system, in December 1987.
1477   Some grammar files might have to adjust their %expect-rr.
1479 *** Parser directives that were not careful enough
1481   Passing invalid arguments to %nterm, for instance character literals, used
1482   to result in unclear error messages.
1484 ** Documentation
1486   The examples/ directory (installed in .../share/doc/bison/examples) has
1487   been restructured per language for clarity.  The examples come with a
1488   README and a Makefile.  Not only can they be used to toy with Bison, they
1489   can also be starting points for your own grammars.
1491   There is now a Java example, and a simple example in C based on Flex and
1492   Bison (examples/c/lexcalc/).
1494 ** Changes
1496 *** Parsers in C++
1498   They now use noexcept and constexpr.  Please, report missing annotations.
1500 *** Symbol Declarations
1502   The syntax of the variation directives to declare symbols was overhauled
1503   for more consistency, and also better POSIX Yacc compliance (which, for
1504   instance, allows "%type" without actually providing a type).  The %nterm
1505   directive, supported by Bison since its inception, is now documented and
1506   officially supported.
1508   The syntax is now as follows:
1510     %token TAG? ( ID NUMBER? STRING? )+ ( TAG ( ID NUMBER? STRING? )+ )*
1511     %left  TAG? ( ID NUMBER? )+ ( TAG ( ID NUMBER? )+ )*
1512     %type  TAG? ( ID | CHAR | STRING )+ ( TAG ( ID | CHAR | STRING )+ )*
1513     %nterm TAG? ID+ ( TAG ID+ )*
1515   where TAG denotes a type tag such as ‘<ival>’, ID denotes an identifier
1516   such as ‘NUM’, NUMBER a decimal or hexadecimal integer such as ‘300’ or
1517   ‘0x12d’, CHAR a character literal such as ‘'+'’, and STRING a string
1518   literal such as ‘"number"’.  The post-fix quantifiers are ‘?’ (zero or
1519   one), ‘*’ (zero or more) and ‘+’ (one or more).
1522 * Noteworthy changes in release 3.2.4 (2018-12-24) [stable]
1524 ** Bug fixes
1526   Fix the move constructor of symbol_type.
1528   Always provide a copy constructor for symbol_type, even in modern C++.
1531 * Noteworthy changes in release 3.2.3 (2018-12-18) [stable]
1533 ** Bug fixes
1535   Properly support token constructors in C++ with types that include commas
1536   (e.g., std::pair<int, int>).  A regression introduced in Bison 3.2.
1539 * Noteworthy changes in release 3.2.2 (2018-11-21) [stable]
1541 ** Bug fixes
1543   C++ portability issues.
1546 * Noteworthy changes in release 3.2.1 (2018-11-09) [stable]
1548 ** Bug fixes
1550   Several portability issues have been fixed in the build system, in the
1551   test suite, and in the generated parsers in C++.
1554 * Noteworthy changes in release 3.2 (2018-10-29) [stable]
1556 ** Backward incompatible changes
1558   Support for DJGPP, which has been unmaintained and untested for years, is
1559   obsolete.  Unless there is activity to revive it, it will be removed.
1561 ** Changes
1563   %printers should use yyo rather than yyoutput to denote the output stream.
1565   Variant-based symbols in C++ should use emplace() rather than build().
1567   In C++ parsers, parser::operator() is now a synonym for the parser::parse.
1569 ** Documentation
1571   A new section, "A Simple C++ Example", is a tutorial for parsers in C++.
1573   A comment in the generated code now emphasizes that users should not
1574   depend upon non-documented implementation details, such as macros starting
1575   with YY_.
1577 ** New features
1579 *** C++: Support for move semantics (lalr1.cc)
1581   The lalr1.cc skeleton now fully supports C++ move semantics, while
1582   maintaining compatibility with C++98.  You may now store move-only types
1583   when using Bison's variants.  For instance:
1585     %code {
1586       #include <memory>
1587       #include <vector>
1588     }
1590     %skeleton "lalr1.cc"
1591     %define api.value.type variant
1593     %%
1595     %token <int> INT "int";
1596     %type <std::unique_ptr<int>> int;
1597     %type <std::vector<std::unique_ptr<int>>> list;
1599     list:
1600       %empty    {}
1601     | list int  { $$ = std::move($1); $$.emplace_back(std::move($2)); }
1603     int: "int"  { $$ = std::make_unique<int>($1); }
1605 *** C++: Implicit move of right-hand side values (lalr1.cc)
1607   In modern C++ (C++11 and later), you should always use 'std::move' with
1608   the values of the right-hand side symbols ($1, $2, etc.), as they will be
1609   popped from the stack anyway.  Using 'std::move' is mandatory for
1610   move-only types such as unique_ptr, and it provides a significant speedup
1611   for large types such as std::string, or std::vector, etc.
1613   If '%define api.value.automove' is set, every occurrence '$n' is replaced
1614   by 'std::move ($n)'.  The second rule in the previous grammar can be
1615   simplified to:
1617     list: list int  { $$ = $1; $$.emplace_back($2); }
1619   With automove enabled, the semantic values are no longer lvalues, so do
1620   not use the swap idiom:
1622     list: list int  { std::swap($$, $1); $$.emplace_back($2); }
1624   This idiom is anyway obsolete: it is preferable to move than to swap.
1626   A warning is issued when automove is enabled, and a value is used several
1627   times.
1629     input.yy:16.31-32: warning: multiple occurrences of $2 with api.value.automove enabled [-Wother]
1630     exp: "twice" exp   { $$ = $2 + $2; }
1631                                    ^^
1633   Enabling api.value.automove does not require support for modern C++.  The
1634   generated code is valid C++98/03, but will use copies instead of moves.
1636   The new examples/c++/variant-11.yy shows these features in action.
1638 *** C++: The implicit default semantic action is always run
1640   When variants are enabled, the default action was not run, so
1642     exp: "number"
1644   was equivalent to
1646     exp: "number"  {}
1648   It now behaves like in all the other cases, as
1650     exp: "number"  { $$ = $1; }
1652   possibly using std::move if automove is enabled.
1654   We do not expect backward compatibility issues.  However, beware of
1655   forward compatibility issues: if you rely on default actions with
1656   variants, be sure to '%require "3.2"' to avoid older versions of Bison to
1657   generate incorrect parsers.
1659 *** C++: Renaming location.hh
1661   When both %defines and %locations are enabled, Bison generates a
1662   location.hh file.  If you don't use locations outside of the parser, you
1663   may avoid its creation with:
1665     %define api.location.file none
1667   However this file is useful if, for instance, your parser builds an AST
1668   decorated with locations: you may use Bison's location independently of
1669   Bison's parser.  You can now give it another name, for instance:
1671     %define api.location.file "my-location.hh"
1673   This name can have directory components, and even be absolute.  The name
1674   under which the location file is included is controlled by
1675   api.location.include.
1677   This way it is possible to have several parsers share the same location
1678   file.
1680   For instance, in src/foo/parser.hh, generate the include/ast/loc.hh file:
1682     %locations
1683     %define api.namespace {foo}
1684     %define api.location.file "include/ast/loc.hh"
1685     %define api.location.include {<ast/loc.hh>}
1687   and use it in src/bar/parser.hh:
1689     %locations
1690     %define api.namespace {bar}
1691     %code requires {#include <ast/loc.hh>}
1692     %define api.location.type {bar::location}
1694   Absolute file names are supported, so in your Makefile, passing the flag
1695   -Dapi.location.file='"$(top_srcdir)/include/ast/location.hh"' to bison is
1696   safe.
1698 *** C++: stack.hh and position.hh are deprecated
1700   When asked to generate a header file (%defines), the lalr1.cc skeleton
1701   generates a stack.hh file.  This file had no interest for users; it is now
1702   made useless: its content is included in the parser definition.  It is
1703   still generated for backward compatibility.
1705   When in addition to %defines, location support is requested (%locations),
1706   the file position.hh is also generated.  It is now also useless: its
1707   content is now included in location.hh.
1709   These files are no longer generated when your grammar file requires at
1710   least Bison 3.2 (%require "3.2").
1712 ** Bug fixes
1714   Portability issues on MinGW and VS2015.
1716   Portability issues in the test suite.
1718   Portability/warning issues with Flex.
1721 * Noteworthy changes in release 3.1 (2018-08-27) [stable]
1723 ** Backward incompatible changes
1725   Compiling Bison now requires a C99 compiler---as announced during the
1726   release of Bison 3.0, five years ago.  Generated parsers do not require a
1727   C99 compiler.
1729   Support for DJGPP, which has been unmaintained and untested for years, is
1730   obsolete. Unless there is activity to revive it, the next release of Bison
1731   will have it removed.
1733 ** New features
1735 *** Typed midrule actions
1737   Because their type is unknown to Bison, the values of midrule actions are
1738   not treated like the others: they don't have %printer and %destructor
1739   support.  It also prevents C++ (Bison) variants to handle them properly.
1741   Typed midrule actions address these issues.  Instead of:
1743     exp: { $<ival>$ = 1; } { $<ival>$ = 2; }   { $$ = $<ival>1 + $<ival>2; }
1745   write:
1747     exp: <ival>{ $$ = 1; } <ival>{ $$ = 2; }   { $$ = $1 + $2; }
1749 *** Reports include the type of the symbols
1751   The sections about terminal and nonterminal symbols of the '*.output' file
1752   now specify their declared type.  For instance, for:
1754     %token <ival> NUM
1756   the report now shows '<ival>':
1758     Terminals, with rules where they appear
1760     NUM <ival> (258) 5
1762 *** Diagnostics about useless rules
1764   In the following grammar, the 'exp' nonterminal is trivially useless.  So,
1765   of course, its rules are useless too.
1767     %%
1768     input: '0' | exp
1769     exp: exp '+' exp | exp '-' exp | '(' exp ')'
1771   Previously all the useless rules were reported, including those whose
1772   left-hand side is the 'exp' nonterminal:
1774     warning: 1 nonterminal useless in grammar [-Wother]
1775     warning: 4 rules useless in grammar [-Wother]
1776     2.14-16: warning: nonterminal useless in grammar: exp [-Wother]
1777      input: '0' | exp
1778                   ^^^
1779     2.14-16: warning: rule useless in grammar [-Wother]
1780      input: '0' | exp
1781                   ^^^
1782     3.6-16: warning: rule useless in grammar [-Wother]
1783      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1784           ^^^^^^^^^^^
1785     3.20-30: warning: rule useless in grammar [-Wother]
1786      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1787                         ^^^^^^^^^^^
1788     3.34-44: warning: rule useless in grammar [-Wother]
1789      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1790                                       ^^^^^^^^^^^
1792   Now, rules whose left-hand side symbol is useless are no longer reported
1793   as useless.  The locations of the errors have also been adjusted to point
1794   to the first use of the nonterminal as a left-hand side of a rule:
1796     warning: 1 nonterminal useless in grammar [-Wother]
1797     warning: 4 rules useless in grammar [-Wother]
1798     3.1-3: warning: nonterminal useless in grammar: exp [-Wother]
1799      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1800      ^^^
1801     2.14-16: warning: rule useless in grammar [-Wother]
1802      input: '0' | exp
1803                   ^^^
1805 *** C++: Generated parsers can be compiled with -fno-exceptions (lalr1.cc)
1807   When compiled with exceptions disabled, the generated parsers no longer
1808   uses try/catch clauses.
1810   Currently only GCC and Clang are supported.
1812 ** Documentation
1814 *** A demonstration of variants
1816   A new example was added (installed in .../share/doc/bison/examples),
1817   'variant.yy', which shows how to use (Bison) variants in C++.
1819   The other examples were made nicer to read.
1821 *** Some features are no longer 'experimental'
1823   The following features, mature enough, are no longer flagged as
1824   experimental in the documentation: push parsers, default %printer and
1825   %destructor (typed: <*> and untyped: <>), %define api.value.type union and
1826   variant, Java parsers, XML output, LR family (lr, ielr, lalr), and
1827   semantic predicates (%?).
1829 ** Bug fixes
1831 *** GLR: Predicates support broken by #line directives
1833   Predicates (%?) in GLR such as
1835     widget:
1836       %? {new_syntax} 'w' id new_args
1837     | %?{!new_syntax} 'w' id old_args
1839   were issued with #lines in the middle of C code.
1841 *** Printer and destructor with broken #line directives
1843   The #line directives were not properly escaped when emitting the code for
1844   %printer/%destructor, which resulted in compiler errors if there are
1845   backslashes or double-quotes in the grammar file name.
1847 *** Portability on ICC
1849   The Intel compiler claims compatibility with GCC, yet rejects its _Pragma.
1850   Generated parsers now work around this.
1852 *** Various
1854   There were several small fixes in the test suite and in the build system,
1855   many warnings in bison and in the generated parsers were eliminated.  The
1856   documentation also received its share of minor improvements.
1858   Useless code was removed from C++ parsers, and some of the generated
1859   constructors are more 'natural'.
1862 * Noteworthy changes in release 3.0.5 (2018-05-27) [stable]
1864 ** Bug fixes
1866 *** C++: Fix support of 'syntax_error'
1868   One incorrect 'inline' resulted in linking errors about the constructor of
1869   the syntax_error exception.
1871 *** C++: Fix warnings
1873   GCC 7.3 (with -O1 or -O2 but not -O0 or -O3) issued null-dereference
1874   warnings about yyformat being possibly null.  It also warned about the
1875   deprecated implicit definition of copy constructors when there's a
1876   user-defined (copy) assignment operator.
1878 *** Location of errors
1880   In C++ parsers, out-of-bounds errors can happen when a rule with an empty
1881   ride-hand side raises a syntax error.  The behavior of the default parser
1882   (yacc.c) in such a condition was undefined.
1884   Now all the parsers match the behavior of glr.c: @$ is used as the
1885   location of the error.  This handles gracefully rules with and without
1886   rhs.
1888 *** Portability fixes in the test suite
1890   On some platforms, some Java and/or C++ tests were failing.
1893 * Noteworthy changes in release 3.0.4 (2015-01-23) [stable]
1895 ** Bug fixes
1897 *** C++ with Variants (lalr1.cc)
1899   Fix a compiler warning when no %destructor use $$.
1901 *** Test suites
1903   Several portability issues in tests were fixed.
1906 * Noteworthy changes in release 3.0.3 (2015-01-15) [stable]
1908 ** Bug fixes
1910 *** C++ with Variants (lalr1.cc)
1912   Problems with %destructor and '%define parse.assert' have been fixed.
1914 *** Named %union support (yacc.c, glr.c)
1916   Bison 3.0 introduced a regression on named %union such as
1918     %union foo { int ival; };
1920   The possibility to use a name was introduced "for Yacc compatibility".
1921   It is however not required by POSIX Yacc, and its usefulness is not clear.
1923 *** %define api.value.type union with %defines (yacc.c, glr.c)
1925   The C parsers were broken when %defines was used together with "%define
1926   api.value.type union".
1928 *** Redeclarations are reported in proper order
1930   On
1932     %token FOO "foo"
1933     %printer {} "foo"
1934     %printer {} FOO
1936   bison used to report:
1938     foo.yy:2.10-11: error: %printer redeclaration for FOO
1939      %printer {} "foo"
1940               ^^
1941     foo.yy:3.10-11:     previous declaration
1942      %printer {} FOO
1943               ^^
1945   Now, the "previous" declaration is always the first one.
1948 ** Documentation
1950   Bison now installs various files in its docdir (which defaults to
1951   '/usr/local/share/doc/bison'), including the three fully blown examples
1952   extracted from the documentation:
1954    - rpcalc
1955      Reverse Polish Calculator, a simple introductory example.
1956    - mfcalc
1957      Multi-function Calc, a calculator with memory and functions and located
1958      error messages.
1959    - calc++
1960      a calculator in C++ using variant support and token constructors.
1963 * Noteworthy changes in release 3.0.2 (2013-12-05) [stable]
1965 ** Bug fixes
1967 *** Generated source files when errors are reported
1969   When warnings are issued and -Werror is set, bison would still generate
1970   the source files (*.c, *.h...).  As a consequence, some runs of "make"
1971   could fail the first time, but not the second (as the files were generated
1972   anyway).
1974   This is fixed: bison no longer generates this source files, but, of
1975   course, still produces the various reports (*.output, *.xml, etc.).
1977 *** %empty is used in reports
1979   Empty right-hand sides are denoted by '%empty' in all the reports (text,
1980   dot, XML and formats derived from it).
1982 *** YYERROR and variants
1984   When C++ variant support is enabled, an error triggered via YYERROR, but
1985   not caught via error recovery, resulted in a double deletion.
1988 * Noteworthy changes in release 3.0.1 (2013-11-12) [stable]
1990 ** Bug fixes
1992 *** Errors in caret diagnostics
1994   On some platforms, some errors could result in endless diagnostics.
1996 *** Fixes of the -Werror option
1998   Options such as "-Werror -Wno-error=foo" were still turning "foo"
1999   diagnostics into errors instead of warnings.  This is fixed.
2001   Actually, for consistency with GCC, "-Wno-error=foo -Werror" now also
2002   leaves "foo" diagnostics as warnings.  Similarly, with "-Werror=foo
2003   -Wno-error", "foo" diagnostics are now errors.
2005 *** GLR Predicates
2007   As demonstrated in the documentation, one can now leave spaces between
2008   "%?" and its "{".
2010 *** Installation
2012   The yacc.1 man page is no longer installed if --disable-yacc was
2013   specified.
2015 *** Fixes in the test suite
2017   Bugs and portability issues.
2020 * Noteworthy changes in release 3.0 (2013-07-25) [stable]
2022 ** WARNING: Future backward-incompatibilities!
2024   Like other GNU packages, Bison will start using some of the C99 features
2025   for its own code, especially the definition of variables after statements.
2026   The generated C parsers still aim at C90.
2028 ** Backward incompatible changes
2030 *** Obsolete features
2032   Support for YYFAIL is removed (deprecated in Bison 2.4.2): use YYERROR.
2034   Support for yystype and yyltype is removed (deprecated in Bison 1.875):
2035   use YYSTYPE and YYLTYPE.
2037   Support for YYLEX_PARAM and YYPARSE_PARAM is removed (deprecated in Bison
2038   1.875): use %lex-param, %parse-param, or %param.
2040   Missing semicolons at the end of actions are no longer added (as announced
2041   in the release 2.5).
2043 *** Use of YACC='bison -y'
2045   TL;DR: With Autoconf <= 2.69, pass -Wno-yacc to (AM_)YFLAGS if you use
2046   Bison extensions.
2048   Traditional Yacc generates 'y.tab.c' whatever the name of the input file.
2049   Therefore Makefiles written for Yacc expect 'y.tab.c' (and possibly
2050   'y.tab.h' and 'y.output') to be generated from 'foo.y'.
2052   To this end, for ages, AC_PROG_YACC, Autoconf's macro to look for an
2053   implementation of Yacc, was using Bison as 'bison -y'.  While it does
2054   ensure compatible output file names, it also enables warnings for
2055   incompatibilities with POSIX Yacc.  In other words, 'bison -y' triggers
2056   warnings for Bison extensions.
2058   Autoconf 2.70+ fixes this incompatibility by using YACC='bison -o y.tab.c'
2059   (which also generates 'y.tab.h' and 'y.output' when needed).
2060   Alternatively, disable Yacc warnings by passing '-Wno-yacc' to your Yacc
2061   flags (YFLAGS, or AM_YFLAGS with Automake).
2063 ** Bug fixes
2065 *** The epilogue is no longer affected by internal #defines (glr.c)
2067   The glr.c skeleton uses defines such as #define yylval (yystackp->yyval) in
2068   generated code.  These weren't properly undefined before the inclusion of
2069   the user epilogue, so functions such as the following were butchered by the
2070   preprocessor expansion:
2072     int yylex (YYSTYPE *yylval);
2074   This is fixed: yylval, yynerrs, yychar, and yylloc are now valid
2075   identifiers for user-provided variables.
2077 *** stdio.h is no longer needed when locations are enabled (yacc.c)
2079   Changes in Bison 2.7 introduced a dependency on FILE and fprintf when
2080   locations are enabled.  This is fixed.
2082 *** Warnings about useless %pure-parser/%define api.pure are restored
2084 ** Diagnostics reported by Bison
2086   Most of these features were contributed by Théophile Ranquet and Victor
2087   Santet.
2089 *** Carets
2091   Version 2.7 introduced caret errors, for a prettier output.  These are now
2092   activated by default.  The old format can still be used by invoking Bison
2093   with -fno-caret (or -fnone).
2095   Some error messages that reproduced excerpts of the grammar are now using
2096   the caret information only.  For instance on:
2098     %%
2099     exp: 'a' | 'a';
2101   Bison 2.7 reports:
2103     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2104     in.y:2.12-14: warning: rule useless in parser due to conflicts: exp: 'a' [-Wother]
2106   Now bison reports:
2108     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2109     in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
2110      exp: 'a' | 'a';
2111                 ^^^
2113   and "bison -fno-caret" reports:
2115     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2116     in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
2118 *** Enhancements of the -Werror option
2120   The -Werror=CATEGORY option is now recognized, and will treat specified
2121   warnings as errors. The warnings need not have been explicitly activated
2122   using the -W option, this is similar to what GCC 4.7 does.
2124   For example, given the following command line, Bison will treat both
2125   warnings related to POSIX Yacc incompatibilities and S/R conflicts as
2126   errors (and only those):
2128     $ bison -Werror=yacc,error=conflicts-sr input.y
2130   If no categories are specified, -Werror will make all active warnings into
2131   errors. For example, the following line does the same the previous example:
2133     $ bison -Werror -Wnone -Wyacc -Wconflicts-sr input.y
2135   (By default -Wconflicts-sr,conflicts-rr,deprecated,other is enabled.)
2137   Note that the categories in this -Werror option may not be prefixed with
2138   "no-". However, -Wno-error[=CATEGORY] is valid.
2140   Note that -y enables -Werror=yacc. Therefore it is now possible to require
2141   Yacc-like behavior (e.g., always generate y.tab.c), but to report
2142   incompatibilities as warnings: "-y -Wno-error=yacc".
2144 *** The display of warnings is now richer
2146   The option that controls a given warning is now displayed:
2148     foo.y:4.6: warning: type clash on default action: <foo> != <bar> [-Wother]
2150   In the case of warnings treated as errors, the prefix is changed from
2151   "warning: " to "error: ", and the suffix is displayed, in a manner similar
2152   to GCC, as [-Werror=CATEGORY].
2154   For instance, where the previous version of Bison would report (and exit
2155   with failure):
2157     bison: warnings being treated as errors
2158     input.y:1.1: warning: stray ',' treated as white space
2160   it now reports:
2162     input.y:1.1: error: stray ',' treated as white space [-Werror=other]
2164 *** Deprecated constructs
2166   The new 'deprecated' warning category flags obsolete constructs whose
2167   support will be discontinued.  It is enabled by default.  These warnings
2168   used to be reported as 'other' warnings.
2170 *** Useless semantic types
2172   Bison now warns about useless (uninhabited) semantic types.  Since
2173   semantic types are not declared to Bison (they are defined in the opaque
2174   %union structure), it is %printer/%destructor directives about useless
2175   types that trigger the warning:
2177     %token <type1> term
2178     %type  <type2> nterm
2179     %printer    {} <type1> <type3>
2180     %destructor {} <type2> <type4>
2181     %%
2182     nterm: term { $$ = $1; };
2184     3.28-34: warning: type <type3> is used, but is not associated to any symbol
2185     4.28-34: warning: type <type4> is used, but is not associated to any symbol
2187 *** Undefined but unused symbols
2189   Bison used to raise an error for undefined symbols that are not used in
2190   the grammar.  This is now only a warning.
2192     %printer    {} symbol1
2193     %destructor {} symbol2
2194     %type <type>   symbol3
2195     %%
2196     exp: "a";
2198 *** Useless destructors or printers
2200   Bison now warns about useless destructors or printers.  In the following
2201   example, the printer for <type1>, and the destructor for <type2> are
2202   useless: all symbols of <type1> (token1) already have a printer, and all
2203   symbols of type <type2> (token2) already have a destructor.
2205     %token <type1> token1
2206            <type2> token2
2207            <type3> token3
2208            <type4> token4
2209     %printer    {} token1 <type1> <type3>
2210     %destructor {} token2 <type2> <type4>
2212 *** Conflicts
2214   The warnings and error messages about shift/reduce and reduce/reduce
2215   conflicts have been normalized.  For instance on the following foo.y file:
2217     %glr-parser
2218     %%
2219     exp: exp '+' exp | '0' | '0';
2221   compare the previous version of bison:
2223     $ bison foo.y
2224     foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2225     $ bison -Werror foo.y
2226     bison: warnings being treated as errors
2227     foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2229   with the new behavior:
2231     $ bison foo.y
2232     foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
2233     foo.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
2234     $ bison -Werror foo.y
2235     foo.y: error: 1 shift/reduce conflict [-Werror=conflicts-sr]
2236     foo.y: error: 2 reduce/reduce conflicts [-Werror=conflicts-rr]
2238   When %expect or %expect-rr is used, such as with bar.y:
2240     %expect 0
2241     %glr-parser
2242     %%
2243     exp: exp '+' exp | '0' | '0';
2245   Former behavior:
2247     $ bison bar.y
2248     bar.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2249     bar.y: expected 0 shift/reduce conflicts
2250     bar.y: expected 0 reduce/reduce conflicts
2252   New one:
2254     $ bison bar.y
2255     bar.y: error: shift/reduce conflicts: 1 found, 0 expected
2256     bar.y: error: reduce/reduce conflicts: 2 found, 0 expected
2258 ** Incompatibilities with POSIX Yacc
2260   The 'yacc' category is no longer part of '-Wall', enable it explicitly
2261   with '-Wyacc'.
2263 ** Additional yylex/yyparse arguments
2265   The new directive %param declares additional arguments to both yylex and
2266   yyparse.  The %lex-param, %parse-param, and %param directives support one
2267   or more arguments.  Instead of
2269     %lex-param   {arg1_type *arg1}
2270     %lex-param   {arg2_type *arg2}
2271     %parse-param {arg1_type *arg1}
2272     %parse-param {arg2_type *arg2}
2274   one may now declare
2276     %param {arg1_type *arg1} {arg2_type *arg2}
2278 ** Types of values for %define variables
2280   Bison used to make no difference between '%define foo bar' and '%define
2281   foo "bar"'.  The former is now called a 'keyword value', and the latter a
2282   'string value'.  A third kind was added: 'code values', such as '%define
2283   foo {bar}'.
2285   Keyword variables are used for fixed value sets, e.g.,
2287     %define lr.type lalr
2289   Code variables are used for value in the target language, e.g.,
2291     %define api.value.type {struct semantic_type}
2293   String variables are used remaining cases, e.g. file names.
2295 ** Variable api.token.prefix
2297   The variable api.token.prefix changes the way tokens are identified in
2298   the generated files.  This is especially useful to avoid collisions
2299   with identifiers in the target language.  For instance
2301     %token FILE for ERROR
2302     %define api.token.prefix {TOK_}
2303     %%
2304     start: FILE for ERROR;
2306   will generate the definition of the symbols TOK_FILE, TOK_for, and
2307   TOK_ERROR in the generated sources.  In particular, the scanner must
2308   use these prefixed token names, although the grammar itself still
2309   uses the short names (as in the sample rule given above).
2311 ** Variable api.value.type
2313   This new %define variable supersedes the #define macro YYSTYPE.  The use
2314   of YYSTYPE is discouraged.  In particular, #defining YYSTYPE *and* either
2315   using %union or %defining api.value.type results in undefined behavior.
2317   Either define api.value.type, or use "%union":
2319     %union
2320     {
2321       int ival;
2322       char *sval;
2323     }
2324     %token <ival> INT "integer"
2325     %token <sval> STRING "string"
2326     %printer { fprintf (yyo, "%d", $$); } <ival>
2327     %destructor { free ($$); } <sval>
2329     /* In yylex().  */
2330     yylval.ival = 42; return INT;
2331     yylval.sval = "42"; return STRING;
2333   The %define variable api.value.type supports both keyword and code values.
2335   The keyword value 'union' means that the user provides genuine types, not
2336   union member names such as "ival" and "sval" above (WARNING: will fail if
2337   -y/--yacc/%yacc is enabled).
2339     %define api.value.type union
2340     %token <int> INT "integer"
2341     %token <char *> STRING "string"
2342     %printer { fprintf (yyo, "%d", $$); } <int>
2343     %destructor { free ($$); } <char *>
2345     /* In yylex().  */
2346     yylval.INT = 42; return INT;
2347     yylval.STRING = "42"; return STRING;
2349   The keyword value variant is somewhat equivalent, but for C++ special
2350   provision is made to allow classes to be used (more about this below).
2352     %define api.value.type variant
2353     %token <int> INT "integer"
2354     %token <std::string> STRING "string"
2356   Code values (in braces) denote user defined types.  This is where YYSTYPE
2357   used to be used.
2359     %code requires
2360     {
2361       struct my_value
2362       {
2363         enum
2364         {
2365           is_int, is_string
2366         } kind;
2367         union
2368         {
2369           int ival;
2370           char *sval;
2371         } u;
2372       };
2373     }
2374     %define api.value.type {struct my_value}
2375     %token <u.ival> INT "integer"
2376     %token <u.sval> STRING "string"
2377     %printer { fprintf (yyo, "%d", $$); } <u.ival>
2378     %destructor { free ($$); } <u.sval>
2380     /* In yylex().  */
2381     yylval.u.ival = 42; return INT;
2382     yylval.u.sval = "42"; return STRING;
2384 ** Variable parse.error
2386   This variable controls the verbosity of error messages.  The use of the
2387   %error-verbose directive is deprecated in favor of "%define parse.error
2388   verbose".
2390 ** Deprecated %define variable names
2392   The following variables have been renamed for consistency.  Backward
2393   compatibility is ensured, but upgrading is recommended.
2395     lr.default-reductions      -> lr.default-reduction
2396     lr.keep-unreachable-states -> lr.keep-unreachable-state
2397     namespace                  -> api.namespace
2398     stype                      -> api.value.type
2400 ** Semantic predicates
2402   Contributed by Paul Hilfinger.
2404   The new, experimental, semantic-predicate feature allows actions of the
2405   form "%?{ BOOLEAN-EXPRESSION }", which cause syntax errors (as for
2406   YYERROR) if the expression evaluates to 0, and are evaluated immediately
2407   in GLR parsers, rather than being deferred.  The result is that they allow
2408   the programmer to prune possible parses based on the values of run-time
2409   expressions.
2411 ** The directive %expect-rr is now an error in non GLR mode
2413   It used to be an error only if used in non GLR mode, _and_ if there are
2414   reduce/reduce conflicts.
2416 ** Tokens are numbered in their order of appearance
2418   Contributed by Valentin Tolmer.
2420   With '%token A B', A had a number less than the one of B.  However,
2421   precedence declarations used to generate a reversed order.  This is now
2422   fixed, and introducing tokens with any of %token, %left, %right,
2423   %precedence, or %nonassoc yields the same result.
2425   When mixing declarations of tokens with a literal character (e.g., 'a') or
2426   with an identifier (e.g., B) in a precedence declaration, Bison numbered
2427   the literal characters first.  For example
2429     %right A B 'c' 'd'
2431   would lead to the tokens declared in this order: 'c' 'd' A B.  Again, the
2432   input order is now preserved.
2434   These changes were made so that one can remove useless precedence and
2435   associativity declarations (i.e., map %nonassoc, %left or %right to
2436   %precedence, or to %token) and get exactly the same output.
2438 ** Useless precedence and associativity
2440   Contributed by Valentin Tolmer.
2442   When developing and maintaining a grammar, useless associativity and
2443   precedence directives are common.  They can be a nuisance: new ambiguities
2444   arising are sometimes masked because their conflicts are resolved due to
2445   the extra precedence or associativity information.  Furthermore, it can
2446   hinder the comprehension of a new grammar: one will wonder about the role
2447   of a precedence, where in fact it is useless.  The following changes aim
2448   at detecting and reporting these extra directives.
2450 *** Precedence warning category
2452   A new category of warning, -Wprecedence, was introduced. It flags the
2453   useless precedence and associativity directives.
2455 *** Useless associativity
2457   Bison now warns about symbols with a declared associativity that is never
2458   used to resolve conflicts.  In that case, using %precedence is sufficient;
2459   the parsing tables will remain unchanged.  Solving these warnings may raise
2460   useless precedence warnings, as the symbols no longer have associativity.
2461   For example:
2463     %left '+'
2464     %left '*'
2465     %%
2466     exp:
2467       "number"
2468     | exp '+' "number"
2469     | exp '*' exp
2470     ;
2472   will produce a
2474     warning: useless associativity for '+', use %precedence [-Wprecedence]
2475      %left '+'
2476            ^^^
2478 *** Useless precedence
2480   Bison now warns about symbols with a declared precedence and no declared
2481   associativity (i.e., declared with %precedence), and whose precedence is
2482   never used.  In that case, the symbol can be safely declared with %token
2483   instead, without modifying the parsing tables.  For example:
2485     %precedence '='
2486     %%
2487     exp: "var" '=' "number";
2489   will produce a
2491     warning: useless precedence for '=' [-Wprecedence]
2492      %precedence '='
2493                  ^^^
2495 *** Useless precedence and associativity
2497   In case of both useless precedence and associativity, the issue is flagged
2498   as follows:
2500     %nonassoc '='
2501     %%
2502     exp: "var" '=' "number";
2504   The warning is:
2506     warning: useless precedence and associativity for '=' [-Wprecedence]
2507      %nonassoc '='
2508                ^^^
2510 ** Empty rules
2512   With help from Joel E. Denny and Gabriel Rassoul.
2514   Empty rules (i.e., with an empty right-hand side) can now be explicitly
2515   marked by the new %empty directive.  Using %empty on a non-empty rule is
2516   an error.  The new -Wempty-rule warning reports empty rules without
2517   %empty.  On the following grammar:
2519     %%
2520     s: a b c;
2521     a: ;
2522     b: %empty;
2523     c: 'a' %empty;
2525   bison reports:
2527     3.4-5: warning: empty rule without %empty [-Wempty-rule]
2528      a: {}
2529         ^^
2530     5.8-13: error: %empty on non-empty rule
2531      c: 'a' %empty {};
2532             ^^^^^^
2534 ** Java skeleton improvements
2536   The constants for token names were moved to the Lexer interface.  Also, it
2537   is possible to add code to the parser's constructors using "%code init"
2538   and "%define init_throws".
2539   Contributed by Paolo Bonzini.
2541   The Java skeleton now supports push parsing.
2542   Contributed by Dennis Heimbigner.
2544 ** C++ skeletons improvements
2546 *** The parser header is no longer mandatory (lalr1.cc, glr.cc)
2548   Using %defines is now optional.  Without it, the needed support classes
2549   are defined in the generated parser, instead of additional files (such as
2550   location.hh, position.hh and stack.hh).
2552 *** Locations are no longer mandatory (lalr1.cc, glr.cc)
2554   Both lalr1.cc and glr.cc no longer require %location.
2556 *** syntax_error exception (lalr1.cc)
2558   The C++ parser features a syntax_error exception, which can be
2559   thrown from the scanner or from user rules to raise syntax errors.
2560   This facilitates reporting errors caught in sub-functions (e.g.,
2561   rejecting too large integral literals from a conversion function
2562   used by the scanner, or rejecting invalid combinations from a
2563   factory invoked by the user actions).
2565 *** %define api.value.type variant
2567   This is based on a submission from Michiel De Wilde.  With help
2568   from Théophile Ranquet.
2570   In this mode, complex C++ objects can be used as semantic values.  For
2571   instance:
2573     %token <::std::string> TEXT;
2574     %token <int> NUMBER;
2575     %token SEMICOLON ";"
2576     %type <::std::string> item;
2577     %type <::std::list<std::string>> list;
2578     %%
2579     result:
2580       list  { std::cout << $1 << std::endl; }
2581     ;
2583     list:
2584       %empty        { /* Generates an empty string list. */ }
2585     | list item ";" { std::swap ($$, $1); $$.push_back ($2); }
2586     ;
2588     item:
2589       TEXT    { std::swap ($$, $1); }
2590     | NUMBER  { $$ = string_cast ($1); }
2591     ;
2593 *** %define api.token.constructor
2595   When variants are enabled, Bison can generate functions to build the
2596   tokens.  This guarantees that the token type (e.g., NUMBER) is consistent
2597   with the semantic value (e.g., int):
2599     parser::symbol_type yylex ()
2600     {
2601       parser::location_type loc = ...;
2602       ...
2603       return parser::make_TEXT ("Hello, world!", loc);
2604       ...
2605       return parser::make_NUMBER (42, loc);
2606       ...
2607       return parser::make_SEMICOLON (loc);
2608       ...
2609     }
2611 *** C++ locations
2613   There are operator- and operator-= for 'location'.  Negative line/column
2614   increments can no longer underflow the resulting value.
2617 * Noteworthy changes in release 2.7.1 (2013-04-15) [stable]
2619 ** Bug fixes
2621 *** Fix compiler attribute portability (yacc.c)
2623   With locations enabled, __attribute__ was used unprotected.
2625 *** Fix some compiler warnings (lalr1.cc)
2628 * Noteworthy changes in release 2.7 (2012-12-12) [stable]
2630 ** Bug fixes
2632   Warnings about uninitialized yylloc in yyparse have been fixed.
2634   Restored C90 compliance (yet no report was ever made).
2636 ** Diagnostics are improved
2638   Contributed by Théophile Ranquet.
2640 *** Changes in the format of error messages
2642   This used to be the format of many error reports:
2644     input.y:2.7-12: %type redeclaration for exp
2645     input.y:1.7-12: previous declaration
2647   It is now:
2649     input.y:2.7-12: error: %type redeclaration for exp
2650     input.y:1.7-12:     previous declaration
2652 *** New format for error reports: carets
2654   Caret errors have been added to Bison:
2656     input.y:2.7-12: error: %type redeclaration for exp
2657      %type <sval> exp
2658            ^^^^^^
2659     input.y:1.7-12:     previous declaration
2660      %type <ival> exp
2661            ^^^^^^
2663   or
2665     input.y:3.20-23: error: ambiguous reference: '$exp'
2666      exp: exp '+' exp { $exp = $1 + $3; };
2667                         ^^^^
2668     input.y:3.1-3:       refers to: $exp at $$
2669      exp: exp '+' exp { $exp = $1 + $3; };
2670      ^^^
2671     input.y:3.6-8:       refers to: $exp at $1
2672      exp: exp '+' exp { $exp = $1 + $3; };
2673           ^^^
2674     input.y:3.14-16:     refers to: $exp at $3
2675      exp: exp '+' exp { $exp = $1 + $3; };
2676                   ^^^
2678   The default behavior for now is still not to display these unless
2679   explicitly asked with -fcaret (or -fall). However, in a later release, it
2680   will be made the default behavior (but may still be deactivated with
2681   -fno-caret).
2683 ** New value for %define variable: api.pure full
2685   The %define variable api.pure requests a pure (reentrant) parser. However,
2686   for historical reasons, using it in a location-tracking Yacc parser
2687   resulted in a yyerror function that did not take a location as a
2688   parameter. With this new value, the user may request a better pure parser,
2689   where yyerror does take a location as a parameter (in location-tracking
2690   parsers).
2692   The use of "%define api.pure true" is deprecated in favor of this new
2693   "%define api.pure full".
2695 ** New %define variable: api.location.type (glr.cc, lalr1.cc, lalr1.java)
2697   The %define variable api.location.type defines the name of the type to use
2698   for locations.  When defined, Bison no longer generates the position.hh
2699   and location.hh files, nor does the parser will include them: the user is
2700   then responsible to define her type.
2702   This can be used in programs with several parsers to factor their location
2703   and position files: let one of them generate them, and the others just use
2704   them.
2706   This feature was actually introduced, but not documented, in Bison 2.5,
2707   under the name "location_type" (which is maintained for backward
2708   compatibility).
2710   For consistency, lalr1.java's %define variables location_type and
2711   position_type are deprecated in favor of api.location.type and
2712   api.position.type.
2714 ** Exception safety (lalr1.cc)
2716   The parse function now catches exceptions, uses the %destructors to
2717   release memory (the lookahead symbol and the symbols pushed on the stack)
2718   before re-throwing the exception.
2720   This feature is somewhat experimental.  User feedback would be
2721   appreciated.
2723 ** Graph improvements in DOT and XSLT
2725   Contributed by Théophile Ranquet.
2727   The graphical presentation of the states is more readable: their shape is
2728   now rectangular, the state number is clearly displayed, and the items are
2729   numbered and left-justified.
2731   The reductions are now explicitly represented as transitions to other
2732   diamond shaped nodes.
2734   These changes are present in both --graph output and xml2dot.xsl XSLT
2735   processing, with minor (documented) differences.
2737 ** %language is no longer an experimental feature.
2739   The introduction of this feature, in 2.4, was four years ago. The
2740   --language option and the %language directive are no longer experimental.
2742 ** Documentation
2744   The sections about shift/reduce and reduce/reduce conflicts resolution
2745   have been fixed and extended.
2747   Although introduced more than four years ago, XML and Graphviz reports
2748   were not properly documented.
2750   The translation of midrule actions is now described.
2753 * Noteworthy changes in release 2.6.5 (2012-11-07) [stable]
2755   We consider compiler warnings about Bison generated parsers to be bugs.
2756   Rather than working around them in your own project, please consider
2757   reporting them to us.
2759 ** Bug fixes
2761   Warnings about uninitialized yylval and/or yylloc for push parsers with a
2762   pure interface have been fixed for GCC 4.0 up to 4.8, and Clang 2.9 to
2763   3.2.
2765   Other issues in the test suite have been addressed.
2767   Null characters are correctly displayed in error messages.
2769   When possible, yylloc is correctly initialized before calling yylex.  It
2770   is no longer necessary to initialize it in the %initial-action.
2773 * Noteworthy changes in release 2.6.4 (2012-10-23) [stable]
2775   Bison 2.6.3's --version was incorrect.  This release fixes this issue.
2778 * Noteworthy changes in release 2.6.3 (2012-10-22) [stable]
2780 ** Bug fixes
2782   Bugs and portability issues in the test suite have been fixed.
2784   Some errors in translations have been addressed, and --help now directs
2785   users to the appropriate place to report them.
2787   Stray Info files shipped by accident are removed.
2789   Incorrect definitions of YY_, issued by yacc.c when no parser header is
2790   generated, are removed.
2792   All the generated headers are self-contained.
2794 ** Header guards (yacc.c, glr.c, glr.cc)
2796   In order to avoid collisions, the header guards are now
2797   YY_<PREFIX>_<FILE>_INCLUDED, instead of merely <PREFIX>_<FILE>.
2798   For instance the header generated from
2800     %define api.prefix "calc"
2801     %defines "lib/parse.h"
2803   will use YY_CALC_LIB_PARSE_H_INCLUDED as guard.
2805 ** Fix compiler warnings in the generated parser (yacc.c, glr.c)
2807   The compilation of pure parsers (%define api.pure) can trigger GCC
2808   warnings such as:
2810     input.c: In function 'yyparse':
2811     input.c:1503:12: warning: 'yylval' may be used uninitialized in this
2812                               function [-Wmaybe-uninitialized]
2813        *++yyvsp = yylval;
2814                 ^
2816   This is now fixed; pragmas to avoid these warnings are no longer needed.
2818   Warnings from clang ("equality comparison with extraneous parentheses" and
2819   "function declared 'noreturn' should not return") have also been
2820   addressed.
2823 * Noteworthy changes in release 2.6.2 (2012-08-03) [stable]
2825 ** Bug fixes
2827   Buffer overruns, complaints from Flex, and portability issues in the test
2828   suite have been fixed.
2830 ** Spaces in %lex- and %parse-param (lalr1.cc, glr.cc)
2832   Trailing end-of-lines in %parse-param or %lex-param would result in
2833   invalid C++.  This is fixed.
2835 ** Spurious spaces and end-of-lines
2837   The generated files no longer end (nor start) with empty lines.
2840 * Noteworthy changes in release 2.6.1 (2012-07-30) [stable]
2842  Bison no longer executes user-specified M4 code when processing a grammar.
2844 ** Future Changes
2846   In addition to the removal of the features announced in Bison 2.6, the
2847   next major release will remove the "Temporary hack for adding a semicolon
2848   to the user action", as announced in the release 2.5.  Instead of:
2850     exp: exp "+" exp { $$ = $1 + $3 };
2852   write:
2854     exp: exp "+" exp { $$ = $1 + $3; };
2856 ** Bug fixes
2858 *** Type names are now properly escaped.
2860 *** glr.cc: set_debug_level and debug_level work as expected.
2862 *** Stray @ or $ in actions
2864   While Bison used to warn about stray $ or @ in action rules, it did not
2865   for other actions such as printers, destructors, or initial actions.  It
2866   now does.
2868 ** Type names in actions
2870   For consistency with rule actions, it is now possible to qualify $$ by a
2871   type-name in destructors, printers, and initial actions.  For instance:
2873     %printer { fprintf (yyo, "(%d, %f)", $<ival>$, $<fval>$); } <*> <>;
2875   will display two values for each typed and untyped symbol (provided
2876   that YYSTYPE has both "ival" and "fval" fields).
2879 * Noteworthy changes in release 2.6 (2012-07-19) [stable]
2881 ** Future changes
2883   The next major release of Bison will drop support for the following
2884   deprecated features.  Please report disagreements to bug-bison@gnu.org.
2886 *** K&R C parsers
2888   Support for generating parsers in K&R C will be removed.  Parsers
2889   generated for C support ISO C90, and are tested with ISO C99 and ISO C11
2890   compilers.
2892 *** Features deprecated since Bison 1.875
2894   The definitions of yystype and yyltype will be removed; use YYSTYPE and
2895   YYLTYPE.
2897   YYPARSE_PARAM and YYLEX_PARAM, deprecated in favor of %parse-param and
2898   %lex-param, will no longer be supported.
2900   Support for the preprocessor symbol YYERROR_VERBOSE will be removed, use
2901   %error-verbose.
2903 *** The generated header will be included (yacc.c)
2905   Instead of duplicating the content of the generated header (definition of
2906   YYSTYPE, yyparse declaration etc.), the generated parser will include it,
2907   as is already the case for GLR or C++ parsers.  This change is deferred
2908   because existing versions of ylwrap (e.g., Automake 1.12.1) do not support
2909   it.
2911 ** Generated Parser Headers
2913 *** Guards (yacc.c, glr.c, glr.cc)
2915   The generated headers are now guarded, as is already the case for C++
2916   parsers (lalr1.cc).  For instance, with --defines=foo.h:
2918     #ifndef YY_FOO_H
2919     # define YY_FOO_H
2920     ...
2921     #endif /* !YY_FOO_H  */
2923 *** New declarations (yacc.c, glr.c)
2925   The generated header now declares yydebug and yyparse.  Both honor
2926   --name-prefix=bar_, and yield
2928     int bar_parse (void);
2930   rather than
2932     #define yyparse bar_parse
2933     int yyparse (void);
2935   in order to facilitate the inclusion of several parser headers inside a
2936   single compilation unit.
2938 *** Exported symbols in C++
2940   The symbols YYTOKEN_TABLE and YYERROR_VERBOSE, which were defined in the
2941   header, are removed, as they prevent the possibility of including several
2942   generated headers from a single compilation unit.
2944 *** YYLSP_NEEDED
2946   For the same reasons, the undocumented and unused macro YYLSP_NEEDED is no
2947   longer defined.
2949 ** New %define variable: api.prefix
2951   Now that the generated headers are more complete and properly protected
2952   against multiple inclusions, constant names, such as YYSTYPE are a
2953   problem.  While yyparse and others are properly renamed by %name-prefix,
2954   YYSTYPE, YYDEBUG and others have never been affected by it.  Because it
2955   would introduce backward compatibility issues in projects not expecting
2956   YYSTYPE to be renamed, instead of changing the behavior of %name-prefix,
2957   it is deprecated in favor of a new %define variable: api.prefix.
2959   The following examples compares both:
2961     %name-prefix "bar_"               | %define api.prefix "bar_"
2962     %token <ival> FOO                   %token <ival> FOO
2963     %union { int ival; }                %union { int ival; }
2964     %%                                  %%
2965     exp: 'a';                           exp: 'a';
2967   bison generates:
2969     #ifndef BAR_FOO_H                   #ifndef BAR_FOO_H
2970     # define BAR_FOO_H                  # define BAR_FOO_H
2972     /* Enabling traces.  */             /* Enabling traces.  */
2973     # ifndef YYDEBUG                  | # ifndef BAR_DEBUG
2974                                       > #  if defined YYDEBUG
2975                                       > #   if YYDEBUG
2976                                       > #    define BAR_DEBUG 1
2977                                       > #   else
2978                                       > #    define BAR_DEBUG 0
2979                                       > #   endif
2980                                       > #  else
2981     #  define YYDEBUG 0               | #   define BAR_DEBUG 0
2982                                       > #  endif
2983     # endif                           | # endif
2985     # if YYDEBUG                      | # if BAR_DEBUG
2986     extern int bar_debug;               extern int bar_debug;
2987     # endif                             # endif
2989     /* Tokens.  */                      /* Tokens.  */
2990     # ifndef YYTOKENTYPE              | # ifndef BAR_TOKENTYPE
2991     #  define YYTOKENTYPE             | #  define BAR_TOKENTYPE
2992        enum yytokentype {             |    enum bar_tokentype {
2993          FOO = 258                           FOO = 258
2994        };                                  };
2995     # endif                             # endif
2997     #if ! defined YYSTYPE \           | #if ! defined BAR_STYPE \
2998      && ! defined YYSTYPE_IS_DECLARED |  && ! defined BAR_STYPE_IS_DECLARED
2999     typedef union YYSTYPE             | typedef union BAR_STYPE
3000     {                                   {
3001      int ival;                           int ival;
3002     } YYSTYPE;                        | } BAR_STYPE;
3003     # define YYSTYPE_IS_DECLARED 1    | # define BAR_STYPE_IS_DECLARED 1
3004     #endif                              #endif
3006     extern YYSTYPE bar_lval;          | extern BAR_STYPE bar_lval;
3008     int bar_parse (void);               int bar_parse (void);
3010     #endif /* !BAR_FOO_H  */            #endif /* !BAR_FOO_H  */
3013 * Noteworthy changes in release 2.5.1 (2012-06-05) [stable]
3015 ** Future changes:
3017   The next major release will drop support for generating parsers in K&R C.
3019 ** yacc.c: YYBACKUP works as expected.
3021 ** glr.c improvements:
3023 *** Location support is eliminated when not requested:
3025   GLR parsers used to include location-related code even when locations were
3026   not requested, and therefore not even usable.
3028 *** __attribute__ is preserved:
3030   __attribute__ is no longer disabled when __STRICT_ANSI__ is defined (i.e.,
3031   when -std is passed to GCC).
3033 ** lalr1.java: several fixes:
3035   The Java parser no longer throws ArrayIndexOutOfBoundsException if the
3036   first token leads to a syntax error.  Some minor clean ups.
3038 ** Changes for C++:
3040 *** C++11 compatibility:
3042   C and C++ parsers use "nullptr" instead of "0" when __cplusplus is 201103L
3043   or higher.
3045 *** Header guards
3047   The header files such as "parser.hh", "location.hh", etc. used a constant
3048   name for preprocessor guards, for instance:
3050     #ifndef BISON_LOCATION_HH
3051     # define BISON_LOCATION_HH
3052     ...
3053     #endif // !BISON_LOCATION_HH
3055   The inclusion guard is now computed from "PREFIX/FILE-NAME", where lower
3056   case characters are converted to upper case, and series of
3057   non-alphanumerical characters are converted to an underscore.
3059   With "bison -o lang++/parser.cc", "location.hh" would now include:
3061     #ifndef YY_LANG_LOCATION_HH
3062     # define YY_LANG_LOCATION_HH
3063     ...
3064     #endif // !YY_LANG_LOCATION_HH
3066 *** C++ locations:
3068   The position and location constructors (and their initialize methods)
3069   accept new arguments for line and column.  Several issues in the
3070   documentation were fixed.
3072 ** liby is no longer asking for "rpl_fprintf" on some platforms.
3074 ** Changes in the manual:
3076 *** %printer is documented
3078   The "%printer" directive, supported since at least Bison 1.50, is finally
3079   documented.  The "mfcalc" example is extended to demonstrate it.
3081   For consistency with the C skeletons, the C++ parsers now also support
3082   "yyoutput" (as an alias to "debug_stream ()").
3084 *** Several improvements have been made:
3086   The layout for grammar excerpts was changed to a more compact scheme.
3087   Named references are motivated.  The description of the automaton
3088   description file (*.output) is updated to the current format.  Incorrect
3089   index entries were fixed.  Some other errors were fixed.
3091 ** Building bison:
3093 *** Conflicting prototypes with recent/modified Flex.
3095   Fixed build problems with the current, unreleased, version of Flex, and
3096   some modified versions of 2.5.35, which have modified function prototypes.
3098 *** Warnings during the build procedure have been eliminated.
3100 *** Several portability problems in the test suite have been fixed:
3102   This includes warnings with some compilers, unexpected behavior of tools
3103   such as diff, warning messages from the test suite itself, etc.
3105 *** The install-pdf target works properly:
3107   Running "make install-pdf" (or -dvi, -html, -info, and -ps) no longer
3108   halts in the middle of its course.
3111 * Noteworthy changes in release 2.5 (2011-05-14)
3113 ** Grammar symbol names can now contain non-initial dashes:
3115   Consistently with directives (such as %error-verbose) and with
3116   %define variables (e.g. push-pull), grammar symbol names may contain
3117   dashes in any position except the beginning.  This is a GNU
3118   extension over POSIX Yacc.  Thus, use of this extension is reported
3119   by -Wyacc and rejected in Yacc mode (--yacc).
3121 ** Named references:
3123   Historically, Yacc and Bison have supported positional references
3124   ($n, $$) to allow access to symbol values from inside of semantic
3125   actions code.
3127   Starting from this version, Bison can also accept named references.
3128   When no ambiguity is possible, original symbol names may be used
3129   as named references:
3131     if_stmt : "if" cond_expr "then" then_stmt ';'
3132     { $if_stmt = mk_if_stmt($cond_expr, $then_stmt); }
3134   In the more common case, explicit names may be declared:
3136     stmt[res] : "if" expr[cond] "then" stmt[then] "else" stmt[else] ';'
3137     { $res = mk_if_stmt($cond, $then, $else); }
3139   Location information is also accessible using @name syntax.  When
3140   accessing symbol names containing dots or dashes, explicit bracketing
3141   ($[sym.1]) must be used.
3143   These features are experimental in this version.  More user feedback
3144   will help to stabilize them.
3145   Contributed by Alex Rozenman.
3147 ** IELR(1) and canonical LR(1):
3149   IELR(1) is a minimal LR(1) parser table generation algorithm.  That
3150   is, given any context-free grammar, IELR(1) generates parser tables
3151   with the full language-recognition power of canonical LR(1) but with
3152   nearly the same number of parser states as LALR(1).  This reduction
3153   in parser states is often an order of magnitude.  More importantly,
3154   because canonical LR(1)'s extra parser states may contain duplicate
3155   conflicts in the case of non-LR(1) grammars, the number of conflicts
3156   for IELR(1) is often an order of magnitude less as well.  This can
3157   significantly reduce the complexity of developing of a grammar.
3159   Bison can now generate IELR(1) and canonical LR(1) parser tables in
3160   place of its traditional LALR(1) parser tables, which remain the
3161   default.  You can specify the type of parser tables in the grammar
3162   file with these directives:
3164     %define lr.type lalr
3165     %define lr.type ielr
3166     %define lr.type canonical-lr
3168   The default-reduction optimization in the parser tables can also be
3169   adjusted using "%define lr.default-reductions".  For details on both
3170   of these features, see the new section "Tuning LR" in the Bison
3171   manual.
3173   These features are experimental.  More user feedback will help to
3174   stabilize them.
3176 ** LAC (Lookahead Correction) for syntax error handling
3178   Contributed by Joel E. Denny.
3180   Canonical LR, IELR, and LALR can suffer from a couple of problems
3181   upon encountering a syntax error.  First, the parser might perform
3182   additional parser stack reductions before discovering the syntax
3183   error.  Such reductions can perform user semantic actions that are
3184   unexpected because they are based on an invalid token, and they
3185   cause error recovery to begin in a different syntactic context than
3186   the one in which the invalid token was encountered.  Second, when
3187   verbose error messages are enabled (with %error-verbose or the
3188   obsolete "#define YYERROR_VERBOSE"), the expected token list in the
3189   syntax error message can both contain invalid tokens and omit valid
3190   tokens.
3192   The culprits for the above problems are %nonassoc, default
3193   reductions in inconsistent states, and parser state merging.  Thus,
3194   IELR and LALR suffer the most.  Canonical LR can suffer only if
3195   %nonassoc is used or if default reductions are enabled for
3196   inconsistent states.
3198   LAC is a new mechanism within the parsing algorithm that solves
3199   these problems for canonical LR, IELR, and LALR without sacrificing
3200   %nonassoc, default reductions, or state merging.  When LAC is in
3201   use, canonical LR and IELR behave almost exactly the same for both
3202   syntactically acceptable and syntactically unacceptable input.
3203   While LALR still does not support the full language-recognition
3204   power of canonical LR and IELR, LAC at least enables LALR's syntax
3205   error handling to correctly reflect LALR's language-recognition
3206   power.
3208   Currently, LAC is only supported for deterministic parsers in C.
3209   You can enable LAC with the following directive:
3211     %define parse.lac full
3213   See the new section "LAC" in the Bison manual for additional
3214   details including a few caveats.
3216   LAC is an experimental feature.  More user feedback will help to
3217   stabilize it.
3219 ** %define improvements:
3221 *** Can now be invoked via the command line:
3223   Each of these command-line options
3225     -D NAME[=VALUE]
3226     --define=NAME[=VALUE]
3228     -F NAME[=VALUE]
3229     --force-define=NAME[=VALUE]
3231   is equivalent to this grammar file declaration
3233     %define NAME ["VALUE"]
3235   except that the manner in which Bison processes multiple definitions
3236   for the same NAME differs.  Most importantly, -F and --force-define
3237   quietly override %define, but -D and --define do not.  For further
3238   details, see the section "Bison Options" in the Bison manual.
3240 *** Variables renamed:
3242   The following %define variables
3244     api.push_pull
3245     lr.keep_unreachable_states
3247   have been renamed to
3249     api.push-pull
3250     lr.keep-unreachable-states
3252   The old names are now deprecated but will be maintained indefinitely
3253   for backward compatibility.
3255 *** Values no longer need to be quoted in the grammar file:
3257   If a %define value is an identifier, it no longer needs to be placed
3258   within quotations marks.  For example,
3260     %define api.push-pull "push"
3262   can be rewritten as
3264     %define api.push-pull push
3266 *** Unrecognized variables are now errors not warnings.
3268 *** Multiple invocations for any variable is now an error not a warning.
3270 ** Unrecognized %code qualifiers are now errors not warnings.
3272 ** Character literals not of length one:
3274   Previously, Bison quietly converted all character literals to length
3275   one.  For example, without warning, Bison interpreted the operators in
3276   the following grammar to be the same token:
3278     exp: exp '++'
3279        | exp '+' exp
3280        ;
3282   Bison now warns when a character literal is not of length one.  In
3283   some future release, Bison will start reporting an error instead.
3285 ** Destructor calls fixed for lookaheads altered in semantic actions:
3287   Previously for deterministic parsers in C, if a user semantic action
3288   altered yychar, the parser in some cases used the old yychar value to
3289   determine which destructor to call for the lookahead upon a syntax
3290   error or upon parser return.  This bug has been fixed.
3292 ** C++ parsers use YYRHSLOC:
3294   Similarly to the C parsers, the C++ parsers now define the YYRHSLOC
3295   macro and use it in the default YYLLOC_DEFAULT.  You are encouraged
3296   to use it.  If, for instance, your location structure has "first"
3297   and "last" members, instead of
3299     # define YYLLOC_DEFAULT(Current, Rhs, N)                             \
3300       do                                                                 \
3301         if (N)                                                           \
3302           {                                                              \
3303             (Current).first = (Rhs)[1].location.first;                   \
3304             (Current).last  = (Rhs)[N].location.last;                    \
3305           }                                                              \
3306         else                                                             \
3307           {                                                              \
3308             (Current).first = (Current).last = (Rhs)[0].location.last;   \
3309           }                                                              \
3310       while (false)
3312   use:
3314     # define YYLLOC_DEFAULT(Current, Rhs, N)                             \
3315       do                                                                 \
3316         if (N)                                                           \
3317           {                                                              \
3318             (Current).first = YYRHSLOC (Rhs, 1).first;                   \
3319             (Current).last  = YYRHSLOC (Rhs, N).last;                    \
3320           }                                                              \
3321         else                                                             \
3322           {                                                              \
3323             (Current).first = (Current).last = YYRHSLOC (Rhs, 0).last;   \
3324           }                                                              \
3325       while (false)
3327 ** YYLLOC_DEFAULT in C++:
3329   The default implementation of YYLLOC_DEFAULT used to be issued in
3330   the header file.  It is now output in the implementation file, after
3331   the user %code sections so that its #ifndef guard does not try to
3332   override the user's YYLLOC_DEFAULT if provided.
3334 ** YYFAIL now produces warnings and Java parsers no longer implement it:
3336   YYFAIL has existed for many years as an undocumented feature of
3337   deterministic parsers in C generated by Bison.  More recently, it was
3338   a documented feature of Bison's experimental Java parsers.  As
3339   promised in Bison 2.4.2's NEWS entry, any appearance of YYFAIL in a
3340   semantic action now produces a deprecation warning, and Java parsers
3341   no longer implement YYFAIL at all.  For further details, including a
3342   discussion of how to suppress C preprocessor warnings about YYFAIL
3343   being unused, see the Bison 2.4.2 NEWS entry.
3345 ** Temporary hack for adding a semicolon to the user action:
3347   Previously, Bison appended a semicolon to every user action for
3348   reductions when the output language defaulted to C (specifically, when
3349   neither %yacc, %language, %skeleton, or equivalent command-line
3350   options were specified).  This allowed actions such as
3352     exp: exp "+" exp { $$ = $1 + $3 };
3354   instead of
3356     exp: exp "+" exp { $$ = $1 + $3; };
3358   As a first step in removing this misfeature, Bison now issues a
3359   warning when it appends a semicolon.  Moreover, in cases where Bison
3360   cannot easily determine whether a semicolon is needed (for example, an
3361   action ending with a cpp directive or a braced compound initializer),
3362   it no longer appends one.  Thus, the C compiler might now complain
3363   about a missing semicolon where it did not before.  Future releases of
3364   Bison will cease to append semicolons entirely.
3366 ** Verbose syntax error message fixes:
3368   When %error-verbose or the obsolete "#define YYERROR_VERBOSE" is
3369   specified, syntax error messages produced by the generated parser
3370   include the unexpected token as well as a list of expected tokens.
3371   The effect of %nonassoc on these verbose messages has been corrected
3372   in two ways, but a more complete fix requires LAC, described above:
3374 *** When %nonassoc is used, there can exist parser states that accept no
3375     tokens, and so the parser does not always require a lookahead token
3376     in order to detect a syntax error.  Because no unexpected token or
3377     expected tokens can then be reported, the verbose syntax error
3378     message described above is suppressed, and the parser instead
3379     reports the simpler message, "syntax error".  Previously, this
3380     suppression was sometimes erroneously triggered by %nonassoc when a
3381     lookahead was actually required.  Now verbose messages are
3382     suppressed only when all previous lookaheads have already been
3383     shifted or discarded.
3385 *** Previously, the list of expected tokens erroneously included tokens
3386     that would actually induce a syntax error because conflicts for them
3387     were resolved with %nonassoc in the current parser state.  Such
3388     tokens are now properly omitted from the list.
3390 *** Expected token lists are still often wrong due to state merging
3391     (from LALR or IELR) and default reductions, which can both add
3392     invalid tokens and subtract valid tokens.  Canonical LR almost
3393     completely fixes this problem by eliminating state merging and
3394     default reductions.  However, there is one minor problem left even
3395     when using canonical LR and even after the fixes above.  That is,
3396     if the resolution of a conflict with %nonassoc appears in a later
3397     parser state than the one at which some syntax error is
3398     discovered, the conflicted token is still erroneously included in
3399     the expected token list.  Bison's new LAC implementation,
3400     described above, eliminates this problem and the need for
3401     canonical LR.  However, LAC is still experimental and is disabled
3402     by default.
3404 ** Java skeleton fixes:
3406 *** A location handling bug has been fixed.
3408 *** The top element of each of the value stack and location stack is now
3409     cleared when popped so that it can be garbage collected.
3411 *** Parser traces now print the top element of the stack.
3413 ** -W/--warnings fixes:
3415 *** Bison now properly recognizes the "no-" versions of categories:
3417   For example, given the following command line, Bison now enables all
3418   warnings except warnings for incompatibilities with POSIX Yacc:
3420     bison -Wall,no-yacc gram.y
3422 *** Bison now treats S/R and R/R conflicts like other warnings:
3424   Previously, conflict reports were independent of Bison's normal
3425   warning system.  Now, Bison recognizes the warning categories
3426   "conflicts-sr" and "conflicts-rr".  This change has important
3427   consequences for the -W and --warnings command-line options.  For
3428   example:
3430     bison -Wno-conflicts-sr gram.y  # S/R conflicts not reported
3431     bison -Wno-conflicts-rr gram.y  # R/R conflicts not reported
3432     bison -Wnone            gram.y  # no conflicts are reported
3433     bison -Werror           gram.y  # any conflict is an error
3435   However, as before, if the %expect or %expect-rr directive is
3436   specified, an unexpected number of conflicts is an error, and an
3437   expected number of conflicts is not reported, so -W and --warning
3438   then have no effect on the conflict report.
3440 *** The "none" category no longer disables a preceding "error":
3442   For example, for the following command line, Bison now reports
3443   errors instead of warnings for incompatibilities with POSIX Yacc:
3445     bison -Werror,none,yacc gram.y
3447 *** The "none" category now disables all Bison warnings:
3449   Previously, the "none" category disabled only Bison warnings for
3450   which there existed a specific -W/--warning category.  However,
3451   given the following command line, Bison is now guaranteed to
3452   suppress all warnings:
3454     bison -Wnone gram.y
3456 ** Precedence directives can now assign token number 0:
3458   Since Bison 2.3b, which restored the ability of precedence
3459   directives to assign token numbers, doing so for token number 0 has
3460   produced an assertion failure.  For example:
3462     %left END 0
3464   This bug has been fixed.
3467 * Noteworthy changes in release 2.4.3 (2010-08-05)
3469 ** Bison now obeys -Werror and --warnings=error for warnings about
3470    grammar rules that are useless in the parser due to conflicts.
3472 ** Problems with spawning M4 on at least FreeBSD 8 and FreeBSD 9 have
3473    been fixed.
3475 ** Failures in the test suite for GCC 4.5 have been fixed.
3477 ** Failures in the test suite for some versions of Sun Studio C++ have
3478    been fixed.
3480 ** Contrary to Bison 2.4.2's NEWS entry, it has been decided that
3481    warnings about undefined %prec identifiers will not be converted to
3482    errors in Bison 2.5.  They will remain warnings, which should be
3483    sufficient for POSIX while avoiding backward compatibility issues.
3485 ** Minor documentation fixes.
3488 * Noteworthy changes in release 2.4.2 (2010-03-20)
3490 ** Some portability problems that resulted in failures and livelocks
3491    in the test suite on some versions of at least Solaris, AIX, HP-UX,
3492    RHEL4, and Tru64 have been addressed.  As a result, fatal Bison
3493    errors should no longer cause M4 to report a broken pipe on the
3494    affected platforms.
3496 ** "%prec IDENTIFIER" requires IDENTIFIER to be defined separately.
3498   POSIX specifies that an error be reported for any identifier that does
3499   not appear on the LHS of a grammar rule and that is not defined by
3500   %token, %left, %right, or %nonassoc.  Bison 2.3b and later lost this
3501   error report for the case when an identifier appears only after a
3502   %prec directive.  It is now restored.  However, for backward
3503   compatibility with recent Bison releases, it is only a warning for
3504   now.  In Bison 2.5 and later, it will return to being an error.
3505   [Between the 2.4.2 and 2.4.3 releases, it was decided that this
3506   warning will not be converted to an error in Bison 2.5.]
3508 ** Detection of GNU M4 1.4.6 or newer during configure is improved.
3510 ** Warnings from gcc's -Wundef option about undefined YYENABLE_NLS,
3511    YYLTYPE_IS_TRIVIAL, and __STRICT_ANSI__ in C/C++ parsers are now
3512    avoided.
3514 ** %code is now a permanent feature.
3516   A traditional Yacc prologue directive is written in the form:
3518     %{CODE%}
3520   To provide a more flexible alternative, Bison 2.3b introduced the
3521   %code directive with the following forms for C/C++:
3523     %code          {CODE}
3524     %code requires {CODE}
3525     %code provides {CODE}
3526     %code top      {CODE}
3528   These forms are now considered permanent features of Bison.  See the
3529   %code entries in the section "Bison Declaration Summary" in the Bison
3530   manual for a summary of their functionality.  See the section
3531   "Prologue Alternatives" for a detailed discussion including the
3532   advantages of %code over the traditional Yacc prologue directive.
3534   Bison's Java feature as a whole including its current usage of %code
3535   is still considered experimental.
3537 ** YYFAIL is deprecated and will eventually be removed.
3539   YYFAIL has existed for many years as an undocumented feature of
3540   deterministic parsers in C generated by Bison.  Previously, it was
3541   documented for Bison's experimental Java parsers.  YYFAIL is no longer
3542   documented for Java parsers and is formally deprecated in both cases.
3543   Users are strongly encouraged to migrate to YYERROR, which is
3544   specified by POSIX.
3546   Like YYERROR, you can invoke YYFAIL from a semantic action in order to
3547   induce a syntax error.  The most obvious difference from YYERROR is
3548   that YYFAIL will automatically invoke yyerror to report the syntax
3549   error so that you don't have to.  However, there are several other
3550   subtle differences between YYERROR and YYFAIL, and YYFAIL suffers from
3551   inherent flaws when %error-verbose or "#define YYERROR_VERBOSE" is
3552   used.  For a more detailed discussion, see:
3554     https://lists.gnu.org/r/bison-patches/2009-12/msg00024.html
3556   The upcoming Bison 2.5 will remove YYFAIL from Java parsers, but
3557   deterministic parsers in C will continue to implement it.  However,
3558   because YYFAIL is already flawed, it seems futile to try to make new
3559   Bison features compatible with it.  Thus, during parser generation,
3560   Bison 2.5 will produce a warning whenever it discovers YYFAIL in a
3561   rule action.  In a later release, YYFAIL will be disabled for
3562   %error-verbose and "#define YYERROR_VERBOSE".  Eventually, YYFAIL will
3563   be removed altogether.
3565   There exists at least one case where Bison 2.5's YYFAIL warning will
3566   be a false positive.  Some projects add phony uses of YYFAIL and other
3567   Bison-defined macros for the sole purpose of suppressing C
3568   preprocessor warnings (from GCC cpp's -Wunused-macros, for example).
3569   To avoid Bison's future warning, such YYFAIL uses can be moved to the
3570   epilogue (that is, after the second "%%") in the Bison input file.  In
3571   this release (2.4.2), Bison already generates its own code to suppress
3572   C preprocessor warnings for YYFAIL, so projects can remove their own
3573   phony uses of YYFAIL if compatibility with Bison releases prior to
3574   2.4.2 is not necessary.
3576 ** Internationalization.
3578   Fix a regression introduced in Bison 2.4: Under some circumstances,
3579   message translations were not installed although supported by the
3580   host system.
3583 * Noteworthy changes in release 2.4.1 (2008-12-11)
3585 ** In the GLR defines file, unexpanded M4 macros in the yylval and yylloc
3586    declarations have been fixed.
3588 ** Temporary hack for adding a semicolon to the user action.
3590   Bison used to prepend a trailing semicolon at the end of the user
3591   action for reductions.  This allowed actions such as
3593     exp: exp "+" exp { $$ = $1 + $3 };
3595   instead of
3597     exp: exp "+" exp { $$ = $1 + $3; };
3599   Some grammars still depend on this "feature".  Bison 2.4.1 restores
3600   the previous behavior in the case of C output (specifically, when
3601   neither %language or %skeleton or equivalent command-line options
3602   are used) to leave more time for grammars depending on the old
3603   behavior to be adjusted.  Future releases of Bison will disable this
3604   feature.
3606 ** A few minor improvements to the Bison manual.
3609 * Noteworthy changes in release 2.4 (2008-11-02)
3611 ** %language is an experimental feature.
3613   We first introduced this feature in test release 2.3b as a cleaner
3614   alternative to %skeleton.  Since then, we have discussed the possibility of
3615   modifying its effect on Bison's output file names.  Thus, in this release,
3616   we consider %language to be an experimental feature that will likely evolve
3617   in future releases.
3619 ** Forward compatibility with GNU M4 has been improved.
3621 ** Several bugs in the C++ skeleton and the experimental Java skeleton have been
3622   fixed.
3625 * Noteworthy changes in release 2.3b (2008-05-27)
3627 ** The quotes around NAME that used to be required in the following directive
3628   are now deprecated:
3630     %define NAME "VALUE"
3632 ** The directive "%pure-parser" is now deprecated in favor of:
3634     %define api.pure
3636   which has the same effect except that Bison is more careful to warn about
3637   unreasonable usage in the latter case.
3639 ** Push Parsing
3641   Bison can now generate an LALR(1) parser in C with a push interface.  That
3642   is, instead of invoking "yyparse", which pulls tokens from "yylex", you can
3643   push one token at a time to the parser using "yypush_parse", which will
3644   return to the caller after processing each token.  By default, the push
3645   interface is disabled.  Either of the following directives will enable it:
3647     %define api.push_pull "push" // Just push; does not require yylex.
3648     %define api.push_pull "both" // Push and pull; requires yylex.
3650   See the new section "A Push Parser" in the Bison manual for details.
3652   The current push parsing interface is experimental and may evolve.  More user
3653   feedback will help to stabilize it.
3655 ** The -g and --graph options now output graphs in Graphviz DOT format,
3656   not VCG format.  Like --graph, -g now also takes an optional FILE argument
3657   and thus cannot be bundled with other short options.
3659 ** Java
3661   Bison can now generate an LALR(1) parser in Java.  The skeleton is
3662   "data/lalr1.java".  Consider using the new %language directive instead of
3663   %skeleton to select it.
3665   See the new section "Java Parsers" in the Bison manual for details.
3667   The current Java interface is experimental and may evolve.  More user
3668   feedback will help to stabilize it.
3669   Contributed by Paolo Bonzini.
3671 ** %language
3673   This new directive specifies the programming language of the generated
3674   parser, which can be C (the default), C++, or Java.  Besides the skeleton
3675   that Bison uses, the directive affects the names of the generated files if
3676   the grammar file's name ends in ".y".
3678 ** XML Automaton Report
3680   Bison can now generate an XML report of the LALR(1) automaton using the new
3681   "--xml" option.  The current XML schema is experimental and may evolve.  More
3682   user feedback will help to stabilize it.
3683   Contributed by Wojciech Polak.
3685 ** The grammar file may now specify the name of the parser header file using
3686   %defines.  For example:
3688     %defines "parser.h"
3690 ** When reporting useless rules, useless nonterminals, and unused terminals,
3691   Bison now employs the terms "useless in grammar" instead of "useless",
3692   "useless in parser" instead of "never reduced", and "unused in grammar"
3693   instead of "unused".
3695 ** Unreachable State Removal
3697   Previously, Bison sometimes generated parser tables containing unreachable
3698   states.  A state can become unreachable during conflict resolution if Bison
3699   disables a shift action leading to it from a predecessor state.  Bison now:
3701     1. Removes unreachable states.
3703     2. Does not report any conflicts that appeared in unreachable states.
3704        WARNING: As a result, you may need to update %expect and %expect-rr
3705        directives in existing grammar files.
3707     3. For any rule used only in such states, Bison now reports the rule as
3708        "useless in parser due to conflicts".
3710   This feature can be disabled with the following directive:
3712     %define lr.keep_unreachable_states
3714   See the %define entry in the "Bison Declaration Summary" in the Bison manual
3715   for further discussion.
3717 ** Lookahead Set Correction in the ".output" Report
3719   When instructed to generate a ".output" file including lookahead sets
3720   (using "--report=lookahead", for example), Bison now prints each reduction's
3721   lookahead set only next to the associated state's one item that (1) is
3722   associated with the same rule as the reduction and (2) has its dot at the end
3723   of its RHS.  Previously, Bison also erroneously printed the lookahead set
3724   next to all of the state's other items associated with the same rule.  This
3725   bug affected only the ".output" file and not the generated parser source
3726   code.
3728 ** --report-file=FILE is a new option to override the default ".output" file
3729   name.
3731 ** The "=" that used to be required in the following directives is now
3732   deprecated:
3734     %file-prefix "parser"
3735     %name-prefix "c_"
3736     %output "parser.c"
3738 ** An Alternative to "%{...%}" -- "%code QUALIFIER {CODE}"
3740   Bison 2.3a provided a new set of directives as a more flexible alternative to
3741   the traditional Yacc prologue blocks.  Those have now been consolidated into
3742   a single %code directive with an optional qualifier field, which identifies
3743   the purpose of the code and thus the location(s) where Bison should generate
3744   it:
3746     1. "%code          {CODE}" replaces "%after-header  {CODE}"
3747     2. "%code requires {CODE}" replaces "%start-header  {CODE}"
3748     3. "%code provides {CODE}" replaces "%end-header    {CODE}"
3749     4. "%code top      {CODE}" replaces "%before-header {CODE}"
3751   See the %code entries in section "Bison Declaration Summary" in the Bison
3752   manual for a summary of the new functionality.  See the new section "Prologue
3753   Alternatives" for a detailed discussion including the advantages of %code
3754   over the traditional Yacc prologues.
3756   The prologue alternatives are experimental.  More user feedback will help to
3757   determine whether they should become permanent features.
3759 ** Revised warning: unset or unused midrule values
3761   Since Bison 2.2, Bison has warned about midrule values that are set but not
3762   used within any of the actions of the parent rule.  For example, Bison warns
3763   about unused $2 in:
3765     exp: '1' { $$ = 1; } '+' exp { $$ = $1 + $4; };
3767   Now, Bison also warns about midrule values that are used but not set.  For
3768   example, Bison warns about unset $$ in the midrule action in:
3770     exp: '1' { $1 = 1; } '+' exp { $$ = $2 + $4; };
3772   However, Bison now disables both of these warnings by default since they
3773   sometimes prove to be false alarms in existing grammars employing the Yacc
3774   constructs $0 or $-N (where N is some positive integer).
3776   To enable these warnings, specify the option "--warnings=midrule-values" or
3777   "-W", which is a synonym for "--warnings=all".
3779 ** Default %destructor or %printer with "<*>" or "<>"
3781   Bison now recognizes two separate kinds of default %destructor's and
3782   %printer's:
3784     1. Place "<*>" in a %destructor/%printer symbol list to define a default
3785        %destructor/%printer for all grammar symbols for which you have formally
3786        declared semantic type tags.
3788     2. Place "<>" in a %destructor/%printer symbol list to define a default
3789        %destructor/%printer for all grammar symbols without declared semantic
3790        type tags.
3792   Bison no longer supports the "%symbol-default" notation from Bison 2.3a.
3793   "<*>" and "<>" combined achieve the same effect with one exception: Bison no
3794   longer applies any %destructor to a midrule value if that midrule value is
3795   not actually ever referenced using either $$ or $n in a semantic action.
3797   The default %destructor's and %printer's are experimental.  More user
3798   feedback will help to determine whether they should become permanent
3799   features.
3801   See the section "Freeing Discarded Symbols" in the Bison manual for further
3802   details.
3804 ** %left, %right, and %nonassoc can now declare token numbers.  This is required
3805   by POSIX.  However, see the end of section "Operator Precedence" in the Bison
3806   manual for a caveat concerning the treatment of literal strings.
3808 ** The nonfunctional --no-parser, -n, and %no-parser options have been
3809   completely removed from Bison.
3812 * Noteworthy changes in release 2.3a (2006-09-13)
3814 ** Instead of %union, you can define and use your own union type
3815   YYSTYPE if your grammar contains at least one <type> tag.
3816   Your YYSTYPE need not be a macro; it can be a typedef.
3817   This change is for compatibility with other Yacc implementations,
3818   and is required by POSIX.
3820 ** Locations columns and lines start at 1.
3821   In accordance with the GNU Coding Standards and Emacs.
3823 ** You may now declare per-type and default %destructor's and %printer's:
3825   For example:
3827     %union { char *string; }
3828     %token <string> STRING1
3829     %token <string> STRING2
3830     %type  <string> string1
3831     %type  <string> string2
3832     %union { char character; }
3833     %token <character> CHR
3834     %type  <character> chr
3835     %destructor { free ($$); } %symbol-default
3836     %destructor { free ($$); printf ("%d", @$.first_line); } STRING1 string1
3837     %destructor { } <character>
3839   guarantees that, when the parser discards any user-defined symbol that has a
3840   semantic type tag other than "<character>", it passes its semantic value to
3841   "free".  However, when the parser discards a "STRING1" or a "string1", it
3842   also prints its line number to "stdout".  It performs only the second
3843   "%destructor" in this case, so it invokes "free" only once.
3845   [Although we failed to mention this here in the 2.3a release, the default
3846   %destructor's and %printer's were experimental, and they were rewritten in
3847   future versions.]
3849 ** Except for LALR(1) parsers in C with POSIX Yacc emulation enabled (with "-y",
3850   "--yacc", or "%yacc"), Bison no longer generates #define statements for
3851   associating token numbers with token names.  Removing the #define statements
3852   helps to sanitize the global namespace during preprocessing, but POSIX Yacc
3853   requires them.  Bison still generates an enum for token names in all cases.
3855 ** Handling of traditional Yacc prologue blocks is now more consistent but
3856   potentially incompatible with previous releases of Bison.
3858   As before, you declare prologue blocks in your grammar file with the
3859   "%{ ... %}" syntax.  To generate the pre-prologue, Bison concatenates all
3860   prologue blocks that you've declared before the first %union.  To generate
3861   the post-prologue, Bison concatenates all prologue blocks that you've
3862   declared after the first %union.
3864   Previous releases of Bison inserted the pre-prologue into both the header
3865   file and the code file in all cases except for LALR(1) parsers in C.  In the
3866   latter case, Bison inserted it only into the code file.  For parsers in C++,
3867   the point of insertion was before any token definitions (which associate
3868   token numbers with names).  For parsers in C, the point of insertion was
3869   after the token definitions.
3871   Now, Bison never inserts the pre-prologue into the header file.  In the code
3872   file, it always inserts it before the token definitions.
3874 ** Bison now provides a more flexible alternative to the traditional Yacc
3875   prologue blocks: %before-header, %start-header, %end-header, and
3876   %after-header.
3878   For example, the following declaration order in the grammar file reflects the
3879   order in which Bison will output these code blocks.  However, you are free to
3880   declare these code blocks in your grammar file in whatever order is most
3881   convenient for you:
3883     %before-header {
3884       /* Bison treats this block like a pre-prologue block: it inserts it into
3885        * the code file before the contents of the header file.  It does *not*
3886        * insert it into the header file.  This is a good place to put
3887        * #include's that you want at the top of your code file.  A common
3888        * example is '#include "system.h"'.  */
3889     }
3890     %start-header {
3891       /* Bison inserts this block into both the header file and the code file.
3892        * In both files, the point of insertion is before any Bison-generated
3893        * token, semantic type, location type, and class definitions.  This is a
3894        * good place to define %union dependencies, for example.  */
3895     }
3896     %union {
3897       /* Unlike the traditional Yacc prologue blocks, the output order for the
3898        * new %*-header blocks is not affected by their declaration position
3899        * relative to any %union in the grammar file.  */
3900     }
3901     %end-header {
3902       /* Bison inserts this block into both the header file and the code file.
3903        * In both files, the point of insertion is after the Bison-generated
3904        * definitions.  This is a good place to declare or define public
3905        * functions or data structures that depend on the Bison-generated
3906        * definitions.  */
3907     }
3908     %after-header {
3909       /* Bison treats this block like a post-prologue block: it inserts it into
3910        * the code file after the contents of the header file.  It does *not*
3911        * insert it into the header file.  This is a good place to declare or
3912        * define internal functions or data structures that depend on the
3913        * Bison-generated definitions.  */
3914     }
3916   If you have multiple occurrences of any one of the above declarations, Bison
3917   will concatenate the contents in declaration order.
3919   [Although we failed to mention this here in the 2.3a release, the prologue
3920   alternatives were experimental, and they were rewritten in future versions.]
3922 ** The option "--report=look-ahead" has been changed to "--report=lookahead".
3923   The old spelling still works, but is not documented and may be removed
3924   in a future release.
3927 * Noteworthy changes in release 2.3 (2006-06-05)
3929 ** GLR grammars should now use "YYRECOVERING ()" instead of "YYRECOVERING",
3930   for compatibility with LALR(1) grammars.
3932 ** It is now documented that any definition of YYSTYPE or YYLTYPE should
3933   be to a type name that does not contain parentheses or brackets.
3936 * Noteworthy changes in release 2.2 (2006-05-19)
3938 ** The distribution terms for all Bison-generated parsers now permit
3939   using the parsers in nonfree programs.  Previously, this permission
3940   was granted only for Bison-generated LALR(1) parsers in C.
3942 ** %name-prefix changes the namespace name in C++ outputs.
3944 ** The C++ parsers export their token_type.
3946 ** Bison now allows multiple %union declarations, and concatenates
3947   their contents together.
3949 ** New warning: unused values
3950   Right-hand side symbols whose values are not used are reported,
3951   if the symbols have destructors.  For instance:
3953      exp: exp "?" exp ":" exp { $1 ? $1 : $3; }
3954         | exp "+" exp
3955         ;
3957   will trigger a warning about $$ and $5 in the first rule, and $3 in
3958   the second ($1 is copied to $$ by the default rule).  This example
3959   most likely contains three errors, and could be rewritten as:
3961      exp: exp "?" exp ":" exp
3962             { $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); }
3963         | exp "+" exp
3964             { $$ = $1 ? $1 : $3; if ($1) free ($3); }
3965         ;
3967   However, if the original actions were really intended, memory leaks
3968   and all, the warnings can be suppressed by letting Bison believe the
3969   values are used, e.g.:
3971      exp: exp "?" exp ":" exp { $1 ? $1 : $3; (void) ($$, $5); }
3972         | exp "+" exp         { $$ = $1; (void) $3; }
3973         ;
3975   If there are midrule actions, the warning is issued if no action
3976   uses it.  The following triggers no warning: $1 and $3 are used.
3978      exp: exp { push ($1); } '+' exp { push ($3); sum (); };
3980   The warning is intended to help catching lost values and memory leaks.
3981   If a value is ignored, its associated memory typically is not reclaimed.
3983 ** %destructor vs. YYABORT, YYACCEPT, and YYERROR.
3984   Destructors are now called when user code invokes YYABORT, YYACCEPT,
3985   and YYERROR, for all objects on the stack, other than objects
3986   corresponding to the right-hand side of the current rule.
3988 ** %expect, %expect-rr
3989   Incorrect numbers of expected conflicts are now actual errors,
3990   instead of warnings.
3992 ** GLR, YACC parsers.
3993   The %parse-params are available in the destructors (and the
3994   experimental printers) as per the documentation.
3996 ** Bison now warns if it finds a stray "$" or "@" in an action.
3998 ** %require "VERSION"
3999   This specifies that the grammar file depends on features implemented
4000   in Bison version VERSION or higher.
4002 ** lalr1.cc: The token and value types are now class members.
4003   The tokens were defined as free form enums and cpp macros.  YYSTYPE
4004   was defined as a free form union.  They are now class members:
4005   tokens are enumerations of the "yy::parser::token" struct, and the
4006   semantic values have the "yy::parser::semantic_type" type.
4008   If you do not want or can update to this scheme, the directive
4009   '%define "global_tokens_and_yystype" "1"' triggers the global
4010   definition of tokens and YYSTYPE.  This change is suitable both
4011   for previous releases of Bison, and this one.
4013   If you wish to update, then make sure older version of Bison will
4014   fail using '%require "2.2"'.
4016 ** DJGPP support added.
4019 * Noteworthy changes in release 2.1 (2005-09-16)
4021 ** The C++ lalr1.cc skeleton supports %lex-param.
4023 ** Bison-generated parsers now support the translation of diagnostics like
4024   "syntax error" into languages other than English.  The default
4025   language is still English.  For details, please see the new
4026   Internationalization section of the Bison manual.  Software
4027   distributors should also see the new PACKAGING file.  Thanks to
4028   Bruno Haible for this new feature.
4030 ** Wording in the Bison-generated parsers has been changed slightly to
4031   simplify translation.  In particular, the message "memory exhausted"
4032   has replaced "parser stack overflow", as the old message was not
4033   always accurate for modern Bison-generated parsers.
4035 ** Destructors are now called when the parser aborts, for all symbols left
4036   behind on the stack.  Also, the start symbol is now destroyed after a
4037   successful parse.  In both cases, the behavior was formerly inconsistent.
4039 ** When generating verbose diagnostics, Bison-generated parsers no longer
4040   quote the literal strings associated with tokens.  For example, for
4041   a syntax error associated with '%token NUM "number"' they might
4042   print 'syntax error, unexpected number' instead of 'syntax error,
4043   unexpected "number"'.
4046 * Noteworthy changes in release 2.0 (2004-12-25)
4048 ** Possibly-incompatible changes
4050   - Bison-generated parsers no longer default to using the alloca function
4051     (when available) to extend the parser stack, due to widespread
4052     problems in unchecked stack-overflow detection.  You can "#define
4053     YYSTACK_USE_ALLOCA 1" to require the use of alloca, but please read
4054     the manual to determine safe values for YYMAXDEPTH in that case.
4056   - Error token location.
4057     During error recovery, the location of the syntax error is updated
4058     to cover the whole sequence covered by the error token: it includes
4059     the shifted symbols thrown away during the first part of the error
4060     recovery, and the lookahead rejected during the second part.
4062   - Semicolon changes:
4063     . Stray semicolons are no longer allowed at the start of a grammar.
4064     . Semicolons are now required after in-grammar declarations.
4066   - Unescaped newlines are no longer allowed in character constants or
4067     string literals.  They were never portable, and GCC 3.4.0 has
4068     dropped support for them.  Better diagnostics are now generated if
4069     forget a closing quote.
4071   - NUL bytes are no longer allowed in Bison string literals, unfortunately.
4073 ** New features
4075   - GLR grammars now support locations.
4077   - New directive: %initial-action.
4078     This directive allows the user to run arbitrary code (including
4079     initializing @$) from yyparse before parsing starts.
4081   - A new directive "%expect-rr N" specifies the expected number of
4082     reduce/reduce conflicts in GLR parsers.
4084   - %token numbers can now be hexadecimal integers, e.g., "%token FOO 0x12d".
4085     This is a GNU extension.
4087   - The option "--report=lookahead" was changed to "--report=look-ahead".
4088     [However, this was changed back after 2.3.]
4090   - Experimental %destructor support has been added to lalr1.cc.
4092   - New configure option --disable-yacc, to disable installation of the
4093     yacc command and -ly library introduced in 1.875 for POSIX conformance.
4095 ** Bug fixes
4097   - For now, %expect-count violations are now just warnings, not errors.
4098     This is for compatibility with Bison 1.75 and earlier (when there are
4099     reduce/reduce conflicts) and with Bison 1.30 and earlier (when there
4100     are too many or too few shift/reduce conflicts).  However, in future
4101     versions of Bison we plan to improve the %expect machinery so that
4102     these violations will become errors again.
4104   - Within Bison itself, numbers (e.g., goto numbers) are no longer
4105     arbitrarily limited to 16-bit counts.
4107   - Semicolons are now allowed before "|" in grammar rules, as POSIX requires.
4110 * Noteworthy changes in release 1.875 (2003-01-01)
4112 ** The documentation license has been upgraded to version 1.2
4113   of the GNU Free Documentation License.
4115 ** syntax error processing
4117   - In Yacc-style parsers YYLLOC_DEFAULT is now used to compute error
4118     locations too.  This fixes bugs in error-location computation.
4120   - %destructor
4121     It is now possible to reclaim the memory associated to symbols
4122     discarded during error recovery.  This feature is still experimental.
4124   - %error-verbose
4125     This new directive is preferred over YYERROR_VERBOSE.
4127   - #defining yyerror to steal internal variables is discouraged.
4128     It is not guaranteed to work forever.
4130 ** POSIX conformance
4132   - Semicolons are once again optional at the end of grammar rules.
4133     This reverts to the behavior of Bison 1.33 and earlier, and improves
4134     compatibility with Yacc.
4136   - "parse error" -> "syntax error"
4137     Bison now uniformly uses the term "syntax error"; formerly, the code
4138     and manual sometimes used the term "parse error" instead.  POSIX
4139     requires "syntax error" in diagnostics, and it was thought better to
4140     be consistent.
4142   - The documentation now emphasizes that yylex and yyerror must be
4143     declared before use.  C99 requires this.
4145   - Bison now parses C99 lexical constructs like UCNs and
4146     backslash-newline within C escape sequences, as POSIX 1003.1-2001 requires.
4148   - File names are properly escaped in C output.  E.g., foo\bar.y is
4149     output as "foo\\bar.y".
4151   - Yacc command and library now available
4152     The Bison distribution now installs a "yacc" command, as POSIX requires.
4153     Also, Bison now installs a small library liby.a containing
4154     implementations of Yacc-compatible yyerror and main functions.
4155     This library is normally not useful, but POSIX requires it.
4157   - Type clashes now generate warnings, not errors.
4159   - If the user does not define YYSTYPE as a macro, Bison now declares it
4160     using typedef instead of defining it as a macro.
4161     For consistency, YYLTYPE is also declared instead of defined.
4163 ** Other compatibility issues
4165   - %union directives can now have a tag before the "{", e.g., the
4166     directive "%union foo {...}" now generates the C code
4167     "typedef union foo { ... } YYSTYPE;"; this is for Yacc compatibility.
4168     The default union tag is "YYSTYPE", for compatibility with Solaris 9 Yacc.
4169     For consistency, YYLTYPE's struct tag is now "YYLTYPE" not "yyltype".
4170     This is for compatibility with both Yacc and Bison 1.35.
4172   - ";" is output before the terminating "}" of an action, for
4173     compatibility with Bison 1.35.
4175   - Bison now uses a Yacc-style format for conflict reports, e.g.,
4176     "conflicts: 2 shift/reduce, 1 reduce/reduce".
4178   - "yystype" and "yyltype" are now obsolescent macros instead of being
4179     typedefs or tags; they are no longer documented and are planned to be
4180     withdrawn in a future release.
4182 ** GLR parser notes
4184   - GLR and inline
4185     Users of Bison have to decide how they handle the portability of the
4186     C keyword "inline".
4188   - "parsing stack overflow..." -> "parser stack overflow"
4189     GLR parsers now report "parser stack overflow" as per the Bison manual.
4191 ** %parse-param and %lex-param
4192   The macros YYPARSE_PARAM and YYLEX_PARAM provide a means to pass
4193   additional context to yyparse and yylex.  They suffer from several
4194   shortcomings:
4196   - a single argument only can be added,
4197   - their types are weak (void *),
4198   - this context is not passed to ancillary functions such as yyerror,
4199   - only yacc.c parsers support them.
4201   The new %parse-param/%lex-param directives provide a more precise control.
4202   For instance:
4204     %parse-param {int *nastiness}
4205     %lex-param   {int *nastiness}
4206     %parse-param {int *randomness}
4208   results in the following signatures:
4210     int yylex   (int *nastiness);
4211     int yyparse (int *nastiness, int *randomness);
4213   or, if both %pure-parser and %locations are used:
4215     int yylex   (YYSTYPE *lvalp, YYLTYPE *llocp, int *nastiness);
4216     int yyparse (int *nastiness, int *randomness);
4218 ** Bison now warns if it detects conflicting outputs to the same file,
4219   e.g., it generates a warning for "bison -d -o foo.h foo.y" since
4220   that command outputs both code and header to foo.h.
4222 ** #line in output files
4223   - --no-line works properly.
4225 ** Bison can no longer be built by a K&R C compiler; it requires C89 or
4226   later to be built.  This change originally took place a few versions
4227   ago, but nobody noticed until we recently asked someone to try
4228   building Bison with a K&R C compiler.
4231 * Noteworthy changes in release 1.75 (2002-10-14)
4233 ** Bison should now work on 64-bit hosts.
4235 ** Indonesian translation thanks to Tedi Heriyanto.
4237 ** GLR parsers
4238   Fix spurious parse errors.
4240 ** Pure parsers
4241   Some people redefine yyerror to steal yyparse' private variables.
4242   Reenable this trick until an official feature replaces it.
4244 ** Type Clashes
4245   In agreement with POSIX and with other Yaccs, leaving a default
4246   action is valid when $$ is untyped, and $1 typed:
4248         untyped: ... typed;
4250   but the converse remains an error:
4252         typed: ... untyped;
4254 ** Values of midrule actions
4255   The following code:
4257         foo: { ... } { $$ = $1; } ...
4259   was incorrectly rejected: $1 is defined in the second midrule
4260   action, and is equal to the $$ of the first midrule action.
4263 * Noteworthy changes in release 1.50 (2002-10-04)
4265 ** GLR parsing
4266   The declaration
4267      %glr-parser
4268   causes Bison to produce a Generalized LR (GLR) parser, capable of handling
4269   almost any context-free grammar, ambiguous or not.  The new declarations
4270   %dprec and %merge on grammar rules allow parse-time resolution of
4271   ambiguities.  Contributed by Paul Hilfinger.
4273   Unfortunately Bison 1.50 does not work properly on 64-bit hosts
4274   like the Alpha, so please stick to 32-bit hosts for now.
4276 ** Output Directory
4277   When not in Yacc compatibility mode, when the output file was not
4278   specified, running "bison foo/bar.y" created "foo/bar.c".  It
4279   now creates "bar.c".
4281 ** Undefined token
4282   The undefined token was systematically mapped to 2 which prevented
4283   the use of 2 by the user.  This is no longer the case.
4285 ** Unknown token numbers
4286   If yylex returned an out of range value, yyparse could die.  This is
4287   no longer the case.
4289 ** Error token
4290   According to POSIX, the error token must be 256.
4291   Bison extends this requirement by making it a preference: *if* the
4292   user specified that one of her tokens is numbered 256, then error
4293   will be mapped onto another number.
4295 ** Verbose error messages
4296   They no longer report "..., expecting error or..." for states where
4297   error recovery is possible.
4299 ** End token
4300   Defaults to "$end" instead of "$".
4302 ** Error recovery now conforms to documentation and to POSIX
4303   When a Bison-generated parser encounters a syntax error, it now pops
4304   the stack until it finds a state that allows shifting the error
4305   token.  Formerly, it popped the stack until it found a state that
4306   allowed some non-error action other than a default reduction on the
4307   error token.  The new behavior has long been the documented behavior,
4308   and has long been required by POSIX.  For more details, please see
4309   Paul Eggert, "Reductions during Bison error handling" (2002-05-20)
4310   <https://lists.gnu.org/r/bug-bison/2002-05/msg00038.html>.
4312 ** Traces
4313   Popped tokens and nonterminals are now reported.
4315 ** Larger grammars
4316   Larger grammars are now supported (larger token numbers, larger grammar
4317   size (= sum of the LHS and RHS lengths), larger LALR tables).
4318   Formerly, many of these numbers ran afoul of 16-bit limits;
4319   now these limits are 32 bits on most hosts.
4321 ** Explicit initial rule
4322   Bison used to play hacks with the initial rule, which the user does
4323   not write.  It is now explicit, and visible in the reports and
4324   graphs as rule 0.
4326 ** Useless rules
4327   Before, Bison reported the useless rules, but, although not used,
4328   included them in the parsers.  They are now actually removed.
4330 ** Useless rules, useless nonterminals
4331   They are now reported, as a warning, with their locations.
4333 ** Rules never reduced
4334   Rules that can never be reduced because of conflicts are now
4335   reported.
4337 ** Incorrect "Token not used"
4338   On a grammar such as
4340     %token useless useful
4341     %%
4342     exp: '0' %prec useful;
4344   where a token was used to set the precedence of the last rule,
4345   bison reported both "useful" and "useless" as useless tokens.
4347 ** Revert the C++ namespace changes introduced in 1.31
4348   as they caused too many portability hassles.
4350 ** Default locations
4351   By an accident of design, the default computation of @$ was
4352   performed after another default computation was performed: @$ = @1.
4353   The latter is now removed: YYLLOC_DEFAULT is fully responsible of
4354   the computation of @$.
4356 ** Token end-of-file
4357   The token end of file may be specified by the user, in which case,
4358   the user symbol is used in the reports, the graphs, and the verbose
4359   error messages instead of "$end", which remains being the default.
4360   For instance
4361     %token MYEOF 0
4362   or
4363     %token MYEOF 0 "end of file"
4365 ** Semantic parser
4366   This old option, which has been broken for ages, is removed.
4368 ** New translations
4369   Brazilian Portuguese, thanks to Alexandre Folle de Menezes.
4370   Croatian, thanks to Denis Lackovic.
4372 ** Incorrect token definitions
4373   When given
4374     %token 'a' "A"
4375   bison used to output
4376     #define 'a' 65
4378 ** Token definitions as enums
4379   Tokens are output both as the traditional #define's, and, provided
4380   the compiler supports ANSI C or is a C++ compiler, as enums.
4381   This lets debuggers display names instead of integers.
4383 ** Reports
4384   In addition to --verbose, bison supports --report=THINGS, which
4385   produces additional information:
4386   - itemset
4387     complete the core item sets with their closure
4388   - lookahead [changed to "look-ahead" in 1.875e through 2.3, but changed back]
4389     explicitly associate lookahead tokens to items
4390   - solved
4391     describe shift/reduce conflicts solving.
4392     Bison used to systematically output this information on top of
4393     the report.  Solved conflicts are now attached to their states.
4395 ** Type clashes
4396   Previous versions don't complain when there is a type clash on
4397   the default action if the rule has a midrule action, such as in:
4399     %type <foo> bar
4400     %%
4401     bar: '0' {} '0';
4403   This is fixed.
4405 ** GNU M4 is now required when using Bison.
4408 * Noteworthy changes in release 1.35 (2002-03-25)
4410 ** C Skeleton
4411   Some projects use Bison's C parser with C++ compilers, and define
4412   YYSTYPE as a class.  The recent adjustment of C parsers for data
4413   alignment and 64 bit architectures made this impossible.
4415   Because for the time being no real solution for C++ parser
4416   generation exists, kludges were implemented in the parser to
4417   maintain this use.  In the future, when Bison has C++ parsers, this
4418   kludge will be disabled.
4420   This kludge also addresses some C++ problems when the stack was
4421   extended.
4424 * Noteworthy changes in release 1.34 (2002-03-12)
4426 ** File name clashes are detected
4427   $ bison foo.y -d -o foo.x
4428   fatal error: header and parser would both be named "foo.x"
4430 ** A missing ";" at the end of a rule triggers a warning
4431   In accordance with POSIX, and in agreement with other
4432   Yacc implementations, Bison will mandate this semicolon in the near
4433   future.  This eases the implementation of a Bison parser of Bison
4434   grammars by making this grammar LALR(1) instead of LR(2).  To
4435   facilitate the transition, this release introduces a warning.
4437 ** Revert the C++ namespace changes introduced in 1.31, as they caused too
4438   many portability hassles.
4440 ** DJGPP support added.
4442 ** Fix test suite portability problems.
4445 * Noteworthy changes in release 1.33 (2002-02-07)
4447 ** Fix C++ issues
4448   Groff could not be compiled for the definition of size_t was lacking
4449   under some conditions.
4451 ** Catch invalid @n
4452   As is done with $n.
4455 * Noteworthy changes in release 1.32 (2002-01-23)
4457 ** Fix Yacc output file names
4459 ** Portability fixes
4461 ** Italian, Dutch translations
4464 * Noteworthy changes in release 1.31 (2002-01-14)
4466 ** Many Bug Fixes
4468 ** GNU Gettext and %expect
4469   GNU Gettext asserts 10 s/r conflicts, but there are 7.  Now that
4470   Bison dies on incorrect %expectations, we fear there will be
4471   too many bug reports for Gettext, so _for the time being_, %expect
4472   does not trigger an error when the input file is named "plural.y".
4474 ** Use of alloca in parsers
4475   If YYSTACK_USE_ALLOCA is defined to 0, then the parsers will use
4476   malloc exclusively.  Since 1.29, but was not NEWS'ed.
4478   alloca is used only when compiled with GCC, to avoid portability
4479   problems as on AIX.
4481 ** yyparse now returns 2 if memory is exhausted; formerly it dumped core.
4483 ** When the generated parser lacks debugging code, YYDEBUG is now 0
4484   (as POSIX requires) instead of being undefined.
4486 ** User Actions
4487   Bison has always permitted actions such as { $$ = $1 }: it adds the
4488   ending semicolon.  Now if in Yacc compatibility mode, the semicolon
4489   is no longer output: one has to write { $$ = $1; }.
4491 ** Better C++ compliance
4492   The output parsers try to respect C++ namespaces.
4493   [This turned out to be a failed experiment, and it was reverted later.]
4495 ** Reduced Grammars
4496   Fixed bugs when reporting useless nonterminals.
4498 ** 64 bit hosts
4499   The parsers work properly on 64 bit hosts.
4501 ** Error messages
4502   Some calls to strerror resulted in scrambled or missing error messages.
4504 ** %expect
4505   When the number of shift/reduce conflicts is correct, don't issue
4506   any warning.
4508 ** The verbose report includes the rule line numbers.
4510 ** Rule line numbers are fixed in traces.
4512 ** Swedish translation
4514 ** Parse errors
4515   Verbose parse error messages from the parsers are better looking.
4516   Before: parse error: unexpected `'/'', expecting `"number"' or `'-'' or `'(''
4517      Now: parse error: unexpected '/', expecting "number" or '-' or '('
4519 ** Fixed parser memory leaks.
4520   When the generated parser was using malloc to extend its stacks, the
4521   previous allocations were not freed.
4523 ** Fixed verbose output file.
4524   Some newlines were missing.
4525   Some conflicts in state descriptions were missing.
4527 ** Fixed conflict report.
4528   Option -v was needed to get the result.
4530 ** %expect
4531   Was not used.
4532   Mismatches are errors, not warnings.
4534 ** Fixed incorrect processing of some invalid input.
4536 ** Fixed CPP guards: 9foo.h uses BISON_9FOO_H instead of 9FOO_H.
4538 ** Fixed some typos in the documentation.
4540 ** %token MY_EOF 0 is supported.
4541   Before, MY_EOF was silently renumbered as 257.
4543 ** doc/refcard.tex is updated.
4545 ** %output, %file-prefix, %name-prefix.
4546   New.
4548 ** --output
4549   New, aliasing "--output-file".
4552 * Noteworthy changes in release 1.30 (2001-10-26)
4554 ** "--defines" and "--graph" have now an optional argument which is the
4555   output file name. "-d" and "-g" do not change; they do not take any
4556   argument.
4558 ** "%source_extension" and "%header_extension" are removed, failed
4559   experiment.
4561 ** Portability fixes.
4564 * Noteworthy changes in release 1.29 (2001-09-07)
4566 ** The output file does not define const, as this caused problems when used
4567   with common autoconfiguration schemes.  If you still use ancient compilers
4568   that lack const, compile with the equivalent of the C compiler option
4569   "-Dconst=".  Autoconf's AC_C_CONST macro provides one way to do this.
4571 ** Added "-g" and "--graph".
4573 ** The Bison manual is now distributed under the terms of the GNU FDL.
4575 ** The input and the output files has automatically a similar extension.
4577 ** Russian translation added.
4579 ** NLS support updated; should hopefully be less troublesome.
4581 ** Added the old Bison reference card.
4583 ** Added "--locations" and "%locations".
4585 ** Added "-S" and "--skeleton".
4587 ** "%raw", "-r", "--raw" is disabled.
4589 ** Special characters are escaped when output.  This solves the problems
4590   of the #line lines with path names including backslashes.
4592 ** New directives.
4593   "%yacc", "%fixed_output_files", "%defines", "%no_parser", "%verbose",
4594   "%debug", "%source_extension" and "%header_extension".
4596 ** @$
4597   Automatic location tracking.
4600 * Noteworthy changes in release 1.28 (1999-07-06)
4602 ** Should compile better now with K&R compilers.
4604 ** Added NLS.
4606 ** Fixed a problem with escaping the double quote character.
4608 ** There is now a FAQ.
4611 * Noteworthy changes in release 1.27
4613 ** The make rule which prevented bison.simple from being created on
4614   some systems has been fixed.
4617 * Noteworthy changes in release 1.26
4619 ** Bison now uses Automake.
4621 ** New mailing lists: <bug-bison@gnu.org> and <help-bison@gnu.org>.
4623 ** Token numbers now start at 257 as previously documented, not 258.
4625 ** Bison honors the TMPDIR environment variable.
4627 ** A couple of buffer overruns have been fixed.
4629 ** Problems when closing files should now be reported.
4631 ** Generated parsers should now work even on operating systems which do
4632   not provide alloca().
4635 * Noteworthy changes in release 1.25 (1995-10-16)
4637 ** Errors in the input grammar are not fatal; Bison keeps reading
4638 the grammar file, and reports all the errors found in it.
4640 ** Tokens can now be specified as multiple-character strings: for
4641 example, you could use "<=" for a token which looks like <=, instead
4642 of choosing a name like LESSEQ.
4644 ** The %token_table declaration says to write a table of tokens (names
4645 and numbers) into the parser file.  The yylex function can use this
4646 table to recognize multiple-character string tokens, or for other
4647 purposes.
4649 ** The %no_lines declaration says not to generate any #line preprocessor
4650 directives in the parser file.
4652 ** The %raw declaration says to use internal Bison token numbers, not
4653 Yacc-compatible token numbers, when token names are defined as macros.
4655 ** The --no-parser option produces the parser tables without including
4656 the parser engine; a project can now use its own parser engine.
4657 The actions go into a separate file called NAME.act, in the form of
4658 a switch statement body.
4661 * Noteworthy changes in release 1.23
4663 The user can define YYPARSE_PARAM as the name of an argument to be
4664 passed into yyparse.  The argument should have type void *.  It should
4665 actually point to an object.  Grammar actions can access the variable
4666 by casting it to the proper pointer type.
4668 Line numbers in output file corrected.
4671 * Noteworthy changes in release 1.22
4673 --help option added.
4676 * Noteworthy changes in release 1.20
4678 Output file does not redefine const for C++.
4680 -----
4682 LocalWords:  yacc YYBACKUP glr GCC lalr ArrayIndexOutOfBoundsException nullptr
4683 LocalWords:  cplusplus liby rpl fprintf mfcalc Wyacc stmt cond expr mk sym lr
4684 LocalWords:  IELR ielr Lookahead YYERROR nonassoc LALR's api lookaheads yychar
4685 LocalWords:  destructor lookahead YYRHSLOC YYLLOC Rhs ifndef YYFAIL cpp sr rr
4686 LocalWords:  preprocessor initializer Wno Wnone Werror FreeBSD prec livelocks
4687 LocalWords:  Solaris AIX UX RHEL Tru LHS gcc's Wundef YYENABLE NLS YYLTYPE VCG
4688 LocalWords:  yyerror cpp's Wunused yylval yylloc prepend yyparse yylex yypush
4689 LocalWords:  Graphviz xml nonterminals midrule destructor's YYSTYPE typedef ly
4690 LocalWords:  CHR chr printf stdout namespace preprocessing enum pre include's
4691 LocalWords:  YYRECOVERING nonfree destructors YYABORT YYACCEPT params enums de
4692 LocalWords:  struct yystype DJGPP lex param Haible NUM alloca YYSTACK NUL goto
4693 LocalWords:  YYMAXDEPTH Unescaped UCNs YYLTYPE's yyltype typedefs inline Yaccs
4694 LocalWords:  Heriyanto Reenable dprec Hilfinger Eggert MYEOF Folle Menezes EOF
4695 LocalWords:  Lackovic define's itemset Groff Gettext malloc NEWS'ed YYDEBUG YY
4696 LocalWords:  namespaces strerror const autoconfiguration Dconst Autoconf's FDL
4697 LocalWords:  Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
4698 LocalWords:  extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
4699 LocalWords:  lang yyoutput dvi html ps POSIX lvalp llocp Wother nterm arg init
4700 LocalWords:  TOK calc yyo fval Wconflicts parsers yystackp yyval yynerrs
4701 LocalWords:  Théophile Ranquet Santet fno fnone stype associativity Tolmer
4702 LocalWords:  Wprecedence Rassoul Wempty Paolo Bonzini parser's Michiel loc
4703 LocalWords:  redeclaration sval fcaret reentrant XSLT xsl Wmaybe yyvsp Tedi
4704 LocalWords:  pragmas noreturn untyped Rozenman unexpanded Wojciech Polak
4705 LocalWords:  Alexandre MERCHANTABILITY yytype emplace ptr automove lvalues
4706 LocalWords:  nonterminal yy args Pragma dereference yyformat rhs docdir bw
4707 LocalWords:  Redeclarations rpcalc Autoconf YFLAGS Makefiles PROG DECL num
4708 LocalWords:  Heimbigner AST src ast Makefile srcdir MinGW xxlex XXSTYPE CVE
4709 LocalWords:  XXLTYPE strictfp IDEs ffixit fdiagnostics parseable fixits
4710 LocalWords:  Wdeprecated yytext Variadic variadic yyrhs yyphrs RCS README
4711 LocalWords:  noexcept constexpr ispell american deprecations backend Teoh
4712 LocalWords:  YYPRINT Mangold Bonzini's Wdangling exVal baz checkable gcc
4713 LocalWords:  fsanitize Vogelsgesang lis redeclared stdint automata yytname
4714 LocalWords:  yysymbol yytnamerr yyreport ctx ARGMAX yysyntax stderr LPAREN
4715 LocalWords:  symrec yypcontext TOKENMAX yyexpected YYEMPTY yypstate YYEOF
4716 LocalWords:  autocompletion bistromathic submessages Cayuela lexcalc hoc
4717 LocalWords:  yytoken YYUNDEF YYerror basename Automake's UTF ifdef ffile
4718 LocalWords:  gotos readline Imbimbo Wcounterexamples Wcex Nonunifying rcex
4719 LocalWords:  Vais xsltproc YYNOMEM YYLOCATION signedness YYBISON MITRE's
4720 LocalWords:  libreadline YYMALLOC YYFREE MSVC redefinitions POSIXLY
4722 Local Variables:
4723 ispell-dictionary: "american"
4724 mode: outline
4725 fill-column: 76
4726 End:
4728 Copyright (C) 1995-2015, 2018-2021 Free Software Foundation, Inc.
4730 This file is part of Bison, the GNU Parser Generator.
4732 Permission is granted to copy, distribute and/or modify this document
4733 under the terms of the GNU Free Documentation License, Version 1.3 or
4734 any later version published by the Free Software Foundation; with no
4735 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
4736 Texts.  A copy of the license is included in the "GNU Free
4737 Documentation License" file as part of this distribution.