style: rename stmtMerge as stmt_merge
[bison.git] / NEWS
blobb01b2ea37f5e72ba77f2e7e7ca99a3a6d5f597aa
1 GNU Bison NEWS
3 * Noteworthy changes in release ?.? (????-??-??) [?]
5   Portability issues in the test suite and in C++ skeletons.
7 * Noteworthy changes in release 3.7.90 (2021-08-13) [beta]
9 ** Backward incompatible changes
11   In conformance with the recommendations of the Graphviz team
12   (https://marc.info/?l=graphviz-devel&m=129418103126092), `-g`/`--graph`
13   now generates a *.gv file by default, instead of *.dot.  A transition
14   started in Bison 3.4.
16   To comply with the latest POSIX standard, in Yacc compatibility mode
17   (options `-y`/`--yacc`) Bison now generates prototypes for yyerror and
18   yylex.  In some situations, this is breaking compatibility: if the user
19   has already declared these functions but with some differences (e.g., to
20   declare them as static, or to use specific attributes), the generated
21   parser will fail to compile.  To disable these prototypes, #define yyerror
22   (to `yyerror`), and likewise for yylex.
24 ** Deprecated features
26   Support for the YYPRINT macro is removed. It worked only with yacc.c and
27   only for tokens.  It was obsoleted by %printer, introduced in Bison 1.50
28   (November 2002).
30   It has always been recommended to prefer `%define api.value.type foo` to
31   `#define YYSTYPE foo`.  The latter is supported in C for compatibility
32   with Yacc, but not in C++.  Warnings are now issued if `#define YYSTYPE`
33   is used in C++, and eventually support will be removed.
35   In C++ code, prefer value_type to semantic_type to denote the semantic
36   value type, which is specified by the `api.value.type` %define variable.
38 ** New features
40 *** A skeleton for the D programming language
42   The "lalr1.d" skeleton is now officially part of Bison.
44   It was originally contributed by Oliver Mangold, based on Paolo Bonzini's
45   lalr1.java, and was improved by H. S. Teoh.  Adela Vais then took over
46   maintenance and invested a lot of efforts to complete, test and document
47   it.
49   It now supports all the bells and whistles of the other deterministic
50   parsers, which include: pull/push interfaces, verbose and custom error
51   messages, lookahead correction, token constructors, internationalization,
52   locations, printers, token and symbol prefixes, etc.
54   Two examples demonstrate the D parsers: a basic one (examples/d/simple),
55   and an advanced one (examples/d/calc).
57 *** Option -H, --header and directive %header
59   The option `-H`/`--header` supersedes the option `--defines`, and the
60   directive %header supersedes %defines.  Both `--defines` and `%defines`
61   are, of course, maintained for backward compatibility.
63 *** Option --html
65   Since version 2.4 Bison can be used to generate HTML reports.  However it
66   was a two-step process: first bison must be invoked with option `--xml`,
67   and then xsltproc must be run to the convert the XML reports into HTML.
69   The new option `--html` combines these steps.  The xsltproc program must
70   be available.
72 *** A C++ native GLR parser
74   A new version of the C++ GLR parser was added: "glr2.cc".  It generates
75   "true C++11", instead of a C++ wrapper around a C parser as does the
76   existing "glr.cc" parser.  As a first significant consequence, it supports
77   `%define api.value.type variant`, contrary to glr.cc.
79   It should be upward compatible in terms of interface, feature and
80   performance to "glr.cc". To try it out, simply use
82   %skeleton "glr2.cc"
84   It will eventually replace "glr.cc".  However we need user feedback on
85   this skeleton.  _Please_ report your results and comments about it.
87 *** Counterexamples
89   Counterexamples now show the rule numbers, and always show ε for rules
90   with an empty right-hand side.  For instance
92     exp
93     ↳ 1: e1       e2     "a"
94          ↳ 3: ε • ↳ 1: ε
96   instead of
98     exp
99     ↳ e1  e2  "a"
100       ↳ • ↳ ε
102 *** Lookahead correction in Java
104   The Java skeleton (lalr1.java) now supports LAC, via the `parse.lac`
105   %define variable.
107 *** Abort parsing for memory exhaustion (C)
109   User actions may now use `YYNOMEM` (similar to `YYACCEPT` and `YYABORT`)
110   to abort the current parse with memory exhaustion.
112 *** Printing locations in debug traces (C)
114   The `YYLOCATION_PRINT(File, Loc)` macro prints a location.  It is defined
115   when (i) locations are enabled, (ii) the default type for locations is
116   used, (iii) debug traces are enabled, and (iv) `YYLOCATION_PRINT` is not
117   already defined.
119   Users may define `YYLOCATION_PRINT` to cover other cases.
121 *** GLR traces
123   There were no debug traces for deferred calls to user actions.  They are
124   logged now.
127 * Noteworthy changes in release 3.7.6 (2021-03-08) [stable]
129 ** Bug fixes
131 *** Reused Push Parsers
133   When a push-parser state structure is used for multiple parses, it was
134   possible for some state to leak from one run into the following one.
136 *** Fix Table Generation
138   In some very rare conditions, when there are many useless tokens, it was
139   possible to generate incorrect parsers.
142 * Noteworthy changes in release 3.7.5 (2021-01-24) [stable]
144 ** Bug fixes
146 *** Counterexample Generation
148   In some cases counterexample generation could crash.  This is fixed.
150 *** Fix Table Generation
152   In some very rare conditions, when there are many useless tokens, it was
153   possible to generate incorrect parsers.
155 *** GLR parsers now support %merge together with api.value.type=union.
157 *** C++ parsers use noexcept in more places.
159 *** Generated parsers avoid some warnings about signedness issues.
161 *** C-language parsers now avoid warnings from pedantic clang.
163 *** C-language parsers now work around quirks of HP-UX 11.23 (2003).
166 * Noteworthy changes in release 3.7.4 (2020-11-14) [stable]
168 ** Bug fixes
170 *** Bug fixes in yacc.c
172   In Yacc mode, all the tokens are defined twice: once as an enum, and then
173   as a macro.  YYEMPTY was missing its macro.
175 *** Bug fixes in lalr1.cc
177   The lalr1.cc skeleton used to emit internal assertions (using YY_ASSERT)
178   even when the `parse.assert` %define variable is not enabled.  It no
179   longer does.
181   The private internal macro YY_ASSERT now obeys the `api.prefix` %define
182   variable.
184   When there is a very large number of tokens, some assertions could be long
185   enough to hit arbitrary limits in Visual C++.  They have been rewritten to
186   work around this limitation.
188 ** Changes
190   The YYBISON macro in generated "regular C parsers" (from the "yacc.c"
191   skeleton) used to be defined to 1.  It is now defined to the version of
192   Bison as an integer (e.g., 30704 for version 3.7.4).
195 * Noteworthy changes in release 3.7.3 (2020-10-13) [stable]
197 ** Bug fixes
199   Fix concurrent build issues.
201   The bison executable is no longer linked uselessly against libreadline.
203   Fix incorrect use of yytname in glr.cc.
206 * Noteworthy changes in release 3.7.2 (2020-09-05) [stable]
208   This release of Bison fixes all known bugs reported for Bison in MITRE's
209   Common Vulnerabilities and Exposures (CVE) system.  These vulnerabilities
210   are only about bison-the-program itself, not the generated code.
212   Although these bugs are typically irrelevant to how Bison is used, they
213   are worth fixing if only to give users peace of mind.
215   There is no known vulnerability in the generated parsers.
217 ** Bug fixes
219   Fix concurrent build issues (introduced in Bison 3.5).
221   Push parsers always use YYMALLOC/YYFREE (no direct calls to malloc/free).
223   Fix portability issues of the test suite, and of bison itself.
225   Some unlikely crashes found by fuzzing have been fixed.  This is only
226   about bison itself, not the generated parsers.
229 * Noteworthy changes in release 3.7.1 (2020-08-02) [stable]
231 ** Bug fixes
233   Crash when a token alias contains a NUL byte.
235   Portability issues with libtextstyle.
237   Portability issues of Bison itself with MSVC.
239 ** Changes
241   Improvements and fixes in the documentation.
243   More precise location about symbol type redefinitions.
246 * Noteworthy changes in release 3.7 (2020-07-23) [stable]
248 ** Deprecated features
250   The YYPRINT macro, which works only with yacc.c and only for tokens, was
251   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
252   It is deprecated and its support will be removed eventually.
254   In conformance with the recommendations of the Graphviz team, in the next
255   version Bison the option `--graph` will generate a *.gv file by default,
256   instead of *.dot.  A transition started in Bison 3.4.
258 ** New features
260 *** Counterexample Generation
262   Contributed by Vincent Imbimbo.
264   When given `-Wcounterexamples`/`-Wcex`, bison will now output
265   counterexamples for conflicts.
267 **** Unifying Counterexamples
269   Unifying counterexamples are strings which can be parsed in two ways due
270   to the conflict.  For example on a grammar that contains the usual
271   "dangling else" ambiguity:
273     $ bison else.y
274     else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
275     else.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
277     $ bison else.y -Wcex
278     else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
279     else.y: warning: shift/reduce conflict on token "else" [-Wcounterexamples]
280       Example: "if" exp "then" "if" exp "then" exp • "else" exp
281       Shift derivation
282         exp
283         ↳ "if" exp "then" exp
284                           ↳ "if" exp "then" exp • "else" exp
285       Example: "if" exp "then" "if" exp "then" exp • "else" exp
286       Reduce derivation
287         exp
288         ↳ "if" exp "then" exp                     "else" exp
289                           ↳ "if" exp "then" exp •
291   When text styling is enabled, colors are used in the examples and the
292   derivations to highlight the structure of both analyses.  In this case,
294     "if" exp "then" [ "if" exp "then" exp • ] "else" exp
296   vs.
298     "if" exp "then" [ "if" exp "then" exp • "else" exp ]
301   The counterexamples are "focused", in two different ways.  First, they do
302   not clutter the output with all the derivations from the start symbol,
303   rather they start on the "conflicted nonterminal". They go straight to the
304   point.  Second, they don't "expand" nonterminal symbols uselessly.
306 **** Nonunifying Counterexamples
308   In the case of the dangling else, Bison found an example that can be
309   parsed in two ways (therefore proving that the grammar is ambiguous).
310   When it cannot find such an example, it instead generates two examples
311   that are the same up until the dot:
313     $ bison foo.y
314     foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
315     foo.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
316     foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
317         4 | a: expr
318           |    ^~~~
320     $ bison -Wcex foo.y
321     foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
322     foo.y: warning: shift/reduce conflict on token ID [-Wcounterexamples]
323       First example: expr • ID ',' ID $end
324       Shift derivation
325         $accept
326         ↳ s                      $end
327           ↳ a                 ID
328             ↳ expr
329               ↳ expr • ID ','
330       Second example: expr • ID $end
331       Reduce derivation
332         $accept
333         ↳ s             $end
334           ↳ a        ID
335             ↳ expr •
336     foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
337         4 | a: expr
338           |    ^~~~
340   In these cases, the parser usually doesn't have enough lookahead to
341   differentiate the two given examples.
343 **** Reports
345   Counterexamples are also included in the report when given
346   `--report=counterexamples`/`-rcex` (or `--report=all`), with more
347   technical details:
349     State 7
351       1 exp: "if" exp "then" exp •  [$end, "then", "else"]
352       2    | "if" exp "then" exp • "else" exp
354       "else"  shift, and go to state 8
356       "else"    [reduce using rule 1 (exp)]
357       $default  reduce using rule 1 (exp)
359       shift/reduce conflict on token "else":
360           1 exp: "if" exp "then" exp •
361           2 exp: "if" exp "then" exp • "else" exp
362         Example: "if" exp "then" "if" exp "then" exp • "else" exp
363         Shift derivation
364           exp
365           ↳ "if" exp "then" exp
366                             ↳ "if" exp "then" exp • "else" exp
367         Example: "if" exp "then" "if" exp "then" exp • "else" exp
368         Reduce derivation
369           exp
370           ↳ "if" exp "then" exp                     "else" exp
371                             ↳ "if" exp "then" exp •
373 *** File prefix mapping
375   Contributed by Joshua Watt.
377   Bison learned a new argument, `--file-prefix-map OLD=NEW`.  Any file path
378   in the output (specifically `#line` directives and `#ifdef` header guards)
379   that begins with the prefix OLD will have it replaced with the prefix NEW,
380   similar to the `-ffile-prefix-map` in GCC.  This option can be used to
381   make bison output reproducible.
383 ** Changes
385 *** Diagnostics
387   When text styling is enabled and the terminal supports it, the warnings
388   now include hyperlinks to the documentation.
390 *** Relocatable installation
392   When installed to be relocatable (via `configure --enable-relocatable`),
393   bison will now also look for a relocated m4.
395 *** C++ file names
397   The `filename_type` %define variable was renamed `api.filename.type`.
398   Instead of
400     %define filename_type "symbol"
402   write
404     %define api.filename.type {symbol}
406   (Or let `bison --update` do it for you).
408   It now defaults to `const std::string` instead of `std::string`.
410 *** Deprecated %define variable names
412   The following variables have been renamed for consistency.  Backward
413   compatibility is ensured, but upgrading is recommended.
415     filename_type       -> api.filename.type
416     package             -> api.package
418 *** Push parsers no longer clear their state when parsing is finished
420   Previously push-parsers cleared their state when parsing was finished (on
421   success and on failure).  This made it impossible to check if there were
422   parse errors, since `yynerrs` was also reset.  This can be especially
423   troublesome when used in autocompletion, since a parser with error
424   recovery would suggest (irrelevant) expected tokens even if there were
425   failures.
427   Now the parser state can be examined when parsing is finished.  The parser
428   state is reset when starting a new parse.
430 ** Documentation
432 *** Examples
434   The bistromathic demonstrates %param and how to quote sources in the error
435   messages:
437     > 123 456
438     1.5-7: syntax error: expected end of file or + or - or * or / or ^ before number
439         1 | 123 456
440           |     ^~~
442 ** Bug fixes
444 *** Include the generated header (yacc.c)
446   Historically, when --defines was used, bison generated a header and pasted
447   an exact copy of it into the generated parser implementation file.  Since
448   Bison 3.4 it is possible to specify that the header should be `#include`d,
449   and how.  For instance
451     %define api.header.include {"parse.h"}
453   or
455     %define api.header.include {<parser/parse.h>}
457   Now api.header.include defaults to `"header-basename"`, as was intended in
458   Bison 3.4, where `header-basename` is the basename of the generated
459   header.  This is disabled when the generated header is `y.tab.h`, to
460   comply with Automake's ylwrap.
462 *** String aliases are faithfully propagated
464   Bison used to interpret user strings (i.e., decoding backslash escapes)
465   when reading them, and to escape them (i.e., issue non-printable
466   characters as backslash escapes, taking the locale into account) when
467   outputting them.  As a consequence non-ASCII strings (say in UTF-8) ended
468   up "ciphered" as sequences of backslash escapes.  This happened not only
469   in the generated sources (where the compiler will reinterpret them), but
470   also in all the generated reports (text, xml, html, dot, etc.).  Reports
471   were therefore not readable when string aliases were not pure ASCII.
472   Worse yet: the output depended on the user's locale.
474   Now Bison faithfully treats the string aliases exactly the way the user
475   spelled them.  This fixes all the aforementioned problems.  However, now,
476   string aliases semantically equivalent but syntactically different (e.g.,
477   "A", "\x41", "\101") are considered to be different.
479 *** Crash when generating IELR
481   An old, well hidden, bug in the generation of IELR parsers was fixed.
484 * Noteworthy changes in release 3.6.4 (2020-06-15) [stable]
486 ** Bug fixes
488   In glr.cc some internal macros leaked in the user's code, and could damage
489   access to the token kinds.
492 * Noteworthy changes in release 3.6.3 (2020-06-03) [stable]
494 ** Bug fixes
496   Incorrect comments in the generated parsers.
498   Warnings in push parsers (yacc.c).
500   Incorrect display of gotos in LAC traces (lalr1.cc).
503 * Noteworthy changes in release 3.6.2 (2020-05-17) [stable]
505 ** Bug fixes
507   Some tests were fixed.
509   When token aliases contain comment delimiters:
511     %token FOO "/* foo */"
513   bison used to emit "nested" comments, which is invalid C.
516 * Noteworthy changes in release 3.6.1 (2020-05-10) [stable]
518 ** Bug fixes
520   Restored ANSI-C compliance in yacc.c.
522   GNU readline portability issues.
524   In C++, yy::parser::symbol_name is now a public member, as was intended.
526 ** New features
528   In C++, yy::parser::symbol_type now has a public name() member function.
531 * Noteworthy changes in release 3.6 (2020-05-08) [stable]
533 ** Backward incompatible changes
535   TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose".
537   The YYERROR_VERBOSE macro is no longer supported; the parsers that still
538   depend on it will now produce Yacc-like error messages (just "syntax
539   error").  It was superseded by the "%error-verbose" directive in Bison
540   1.875 (2003-01-01).  Bison 2.6 (2012-07-19) clearly announced that support
541   for YYERROR_VERBOSE would be removed.  Note that since Bison 3.0
542   (2013-07-25), "%error-verbose" is deprecated in favor of "%define
543   parse.error verbose".
545 ** Deprecated features
547   The YYPRINT macro, which works only with yacc.c and only for tokens, was
548   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
549   It is deprecated and its support will be removed eventually.
551 ** New features
553 *** Improved syntax error messages
555   Two new values for the %define parse.error variable offer more control to
556   the user.  Available in all the skeletons (C, C++, Java).
558 **** %define parse.error detailed
560   The behavior of "%define parse.error detailed" is closely resembling that
561   of "%define parse.error verbose" with a few exceptions.  First, it is safe
562   to use non-ASCII characters in token aliases (with 'verbose', the result
563   depends on the locale with which bison was run).  Second, a yysymbol_name
564   function is exposed to the user, instead of the yytnamerr function and the
565   yytname table.  Third, token internationalization is supported (see
566   below).
568 **** %define parse.error custom
570   With this directive, the user forges and emits the syntax error message
571   herself by defining the yyreport_syntax_error function.  A new type,
572   yypcontext_t, captures the circumstances of the error, and provides the
573   user with functions to get details, such as yypcontext_expected_tokens to
574   get the list of expected token kinds.
576   A possible implementation of yyreport_syntax_error is:
578     int
579     yyreport_syntax_error (const yypcontext_t *ctx)
580     {
581       int res = 0;
582       YY_LOCATION_PRINT (stderr, *yypcontext_location (ctx));
583       fprintf (stderr, ": syntax error");
584       // Report the tokens expected at this point.
585       {
586         enum { TOKENMAX = 10 };
587         yysymbol_kind_t expected[TOKENMAX];
588         int n = yypcontext_expected_tokens (ctx, expected, TOKENMAX);
589         if (n < 0)
590           // Forward errors to yyparse.
591           res = n;
592         else
593           for (int i = 0; i < n; ++i)
594             fprintf (stderr, "%s %s",
595                      i == 0 ? ": expected" : " or", yysymbol_name (expected[i]));
596       }
597       // Report the unexpected token.
598       {
599         yysymbol_kind_t lookahead = yypcontext_token (ctx);
600         if (lookahead != YYSYMBOL_YYEMPTY)
601           fprintf (stderr, " before %s", yysymbol_name (lookahead));
602       }
603       fprintf (stderr, "\n");
604       return res;
605     }
607 **** Token aliases internationalization
609   When the %define variable parse.error is set to `custom` or `detailed`,
610   one may specify which token aliases are to be translated using _().  For
611   instance
613     %token
614         PLUS   "+"
615         MINUS  "-"
616       <double>
617         NUM _("number")
618       <symrec*>
619         FUN _("function")
620         VAR _("variable")
622   In that case the user must define _() and N_(), and yysymbol_name returns
623   the translated symbol (i.e., it returns '_("variable")' rather that
624   '"variable"').  In Java, the user must provide an i18n() function.
626 *** List of expected tokens (yacc.c)
628   Push parsers may invoke yypstate_expected_tokens at any point during
629   parsing (including even before submitting the first token) to get the list
630   of possible tokens.  This feature can be used to propose autocompletion
631   (see below the "bistromathic" example).
633   It makes little sense to use this feature without enabling LAC (lookahead
634   correction).
636 *** Returning the error token
638   When the scanner returns an invalid token or the undefined token
639   (YYUNDEF), the parser generates an error message and enters error
640   recovery.  Because of that error message, most scanners that find lexical
641   errors generate an error message, and then ignore the invalid input
642   without entering the error-recovery.
644   The scanners may now return YYerror, the error token, to enter the
645   error-recovery mode without triggering an additional error message.  See
646   the bistromathic for an example.
648 *** Deep overhaul of the symbol and token kinds
650   To avoid the confusion with types in programming languages, we now refer
651   to token and symbol "kinds" instead of token and symbol "types".  The
652   documentation and error messages have been revised.
654   All the skeletons have been updated to use dedicated enum types rather
655   than integral types.  Special symbols are now regular citizens, instead of
656   being declared in ad hoc ways.
658 **** Token kinds
660   The "token kind" is what is returned by the scanner, e.g., PLUS, NUMBER,
661   LPAREN, etc.  While backward compatibility is of course ensured, users are
662   nonetheless invited to replace their uses of "enum yytokentype" by
663   "yytoken_kind_t".
665   This type now also includes tokens that were previously hidden: YYEOF (end
666   of input), YYUNDEF (undefined token), and YYerror (error token).  They
667   now have string aliases, internationalized when internationalization is
668   enabled.  Therefore, by default, error messages now refer to "end of file"
669   (internationalized) rather than the cryptic "$end", or to "invalid token"
670   rather than "$undefined".
672   Therefore in most cases it is now useless to define the end-of-line token
673   as follows:
675     %token T_EOF 0 "end of file"
677   Rather simply use "YYEOF" in your scanner.
679 **** Symbol kinds
681   The "symbol kinds" is what the parser actually uses.  (Unless the
682   api.token.raw %define variable is used, the symbol kind of a terminal
683   differs from the corresponding token kind.)
685   They are now exposed as a enum, "yysymbol_kind_t".
687   This allows users to tailor the error messages the way they want, or to
688   process some symbols in a specific way in autocompletion (see the
689   bistromathic example below).
691 *** Modernize display of explanatory statements in diagnostics
693   Since Bison 2.7, output was indented four spaces for explanatory
694   statements.  For example:
696     input.y:2.7-13: error: %type redeclaration for exp
697     input.y:1.7-11:     previous declaration
699   Since the introduction of caret-diagnostics, it became less clear.  This
700   indentation has been removed and submessages are displayed similarly as in
701   GCC:
703     input.y:2.7-13: error: %type redeclaration for exp
704         2 | %type <float> exp
705           |       ^~~~~~~
706     input.y:1.7-11: note: previous declaration
707         1 | %type <int> exp
708           |       ^~~~~
710   Contributed by Victor Morales Cayuela.
712 *** C++
714   The token and symbol kinds are yy::parser::token_kind_type and
715   yy::parser::symbol_kind_type.
717   The symbol_type::kind() member function allows to get the kind of a
718   symbol.  This can be used to write unit tests for scanners, e.g.,
720     yy::parser::symbol_type t = make_NUMBER ("123");
721     assert (t.kind () == yy::parser::symbol_kind::S_NUMBER);
722     assert (t.value.as<int> () == 123);
724 ** Documentation
726 *** User Manual
728   In order to avoid ambiguities with "type" as in "typing", we now refer to
729   the "token kind" (e.g., `PLUS`, `NUMBER`, etc.) rather than the "token
730   type".  We now also refer to the "symbol type" (e.g., `PLUS`, `expr`,
731   etc.).
733 *** Examples
735   There are now examples/java: a very simple calculator, and a more complete
736   one (push-parser, location tracking, and debug traces).
738   The lexcalc example (a simple example in C based on Flex and Bison) now
739   also demonstrates location tracking.
742   A new C example, bistromathic, is a fully featured interactive calculator
743   using many Bison features: pure interface, push parser, autocompletion
744   based on the current parser state (using yypstate_expected_tokens),
745   location tracking, internationalized custom error messages, lookahead
746   correction, rich debug traces, etc.
748   It shows how to depend on the symbol kinds to tailor autocompletion.  For
749   instance it recognizes the symbol kind "VARIABLE" to propose
750   autocompletion on the existing variables, rather than of the word
751   "variable".
754 * Noteworthy changes in release 3.5.4 (2020-04-05) [stable]
756 ** WARNING: Future backward-incompatibilities!
758   TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose".
760   Bison 3.6 will no longer support the YYERROR_VERBOSE macro; the parsers
761   that still depend on it will produce Yacc-like error messages (just
762   "syntax error").  It was superseded by the "%error-verbose" directive in
763   Bison 1.875 (2003-01-01).  Bison 2.6 (2012-07-19) clearly announced that
764   support for YYERROR_VERBOSE would be removed.  Note that since Bison 3.0
765   (2013-07-25), "%error-verbose" is deprecated in favor of "%define
766   parse.error verbose".
768 ** Bug fixes
770   Fix portability issues of the package itself on old compilers.
772   Fix api.token.raw support in Java.
775 * Noteworthy changes in release 3.5.3 (2020-03-08) [stable]
777 ** Bug fixes
779   Error messages could quote lines containing zero-width characters (such as
780   \005) with incorrect styling.  Fixes for similar issues with unexpectedly
781   short lines (e.g., the file was changed between parsing and diagnosing).
783   Some unlikely crashes found by fuzzing have been fixed.  This is only
784   about bison itself, not the generated parsers.
787 * Noteworthy changes in release 3.5.2 (2020-02-13) [stable]
789 ** Bug fixes
791   Portability issues and minor cosmetic issues.
793   The lalr1.cc skeleton properly rejects unsupported values for parse.lac
794   (as yacc.c does).
797 * Noteworthy changes in release 3.5.1 (2020-01-19) [stable]
799 ** Bug fixes
801   Portability fixes.
803   Fix compiler warnings.
806 * Noteworthy changes in release 3.5 (2019-12-11) [stable]
808 ** Backward incompatible changes
810   Lone carriage-return characters (aka \r or ^M) in the grammar files are no
811   longer treated as end-of-lines.  This changes the diagnostics, and in
812   particular their locations.
814   In C++, line numbers and columns are now represented as 'int' not
815   'unsigned', so that integer overflow on positions is easily checkable via
816   'gcc -fsanitize=undefined' and the like.  This affects the API for
817   positions.  The default position and location classes now expose
818   'counter_type' (int), used to define line and column numbers.
820 ** Deprecated features
822   The YYPRINT macro, which works only with yacc.c and only for tokens, was
823   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
824   It is deprecated and its support will be removed eventually.
826 ** New features
828 *** Lookahead correction in C++
830   Contributed by Adrian Vogelsgesang.
832   The C++ deterministic skeleton (lalr1.cc) now supports LAC, via the
833   %define variable parse.lac.
835 *** Variable api.token.raw: Optimized token numbers (all skeletons)
837   In the generated parsers, tokens have two numbers: the "external" token
838   number as returned by yylex (which starts at 257), and the "internal"
839   symbol number (which starts at 3).  Each time yylex is called, a table
840   lookup maps the external token number to the internal symbol number.
842   When the %define variable api.token.raw is set, tokens are assigned their
843   internal number, which saves one table lookup per token, and also saves
844   the generation of the mapping table.
846   The gain is typically moderate, but in extreme cases (very simple user
847   actions), a 10% improvement can be observed.
849 *** Generated parsers use better types for states
851   Stacks now use the best integral type for state numbers, instead of always
852   using 15 bits.  As a result "small" parsers now have a smaller memory
853   footprint (they use 8 bits), and there is support for large automata (16
854   bits), and extra large (using int, i.e., typically 31 bits).
856 *** Generated parsers prefer signed integer types
858   Bison skeletons now prefer signed to unsigned integer types when either
859   will do, as the signed types are less error-prone and allow for better
860   checking with 'gcc -fsanitize=undefined'.  Also, the types chosen are now
861   portable to unusual machines where char, short and int are all the same
862   width.  On non-GNU platforms this may entail including <limits.h> and (if
863   available) <stdint.h> to define integer types and constants.
865 *** A skeleton for the D programming language
867   For the last few releases, Bison has shipped a stealth experimental
868   skeleton: lalr1.d.  It was first contributed by Oliver Mangold, based on
869   Paolo Bonzini's lalr1.java, and was cleaned and improved thanks to
870   H. S. Teoh.
872   However, because nobody has committed to improving, testing, and
873   documenting this skeleton, it is not clear that it will be supported in
874   the future.
876   The lalr1.d skeleton *is functional*, and works well, as demonstrated in
877   examples/d/calc.d.  Please try it, enjoy it, and... commit to support it.
879 *** Debug traces in Java
881   The Java backend no longer emits code and data for parser tracing if the
882   %define variable parse.trace is not defined.
884 ** Diagnostics
886 *** New diagnostic: -Wdangling-alias
888   String literals, which allow for better error messages, are (too)
889   liberally accepted by Bison, which might result in silent errors.  For
890   instance
892     %type <exVal> cond "condition"
894   does not define "condition" as a string alias to 'cond' (nonterminal
895   symbols do not have string aliases).  It is rather equivalent to
897     %nterm <exVal> cond
898     %token <exVal> "condition"
900   i.e., it gives the type 'exVal' to the "condition" token, which was
901   clearly not the intention.
903   Also, because string aliases need not be defined, typos such as "baz"
904   instead of "bar" will be not reported.
906   The option `-Wdangling-alias` catches these situations.  On
908     %token BAR "bar"
909     %type <ival> foo "foo"
910     %%
911     foo: "baz" {}
913   bison -Wdangling-alias reports
915     warning: string literal not attached to a symbol
916           | %type <ival> foo "foo"
917           |                  ^~~~~
918     warning: string literal not attached to a symbol
919           | foo: "baz" {}
920           |      ^~~~~
922    The `-Wall` option does not (yet?) include `-Wdangling-alias`.
924 *** Better POSIX Yacc compatibility diagnostics
926   POSIX Yacc restricts %type to nonterminals.  This is now diagnosed by
927   -Wyacc.
929     %token TOKEN1
930     %type  <ival> TOKEN1 TOKEN2 't'
931     %token TOKEN2
932     %%
933     expr:
935   gives with -Wyacc
937     input.y:2.15-20: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
938         2 | %type  <ival> TOKEN1 TOKEN2 't'
939           |               ^~~~~~
940     input.y:2.29-31: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
941         2 | %type  <ival> TOKEN1 TOKEN2 't'
942           |                             ^~~
943     input.y:2.22-27: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
944         2 | %type  <ival> TOKEN1 TOKEN2 't'
945           |                      ^~~~~~
947 *** Diagnostics with insertion
949   The diagnostics now display the suggestion below the underlined source.
950   Replacement for undeclared symbols are now also suggested.
952     $ cat /tmp/foo.y
953     %%
954     list: lis '.' |
956     $ bison -Wall foo.y
957     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'?
958         2 | list: lis '.' |
959           |       ^~~
960           |       list
961     foo.y:2.16: warning: empty rule without %empty [-Wempty-rule]
962         2 | list: lis '.' |
963           |                ^
964           |                %empty
965     foo.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
967 *** Diagnostics about long lines
969   Quoted sources may now be truncated to fit the screen.  For instance, on a
970   30-column wide terminal:
972     $ cat foo.y
973     %token FOO                       FOO                         FOO
974     %%
975     exp: FOO
976     $ bison foo.y
977     foo.y:1.34-36: warning: symbol FOO redeclared [-Wother]
978         1 | …         FOO                  …
979           |           ^~~
980     foo.y:1.8-10:      previous declaration
981         1 | %token FOO                     …
982           |        ^~~
983     foo.y:1.62-64: warning: symbol FOO redeclared [-Wother]
984         1 | …         FOO
985           |           ^~~
986     foo.y:1.8-10:      previous declaration
987         1 | %token FOO                     …
988           |        ^~~
990 ** Changes
992 *** Debugging glr.c and glr.cc
994   The glr.c skeleton always had asserts to check its own behavior (not the
995   user's).  These assertions are now under the control of the parse.assert
996   %define variable (disabled by default).
998 *** Clean up
1000   Several new compiler warnings in the generated output have been avoided.
1001   Some unused features are no longer emitted.  Cleaner generated code in
1002   general.
1004 ** Bug Fixes
1006   Portability issues in the test suite.
1008   In theory, parsers using %nonassoc could crash when reporting verbose
1009   error messages. This unlikely bug has been fixed.
1011   In Java, %define api.prefix was ignored.  It now behaves as expected.
1014 * Noteworthy changes in release 3.4.2 (2019-09-12) [stable]
1016 ** Bug fixes
1018   In some cases, when warnings are disabled, bison could emit tons of white
1019   spaces as diagnostics.
1021   When running out of memory, bison could crash (found by fuzzing).
1023   When defining twice the EOF token, bison would crash.
1025   New warnings from recent compilers have been addressed in the generated
1026   parsers (yacc.c, glr.c, glr.cc).
1028   When lone carriage-return characters appeared in the input file,
1029   diagnostics could hang forever.
1032 * Noteworthy changes in release 3.4.1 (2019-05-22) [stable]
1034 ** Bug fixes
1036   Portability fixes.
1039 * Noteworthy changes in release 3.4 (2019-05-19) [stable]
1041 ** Deprecated features
1043   The %pure-parser directive is deprecated in favor of '%define api.pure'
1044   since Bison 2.3b (2008-05-27), but no warning was issued; there is one
1045   now.  Note that since Bison 2.7 you are strongly encouraged to use
1046   '%define api.pure full' instead of '%define api.pure'.
1048 ** New features
1050 *** Colored diagnostics
1052   As an experimental feature, diagnostics are now colored, controlled by the
1053   new options --color and --style.
1055   To use them, install the libtextstyle library before configuring Bison.
1056   It is available from
1058     https://alpha.gnu.org/gnu/gettext/
1060   for instance
1062     https://alpha.gnu.org/gnu/gettext/libtextstyle-0.8.tar.gz
1064   The option --color supports the following arguments:
1065     - always, yes: Enable colors.
1066     - never, no: Disable colors.
1067     - auto, tty (default): Enable colors if the output device is a tty.
1069   To customize the styles, create a CSS file similar to
1071     /* bison-bw.css */
1072     .warning   { }
1073     .error     { font-weight: 800; text-decoration: underline; }
1074     .note      { }
1076   then invoke bison with --style=bison-bw.css, or set the BISON_STYLE
1077   environment variable to "bison-bw.css".
1079 *** Disabling output
1081   When given -fsyntax-only, the diagnostics are reported, but no output is
1082   generated.
1084   The name of this option is somewhat misleading as bison does more than
1085   just checking the syntax: every stage is run (including checking for
1086   conflicts for instance), except the generation of the output files.
1088 *** Include the generated header (yacc.c)
1090   Before, when --defines is used, bison generated a header, and pasted an
1091   exact copy of it into the generated parser implementation file.  If the
1092   header name is not "y.tab.h", it is now #included instead of being
1093   duplicated.
1095   To use an '#include' even if the header name is "y.tab.h" (which is what
1096   happens with --yacc, or when using the Autotools' ylwrap), define
1097   api.header.include to the exact argument to pass to #include.  For
1098   instance:
1100     %define api.header.include {"parse.h"}
1102   or
1104     %define api.header.include {<parser/parse.h>}
1106 *** api.location.type is now supported in C (yacc.c, glr.c)
1108   The %define variable api.location.type defines the name of the type to use
1109   for locations.  When defined, Bison no longer defines YYLTYPE.
1111   This can be used in programs with several parsers to factor their
1112   definition of locations: let one of them generate them, and the others
1113   just use them.
1115 ** Changes
1117 *** Graphviz output
1119   In conformance with the recommendations of the Graphviz team, if %require
1120   "3.4" (or better) is specified, the option --graph generates a *.gv file
1121   by default, instead of *.dot.
1123 *** Diagnostics overhaul
1125   Column numbers were wrong with multibyte characters, which would also
1126   result in skewed diagnostics with carets.  Beside, because we were
1127   indenting the quoted source with a single space, lines with tab characters
1128   were incorrectly underlined.
1130   To address these issues, and to be clearer, Bison now issues diagnostics
1131   as GCC9 does.  For instance it used to display (there's a tab before the
1132   opening brace):
1134     foo.y:3.37-38: error: $2 of ‘expr’ has no declared type
1135      expr: expr '+' "number"        { $$ = $1 + $2; }
1136                                          ^~
1137   It now reports
1139     foo.y:3.37-38: error: $2 of ‘expr’ has no declared type
1140         3 | expr: expr '+' "number" { $$ = $1 + $2; }
1141           |                                     ^~
1143   Other constructs now also have better locations, resulting in more precise
1144   diagnostics.
1146 *** Fix-it hints for %empty
1148   Running Bison with -Wempty-rules and --update will remove incorrect %empty
1149   annotations, and add the missing ones.
1151 *** Generated reports
1153   The format of the reports (parse.output) was improved for readability.
1155 *** Better support for --no-line.
1157   When --no-line is used, the generated files are now cleaner: no lines are
1158   generated instead of empty lines.  Together with using api.header.include,
1159   that should help people saving the generated files into version control
1160   systems get smaller diffs.
1162 ** Documentation
1164   A new example in C shows an simple infix calculator with a hand-written
1165   scanner (examples/c/calc).
1167   A new example in C shows a reentrant parser (capable of recursive calls)
1168   built with Flex and Bison (examples/c/reccalc).
1170   There is a new section about the history of Yaccs and Bison.
1172 ** Bug fixes
1174   A few obscure bugs were fixed, including the second oldest (known) bug in
1175   Bison: it was there when Bison was entered in the RCS version control
1176   system, in December 1987.  See the NEWS of Bison 3.3 for the previous
1177   oldest bug.
1180 * Noteworthy changes in release 3.3.2 (2019-02-03) [stable]
1182 ** Bug fixes
1184   Bison 3.3 failed to generate parsers for grammars with unused nonterminal
1185   symbols.
1188 * Noteworthy changes in release 3.3.1 (2019-01-27) [stable]
1190 ** Changes
1192   The option -y/--yacc used to imply -Werror=yacc, which turns uses of Bison
1193   extensions into errors.  It now makes them simple warnings (-Wyacc).
1196 * Noteworthy changes in release 3.3 (2019-01-26) [stable]
1198   A new mailing list was created, Bison Announce.  It is low traffic, and is
1199   only about announcing new releases and important messages (e.g., polls
1200   about major decisions to make).
1202   https://lists.gnu.org/mailman/listinfo/bison-announce
1204 ** Backward incompatible changes
1206   Support for DJGPP, which has been unmaintained and untested for years, is
1207   removed.
1209 ** Deprecated features
1211   A new feature, --update (see below) helps adjusting existing grammars to
1212   deprecations.
1214 *** Deprecated directives
1216   The %error-verbose directive is deprecated in favor of '%define
1217   parse.error verbose' since Bison 3.0, but no warning was issued.
1219   The '%name-prefix "xx"' directive is deprecated in favor of '%define
1220   api.prefix {xx}' since Bison 3.0, but no warning was issued.  These
1221   directives are slightly different, you might need to adjust your code.
1222   %name-prefix renames only symbols with external linkage, while api.prefix
1223   also renames types and macros, including YYDEBUG, YYTOKENTYPE,
1224   yytokentype, YYSTYPE, YYLTYPE, etc.
1226   Users of Flex that move from '%name-prefix "xx"' to '%define api.prefix
1227   {xx}' will typically have to update YY_DECL from
1229     #define YY_DECL int xxlex (YYSTYPE *yylval, YYLTYPE *yylloc)
1231   to
1233     #define YY_DECL int xxlex (XXSTYPE *yylval, XXLTYPE *yylloc)
1235 *** Deprecated %define variable names
1237   The following variables, mostly related to parsers in Java, have been
1238   renamed for consistency.  Backward compatibility is ensured, but upgrading
1239   is recommended.
1241     abstract           -> api.parser.abstract
1242     annotations        -> api.parser.annotations
1243     extends            -> api.parser.extends
1244     final              -> api.parser.final
1245     implements         -> api.parser.implements
1246     parser_class_name  -> api.parser.class
1247     public             -> api.parser.public
1248     strictfp           -> api.parser.strictfp
1250 ** New features
1252 *** Generation of fix-its for IDEs/Editors
1254   When given the new option -ffixit (aka -fdiagnostics-parseable-fixits),
1255   bison now generates machine readable editing instructions to fix some
1256   issues.  Currently, this is mostly limited to updating deprecated
1257   directives and removing duplicates.  For instance:
1259     $ cat foo.y
1260     %error-verbose
1261     %define parser_class_name "Parser"
1262     %define api.parser.class "Parser"
1263     %%
1264     exp:;
1266   See the "fix-it:" lines below:
1268     $ bison -ffixit foo.y
1269     foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated]
1270      %error-verbose
1271      ^~~~~~~~~~~~~~
1272     fix-it:"foo.y":{1:1-1:15}:"%define parse.error verbose"
1273     foo.y:2.1-34: warning: deprecated directive, use '%define api.parser.class {Parser}' [-Wdeprecated]
1274      %define parser_class_name "Parser"
1275      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1276     fix-it:"foo.y":{2:1-2:35}:"%define api.parser.class {Parser}"
1277     foo.y:3.1-33: error: %define variable 'api.parser.class' redefined
1278      %define api.parser.class "Parser"
1279      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1280     foo.y:2.1-34:     previous definition
1281      %define parser_class_name "Parser"
1282      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1283     fix-it:"foo.y":{3:1-3:34}:""
1284     foo.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
1286   This uses the same output format as GCC and Clang.
1288 *** Updating grammar files
1290   Fixes can be applied on the fly.  The previous example ends with the
1291   suggestion to re-run bison with the option -u/--update, which results in a
1292   cleaner grammar file.
1294     $ bison --update foo.y
1295     [...]
1296     bison: file 'foo.y' was updated (backup: 'foo.y~')
1298     $ cat foo.y
1299     %define parse.error verbose
1300     %define api.parser.class {Parser}
1301     %%
1302     exp:;
1304 *** Bison is now relocatable
1306   If you pass '--enable-relocatable' to 'configure', Bison is relocatable.
1308   A relocatable program can be moved or copied to a different location on
1309   the file system.  It can also be used through mount points for network
1310   sharing.  It is possible to make symbolic links to the installed and moved
1311   programs, and invoke them through the symbolic link.
1313 *** %expect and %expect-rr modifiers on individual rules
1315   One can now document (and check) which rules participate in shift/reduce
1316   and reduce/reduce conflicts.  This is particularly important GLR parsers,
1317   where conflicts are a normal occurrence.  For example,
1319       %glr-parser
1320       %expect 1
1321       %%
1323       ...
1325       argument_list:
1326         arguments %expect 1
1327       | arguments ','
1328       | %empty
1329       ;
1331       arguments:
1332         expression
1333       | argument_list ',' expression
1334       ;
1336       ...
1338   Looking at the output from -v, one can see that the shift/reduce conflict
1339   here is due to the fact that the parser does not know whether to reduce
1340   arguments to argument_list until it sees the token _after_ the following
1341   ','.  By marking the rule with %expect 1 (because there is a conflict in
1342   one state), we document the source of the 1 overall shift/reduce conflict.
1344   In GLR parsers, we can use %expect-rr in a rule for reduce/reduce
1345   conflicts.  In this case, we mark each of the conflicting rules.  For
1346   example,
1348       %glr-parser
1349       %expect-rr 1
1351       %%
1353       stmt:
1354         target_list '=' expr ';'
1355       | expr_list ';'
1356       ;
1358       target_list:
1359         target
1360       | target ',' target_list
1361       ;
1363       target:
1364         ID %expect-rr 1
1365       ;
1367       expr_list:
1368         expr
1369       | expr ',' expr_list
1370       ;
1372       expr:
1373         ID %expect-rr 1
1374       | ...
1375       ;
1377   In a statement such as
1379       x, y = 3, 4;
1381   the parser must reduce x to a target or an expr, but does not know which
1382   until it sees the '='.  So we notate the two possible reductions to
1383   indicate that each conflicts in one rule.
1385   This feature needs user feedback, and might evolve in the future.
1387 *** C++: Actual token constructors
1389   When variants and token constructors are enabled, in addition to the
1390   type-safe named token constructors (make_ID, make_INT, etc.), we now
1391   generate genuine constructors for symbol_type.
1393   For instance with these declarations
1395     %token           ':'
1396        <std::string> ID
1397        <int>         INT;
1399   you may use these constructors:
1401     symbol_type (int token, const std::string&);
1402     symbol_type (int token, const int&);
1403     symbol_type (int token);
1405   Correct matching between token types and value types is checked via
1406   'assert'; for instance, 'symbol_type (ID, 42)' would abort.  Named
1407   constructors are preferable, as they offer better type safety (for
1408   instance 'make_ID (42)' would not even compile), but symbol_type
1409   constructors may help when token types are discovered at run-time, e.g.,
1411      [a-z]+   {
1412                 if (auto i = lookup_keyword (yytext))
1413                   return yy::parser::symbol_type (i);
1414                 else
1415                   return yy::parser::make_ID (yytext);
1416               }
1418 *** C++: Variadic emplace
1420   If your application requires C++11 and you don't use symbol constructors,
1421   you may now use a variadic emplace for semantic values:
1423     %define api.value.type variant
1424     %token <std::pair<int, int>> PAIR
1426   in your scanner:
1428     int yylex (parser::semantic_type *lvalp)
1429     {
1430       lvalp->emplace <std::pair<int, int>> (1, 2);
1431       return parser::token::PAIR;
1432     }
1434 *** C++: Syntax error exceptions in GLR
1436   The glr.cc skeleton now supports syntax_error exceptions thrown from user
1437   actions, or from the scanner.
1439 *** More POSIX Yacc compatibility warnings
1441   More Bison specific directives are now reported with -y or -Wyacc.  This
1442   change was ready since the release of Bison 3.0 in September 2015.  It was
1443   delayed because Autoconf used to define YACC as `bison -y`, which resulted
1444   in numerous warnings for Bison users that use the GNU Build System.
1446   If you still experience that problem, either redefine YACC as `bison -o
1447   y.tab.c`, or pass -Wno-yacc to Bison.
1449 *** The tables yyrhs and yyphrs are back
1451   Because no Bison skeleton uses them, these tables were removed (no longer
1452   passed to the skeletons, not even computed) in 2008.  However, some users
1453   have expressed interest in being able to use them in their own skeletons.
1455 ** Bug fixes
1457 *** Incorrect number of reduce/reduce conflicts
1459   On a grammar such as
1461      exp: "num" | "num" | "num"
1463   bison used to report a single RR conflict, instead of two.  This is now
1464   fixed.  This was the oldest (known) bug in Bison: it was there when Bison
1465   was entered in the RCS version control system, in December 1987.
1467   Some grammar files might have to adjust their %expect-rr.
1469 *** Parser directives that were not careful enough
1471   Passing invalid arguments to %nterm, for instance character literals, used
1472   to result in unclear error messages.
1474 ** Documentation
1476   The examples/ directory (installed in .../share/doc/bison/examples) has
1477   been restructured per language for clarity.  The examples come with a
1478   README and a Makefile.  Not only can they be used to toy with Bison, they
1479   can also be starting points for your own grammars.
1481   There is now a Java example, and a simple example in C based on Flex and
1482   Bison (examples/c/lexcalc/).
1484 ** Changes
1486 *** Parsers in C++
1488   They now use noexcept and constexpr.  Please, report missing annotations.
1490 *** Symbol Declarations
1492   The syntax of the variation directives to declare symbols was overhauled
1493   for more consistency, and also better POSIX Yacc compliance (which, for
1494   instance, allows "%type" without actually providing a type).  The %nterm
1495   directive, supported by Bison since its inception, is now documented and
1496   officially supported.
1498   The syntax is now as follows:
1500     %token TAG? ( ID NUMBER? STRING? )+ ( TAG ( ID NUMBER? STRING? )+ )*
1501     %left  TAG? ( ID NUMBER? )+ ( TAG ( ID NUMBER? )+ )*
1502     %type  TAG? ( ID | CHAR | STRING )+ ( TAG ( ID | CHAR | STRING )+ )*
1503     %nterm TAG? ID+ ( TAG ID+ )*
1505   where TAG denotes a type tag such as ‘<ival>’, ID denotes an identifier
1506   such as ‘NUM’, NUMBER a decimal or hexadecimal integer such as ‘300’ or
1507   ‘0x12d’, CHAR a character literal such as ‘'+'’, and STRING a string
1508   literal such as ‘"number"’.  The post-fix quantifiers are ‘?’ (zero or
1509   one), ‘*’ (zero or more) and ‘+’ (one or more).
1512 * Noteworthy changes in release 3.2.4 (2018-12-24) [stable]
1514 ** Bug fixes
1516   Fix the move constructor of symbol_type.
1518   Always provide a copy constructor for symbol_type, even in modern C++.
1521 * Noteworthy changes in release 3.2.3 (2018-12-18) [stable]
1523 ** Bug fixes
1525   Properly support token constructors in C++ with types that include commas
1526   (e.g., std::pair<int, int>).  A regression introduced in Bison 3.2.
1529 * Noteworthy changes in release 3.2.2 (2018-11-21) [stable]
1531 ** Bug fixes
1533   C++ portability issues.
1536 * Noteworthy changes in release 3.2.1 (2018-11-09) [stable]
1538 ** Bug fixes
1540   Several portability issues have been fixed in the build system, in the
1541   test suite, and in the generated parsers in C++.
1544 * Noteworthy changes in release 3.2 (2018-10-29) [stable]
1546 ** Backward incompatible changes
1548   Support for DJGPP, which has been unmaintained and untested for years, is
1549   obsolete.  Unless there is activity to revive it, it will be removed.
1551 ** Changes
1553   %printers should use yyo rather than yyoutput to denote the output stream.
1555   Variant-based symbols in C++ should use emplace() rather than build().
1557   In C++ parsers, parser::operator() is now a synonym for the parser::parse.
1559 ** Documentation
1561   A new section, "A Simple C++ Example", is a tutorial for parsers in C++.
1563   A comment in the generated code now emphasizes that users should not
1564   depend upon non-documented implementation details, such as macros starting
1565   with YY_.
1567 ** New features
1569 *** C++: Support for move semantics (lalr1.cc)
1571   The lalr1.cc skeleton now fully supports C++ move semantics, while
1572   maintaining compatibility with C++98.  You may now store move-only types
1573   when using Bison's variants.  For instance:
1575     %code {
1576       #include <memory>
1577       #include <vector>
1578     }
1580     %skeleton "lalr1.cc"
1581     %define api.value.type variant
1583     %%
1585     %token <int> INT "int";
1586     %type <std::unique_ptr<int>> int;
1587     %type <std::vector<std::unique_ptr<int>>> list;
1589     list:
1590       %empty    {}
1591     | list int  { $$ = std::move($1); $$.emplace_back(std::move($2)); }
1593     int: "int"  { $$ = std::make_unique<int>($1); }
1595 *** C++: Implicit move of right-hand side values (lalr1.cc)
1597   In modern C++ (C++11 and later), you should always use 'std::move' with
1598   the values of the right-hand side symbols ($1, $2, etc.), as they will be
1599   popped from the stack anyway.  Using 'std::move' is mandatory for
1600   move-only types such as unique_ptr, and it provides a significant speedup
1601   for large types such as std::string, or std::vector, etc.
1603   If '%define api.value.automove' is set, every occurrence '$n' is replaced
1604   by 'std::move ($n)'.  The second rule in the previous grammar can be
1605   simplified to:
1607     list: list int  { $$ = $1; $$.emplace_back($2); }
1609   With automove enabled, the semantic values are no longer lvalues, so do
1610   not use the swap idiom:
1612     list: list int  { std::swap($$, $1); $$.emplace_back($2); }
1614   This idiom is anyway obsolete: it is preferable to move than to swap.
1616   A warning is issued when automove is enabled, and a value is used several
1617   times.
1619     input.yy:16.31-32: warning: multiple occurrences of $2 with api.value.automove enabled [-Wother]
1620     exp: "twice" exp   { $$ = $2 + $2; }
1621                                    ^^
1623   Enabling api.value.automove does not require support for modern C++.  The
1624   generated code is valid C++98/03, but will use copies instead of moves.
1626   The new examples/c++/variant-11.yy shows these features in action.
1628 *** C++: The implicit default semantic action is always run
1630   When variants are enabled, the default action was not run, so
1632     exp: "number"
1634   was equivalent to
1636     exp: "number"  {}
1638   It now behaves like in all the other cases, as
1640     exp: "number"  { $$ = $1; }
1642   possibly using std::move if automove is enabled.
1644   We do not expect backward compatibility issues.  However, beware of
1645   forward compatibility issues: if you rely on default actions with
1646   variants, be sure to '%require "3.2"' to avoid older versions of Bison to
1647   generate incorrect parsers.
1649 *** C++: Renaming location.hh
1651   When both %defines and %locations are enabled, Bison generates a
1652   location.hh file.  If you don't use locations outside of the parser, you
1653   may avoid its creation with:
1655     %define api.location.file none
1657   However this file is useful if, for instance, your parser builds an AST
1658   decorated with locations: you may use Bison's location independently of
1659   Bison's parser.  You can now give it another name, for instance:
1661     %define api.location.file "my-location.hh"
1663   This name can have directory components, and even be absolute.  The name
1664   under which the location file is included is controlled by
1665   api.location.include.
1667   This way it is possible to have several parsers share the same location
1668   file.
1670   For instance, in src/foo/parser.hh, generate the include/ast/loc.hh file:
1672     %locations
1673     %define api.namespace {foo}
1674     %define api.location.file "include/ast/loc.hh"
1675     %define api.location.include {<ast/loc.hh>}
1677   and use it in src/bar/parser.hh:
1679     %locations
1680     %define api.namespace {bar}
1681     %code requires {#include <ast/loc.hh>}
1682     %define api.location.type {bar::location}
1684   Absolute file names are supported, so in your Makefile, passing the flag
1685   -Dapi.location.file='"$(top_srcdir)/include/ast/location.hh"' to bison is
1686   safe.
1688 *** C++: stack.hh and position.hh are deprecated
1690   When asked to generate a header file (%defines), the lalr1.cc skeleton
1691   generates a stack.hh file.  This file had no interest for users; it is now
1692   made useless: its content is included in the parser definition.  It is
1693   still generated for backward compatibility.
1695   When in addition to %defines, location support is requested (%locations),
1696   the file position.hh is also generated.  It is now also useless: its
1697   content is now included in location.hh.
1699   These files are no longer generated when your grammar file requires at
1700   least Bison 3.2 (%require "3.2").
1702 ** Bug fixes
1704   Portability issues on MinGW and VS2015.
1706   Portability issues in the test suite.
1708   Portability/warning issues with Flex.
1711 * Noteworthy changes in release 3.1 (2018-08-27) [stable]
1713 ** Backward incompatible changes
1715   Compiling Bison now requires a C99 compiler---as announced during the
1716   release of Bison 3.0, five years ago.  Generated parsers do not require a
1717   C99 compiler.
1719   Support for DJGPP, which has been unmaintained and untested for years, is
1720   obsolete. Unless there is activity to revive it, the next release of Bison
1721   will have it removed.
1723 ** New features
1725 *** Typed midrule actions
1727   Because their type is unknown to Bison, the values of midrule actions are
1728   not treated like the others: they don't have %printer and %destructor
1729   support.  It also prevents C++ (Bison) variants to handle them properly.
1731   Typed midrule actions address these issues.  Instead of:
1733     exp: { $<ival>$ = 1; } { $<ival>$ = 2; }   { $$ = $<ival>1 + $<ival>2; }
1735   write:
1737     exp: <ival>{ $$ = 1; } <ival>{ $$ = 2; }   { $$ = $1 + $2; }
1739 *** Reports include the type of the symbols
1741   The sections about terminal and nonterminal symbols of the '*.output' file
1742   now specify their declared type.  For instance, for:
1744     %token <ival> NUM
1746   the report now shows '<ival>':
1748     Terminals, with rules where they appear
1750     NUM <ival> (258) 5
1752 *** Diagnostics about useless rules
1754   In the following grammar, the 'exp' nonterminal is trivially useless.  So,
1755   of course, its rules are useless too.
1757     %%
1758     input: '0' | exp
1759     exp: exp '+' exp | exp '-' exp | '(' exp ')'
1761   Previously all the useless rules were reported, including those whose
1762   left-hand side is the 'exp' nonterminal:
1764     warning: 1 nonterminal useless in grammar [-Wother]
1765     warning: 4 rules useless in grammar [-Wother]
1766     2.14-16: warning: nonterminal useless in grammar: exp [-Wother]
1767      input: '0' | exp
1768                   ^^^
1769     2.14-16: warning: rule useless in grammar [-Wother]
1770      input: '0' | exp
1771                   ^^^
1772     3.6-16: warning: rule useless in grammar [-Wother]
1773      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1774           ^^^^^^^^^^^
1775     3.20-30: warning: rule useless in grammar [-Wother]
1776      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1777                         ^^^^^^^^^^^
1778     3.34-44: warning: rule useless in grammar [-Wother]
1779      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1780                                       ^^^^^^^^^^^
1782   Now, rules whose left-hand side symbol is useless are no longer reported
1783   as useless.  The locations of the errors have also been adjusted to point
1784   to the first use of the nonterminal as a left-hand side of a rule:
1786     warning: 1 nonterminal useless in grammar [-Wother]
1787     warning: 4 rules useless in grammar [-Wother]
1788     3.1-3: warning: nonterminal useless in grammar: exp [-Wother]
1789      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1790      ^^^
1791     2.14-16: warning: rule useless in grammar [-Wother]
1792      input: '0' | exp
1793                   ^^^
1795 *** C++: Generated parsers can be compiled with -fno-exceptions (lalr1.cc)
1797   When compiled with exceptions disabled, the generated parsers no longer
1798   uses try/catch clauses.
1800   Currently only GCC and Clang are supported.
1802 ** Documentation
1804 *** A demonstration of variants
1806   A new example was added (installed in .../share/doc/bison/examples),
1807   'variant.yy', which shows how to use (Bison) variants in C++.
1809   The other examples were made nicer to read.
1811 *** Some features are no longer 'experimental'
1813   The following features, mature enough, are no longer flagged as
1814   experimental in the documentation: push parsers, default %printer and
1815   %destructor (typed: <*> and untyped: <>), %define api.value.type union and
1816   variant, Java parsers, XML output, LR family (lr, ielr, lalr), and
1817   semantic predicates (%?).
1819 ** Bug fixes
1821 *** GLR: Predicates support broken by #line directives
1823   Predicates (%?) in GLR such as
1825     widget:
1826       %? {new_syntax} 'w' id new_args
1827     | %?{!new_syntax} 'w' id old_args
1829   were issued with #lines in the middle of C code.
1831 *** Printer and destructor with broken #line directives
1833   The #line directives were not properly escaped when emitting the code for
1834   %printer/%destructor, which resulted in compiler errors if there are
1835   backslashes or double-quotes in the grammar file name.
1837 *** Portability on ICC
1839   The Intel compiler claims compatibility with GCC, yet rejects its _Pragma.
1840   Generated parsers now work around this.
1842 *** Various
1844   There were several small fixes in the test suite and in the build system,
1845   many warnings in bison and in the generated parsers were eliminated.  The
1846   documentation also received its share of minor improvements.
1848   Useless code was removed from C++ parsers, and some of the generated
1849   constructors are more 'natural'.
1852 * Noteworthy changes in release 3.0.5 (2018-05-27) [stable]
1854 ** Bug fixes
1856 *** C++: Fix support of 'syntax_error'
1858   One incorrect 'inline' resulted in linking errors about the constructor of
1859   the syntax_error exception.
1861 *** C++: Fix warnings
1863   GCC 7.3 (with -O1 or -O2 but not -O0 or -O3) issued null-dereference
1864   warnings about yyformat being possibly null.  It also warned about the
1865   deprecated implicit definition of copy constructors when there's a
1866   user-defined (copy) assignment operator.
1868 *** Location of errors
1870   In C++ parsers, out-of-bounds errors can happen when a rule with an empty
1871   ride-hand side raises a syntax error.  The behavior of the default parser
1872   (yacc.c) in such a condition was undefined.
1874   Now all the parsers match the behavior of glr.c: @$ is used as the
1875   location of the error.  This handles gracefully rules with and without
1876   rhs.
1878 *** Portability fixes in the test suite
1880   On some platforms, some Java and/or C++ tests were failing.
1883 * Noteworthy changes in release 3.0.4 (2015-01-23) [stable]
1885 ** Bug fixes
1887 *** C++ with Variants (lalr1.cc)
1889   Fix a compiler warning when no %destructor use $$.
1891 *** Test suites
1893   Several portability issues in tests were fixed.
1896 * Noteworthy changes in release 3.0.3 (2015-01-15) [stable]
1898 ** Bug fixes
1900 *** C++ with Variants (lalr1.cc)
1902   Problems with %destructor and '%define parse.assert' have been fixed.
1904 *** Named %union support (yacc.c, glr.c)
1906   Bison 3.0 introduced a regression on named %union such as
1908     %union foo { int ival; };
1910   The possibility to use a name was introduced "for Yacc compatibility".
1911   It is however not required by POSIX Yacc, and its usefulness is not clear.
1913 *** %define api.value.type union with %defines (yacc.c, glr.c)
1915   The C parsers were broken when %defines was used together with "%define
1916   api.value.type union".
1918 *** Redeclarations are reported in proper order
1920   On
1922     %token FOO "foo"
1923     %printer {} "foo"
1924     %printer {} FOO
1926   bison used to report:
1928     foo.yy:2.10-11: error: %printer redeclaration for FOO
1929      %printer {} "foo"
1930               ^^
1931     foo.yy:3.10-11:     previous declaration
1932      %printer {} FOO
1933               ^^
1935   Now, the "previous" declaration is always the first one.
1938 ** Documentation
1940   Bison now installs various files in its docdir (which defaults to
1941   '/usr/local/share/doc/bison'), including the three fully blown examples
1942   extracted from the documentation:
1944    - rpcalc
1945      Reverse Polish Calculator, a simple introductory example.
1946    - mfcalc
1947      Multi-function Calc, a calculator with memory and functions and located
1948      error messages.
1949    - calc++
1950      a calculator in C++ using variant support and token constructors.
1953 * Noteworthy changes in release 3.0.2 (2013-12-05) [stable]
1955 ** Bug fixes
1957 *** Generated source files when errors are reported
1959   When warnings are issued and -Werror is set, bison would still generate
1960   the source files (*.c, *.h...).  As a consequence, some runs of "make"
1961   could fail the first time, but not the second (as the files were generated
1962   anyway).
1964   This is fixed: bison no longer generates this source files, but, of
1965   course, still produces the various reports (*.output, *.xml, etc.).
1967 *** %empty is used in reports
1969   Empty right-hand sides are denoted by '%empty' in all the reports (text,
1970   dot, XML and formats derived from it).
1972 *** YYERROR and variants
1974   When C++ variant support is enabled, an error triggered via YYERROR, but
1975   not caught via error recovery, resulted in a double deletion.
1978 * Noteworthy changes in release 3.0.1 (2013-11-12) [stable]
1980 ** Bug fixes
1982 *** Errors in caret diagnostics
1984   On some platforms, some errors could result in endless diagnostics.
1986 *** Fixes of the -Werror option
1988   Options such as "-Werror -Wno-error=foo" were still turning "foo"
1989   diagnostics into errors instead of warnings.  This is fixed.
1991   Actually, for consistency with GCC, "-Wno-error=foo -Werror" now also
1992   leaves "foo" diagnostics as warnings.  Similarly, with "-Werror=foo
1993   -Wno-error", "foo" diagnostics are now errors.
1995 *** GLR Predicates
1997   As demonstrated in the documentation, one can now leave spaces between
1998   "%?" and its "{".
2000 *** Installation
2002   The yacc.1 man page is no longer installed if --disable-yacc was
2003   specified.
2005 *** Fixes in the test suite
2007   Bugs and portability issues.
2010 * Noteworthy changes in release 3.0 (2013-07-25) [stable]
2012 ** WARNING: Future backward-incompatibilities!
2014   Like other GNU packages, Bison will start using some of the C99 features
2015   for its own code, especially the definition of variables after statements.
2016   The generated C parsers still aim at C90.
2018 ** Backward incompatible changes
2020 *** Obsolete features
2022   Support for YYFAIL is removed (deprecated in Bison 2.4.2): use YYERROR.
2024   Support for yystype and yyltype is removed (deprecated in Bison 1.875):
2025   use YYSTYPE and YYLTYPE.
2027   Support for YYLEX_PARAM and YYPARSE_PARAM is removed (deprecated in Bison
2028   1.875): use %lex-param, %parse-param, or %param.
2030   Missing semicolons at the end of actions are no longer added (as announced
2031   in the release 2.5).
2033 *** Use of YACC='bison -y'
2035   TL;DR: With Autoconf <= 2.69, pass -Wno-yacc to (AM_)YFLAGS if you use
2036   Bison extensions.
2038   Traditional Yacc generates 'y.tab.c' whatever the name of the input file.
2039   Therefore Makefiles written for Yacc expect 'y.tab.c' (and possibly
2040   'y.tab.h' and 'y.output') to be generated from 'foo.y'.
2042   To this end, for ages, AC_PROG_YACC, Autoconf's macro to look for an
2043   implementation of Yacc, was using Bison as 'bison -y'.  While it does
2044   ensure compatible output file names, it also enables warnings for
2045   incompatibilities with POSIX Yacc.  In other words, 'bison -y' triggers
2046   warnings for Bison extensions.
2048   Autoconf 2.70+ fixes this incompatibility by using YACC='bison -o y.tab.c'
2049   (which also generates 'y.tab.h' and 'y.output' when needed).
2050   Alternatively, disable Yacc warnings by passing '-Wno-yacc' to your Yacc
2051   flags (YFLAGS, or AM_YFLAGS with Automake).
2053 ** Bug fixes
2055 *** The epilogue is no longer affected by internal #defines (glr.c)
2057   The glr.c skeleton uses defines such as #define yylval (yystackp->yyval) in
2058   generated code.  These weren't properly undefined before the inclusion of
2059   the user epilogue, so functions such as the following were butchered by the
2060   preprocessor expansion:
2062     int yylex (YYSTYPE *yylval);
2064   This is fixed: yylval, yynerrs, yychar, and yylloc are now valid
2065   identifiers for user-provided variables.
2067 *** stdio.h is no longer needed when locations are enabled (yacc.c)
2069   Changes in Bison 2.7 introduced a dependency on FILE and fprintf when
2070   locations are enabled.  This is fixed.
2072 *** Warnings about useless %pure-parser/%define api.pure are restored
2074 ** Diagnostics reported by Bison
2076   Most of these features were contributed by Théophile Ranquet and Victor
2077   Santet.
2079 *** Carets
2081   Version 2.7 introduced caret errors, for a prettier output.  These are now
2082   activated by default.  The old format can still be used by invoking Bison
2083   with -fno-caret (or -fnone).
2085   Some error messages that reproduced excerpts of the grammar are now using
2086   the caret information only.  For instance on:
2088     %%
2089     exp: 'a' | 'a';
2091   Bison 2.7 reports:
2093     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2094     in.y:2.12-14: warning: rule useless in parser due to conflicts: exp: 'a' [-Wother]
2096   Now bison reports:
2098     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2099     in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
2100      exp: 'a' | 'a';
2101                 ^^^
2103   and "bison -fno-caret" reports:
2105     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2106     in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
2108 *** Enhancements of the -Werror option
2110   The -Werror=CATEGORY option is now recognized, and will treat specified
2111   warnings as errors. The warnings need not have been explicitly activated
2112   using the -W option, this is similar to what GCC 4.7 does.
2114   For example, given the following command line, Bison will treat both
2115   warnings related to POSIX Yacc incompatibilities and S/R conflicts as
2116   errors (and only those):
2118     $ bison -Werror=yacc,error=conflicts-sr input.y
2120   If no categories are specified, -Werror will make all active warnings into
2121   errors. For example, the following line does the same the previous example:
2123     $ bison -Werror -Wnone -Wyacc -Wconflicts-sr input.y
2125   (By default -Wconflicts-sr,conflicts-rr,deprecated,other is enabled.)
2127   Note that the categories in this -Werror option may not be prefixed with
2128   "no-". However, -Wno-error[=CATEGORY] is valid.
2130   Note that -y enables -Werror=yacc. Therefore it is now possible to require
2131   Yacc-like behavior (e.g., always generate y.tab.c), but to report
2132   incompatibilities as warnings: "-y -Wno-error=yacc".
2134 *** The display of warnings is now richer
2136   The option that controls a given warning is now displayed:
2138     foo.y:4.6: warning: type clash on default action: <foo> != <bar> [-Wother]
2140   In the case of warnings treated as errors, the prefix is changed from
2141   "warning: " to "error: ", and the suffix is displayed, in a manner similar
2142   to GCC, as [-Werror=CATEGORY].
2144   For instance, where the previous version of Bison would report (and exit
2145   with failure):
2147     bison: warnings being treated as errors
2148     input.y:1.1: warning: stray ',' treated as white space
2150   it now reports:
2152     input.y:1.1: error: stray ',' treated as white space [-Werror=other]
2154 *** Deprecated constructs
2156   The new 'deprecated' warning category flags obsolete constructs whose
2157   support will be discontinued.  It is enabled by default.  These warnings
2158   used to be reported as 'other' warnings.
2160 *** Useless semantic types
2162   Bison now warns about useless (uninhabited) semantic types.  Since
2163   semantic types are not declared to Bison (they are defined in the opaque
2164   %union structure), it is %printer/%destructor directives about useless
2165   types that trigger the warning:
2167     %token <type1> term
2168     %type  <type2> nterm
2169     %printer    {} <type1> <type3>
2170     %destructor {} <type2> <type4>
2171     %%
2172     nterm: term { $$ = $1; };
2174     3.28-34: warning: type <type3> is used, but is not associated to any symbol
2175     4.28-34: warning: type <type4> is used, but is not associated to any symbol
2177 *** Undefined but unused symbols
2179   Bison used to raise an error for undefined symbols that are not used in
2180   the grammar.  This is now only a warning.
2182     %printer    {} symbol1
2183     %destructor {} symbol2
2184     %type <type>   symbol3
2185     %%
2186     exp: "a";
2188 *** Useless destructors or printers
2190   Bison now warns about useless destructors or printers.  In the following
2191   example, the printer for <type1>, and the destructor for <type2> are
2192   useless: all symbols of <type1> (token1) already have a printer, and all
2193   symbols of type <type2> (token2) already have a destructor.
2195     %token <type1> token1
2196            <type2> token2
2197            <type3> token3
2198            <type4> token4
2199     %printer    {} token1 <type1> <type3>
2200     %destructor {} token2 <type2> <type4>
2202 *** Conflicts
2204   The warnings and error messages about shift/reduce and reduce/reduce
2205   conflicts have been normalized.  For instance on the following foo.y file:
2207     %glr-parser
2208     %%
2209     exp: exp '+' exp | '0' | '0';
2211   compare the previous version of bison:
2213     $ bison foo.y
2214     foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2215     $ bison -Werror foo.y
2216     bison: warnings being treated as errors
2217     foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2219   with the new behavior:
2221     $ bison foo.y
2222     foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
2223     foo.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
2224     $ bison -Werror foo.y
2225     foo.y: error: 1 shift/reduce conflict [-Werror=conflicts-sr]
2226     foo.y: error: 2 reduce/reduce conflicts [-Werror=conflicts-rr]
2228   When %expect or %expect-rr is used, such as with bar.y:
2230     %expect 0
2231     %glr-parser
2232     %%
2233     exp: exp '+' exp | '0' | '0';
2235   Former behavior:
2237     $ bison bar.y
2238     bar.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2239     bar.y: expected 0 shift/reduce conflicts
2240     bar.y: expected 0 reduce/reduce conflicts
2242   New one:
2244     $ bison bar.y
2245     bar.y: error: shift/reduce conflicts: 1 found, 0 expected
2246     bar.y: error: reduce/reduce conflicts: 2 found, 0 expected
2248 ** Incompatibilities with POSIX Yacc
2250   The 'yacc' category is no longer part of '-Wall', enable it explicitly
2251   with '-Wyacc'.
2253 ** Additional yylex/yyparse arguments
2255   The new directive %param declares additional arguments to both yylex and
2256   yyparse.  The %lex-param, %parse-param, and %param directives support one
2257   or more arguments.  Instead of
2259     %lex-param   {arg1_type *arg1}
2260     %lex-param   {arg2_type *arg2}
2261     %parse-param {arg1_type *arg1}
2262     %parse-param {arg2_type *arg2}
2264   one may now declare
2266     %param {arg1_type *arg1} {arg2_type *arg2}
2268 ** Types of values for %define variables
2270   Bison used to make no difference between '%define foo bar' and '%define
2271   foo "bar"'.  The former is now called a 'keyword value', and the latter a
2272   'string value'.  A third kind was added: 'code values', such as '%define
2273   foo {bar}'.
2275   Keyword variables are used for fixed value sets, e.g.,
2277     %define lr.type lalr
2279   Code variables are used for value in the target language, e.g.,
2281     %define api.value.type {struct semantic_type}
2283   String variables are used remaining cases, e.g. file names.
2285 ** Variable api.token.prefix
2287   The variable api.token.prefix changes the way tokens are identified in
2288   the generated files.  This is especially useful to avoid collisions
2289   with identifiers in the target language.  For instance
2291     %token FILE for ERROR
2292     %define api.token.prefix {TOK_}
2293     %%
2294     start: FILE for ERROR;
2296   will generate the definition of the symbols TOK_FILE, TOK_for, and
2297   TOK_ERROR in the generated sources.  In particular, the scanner must
2298   use these prefixed token names, although the grammar itself still
2299   uses the short names (as in the sample rule given above).
2301 ** Variable api.value.type
2303   This new %define variable supersedes the #define macro YYSTYPE.  The use
2304   of YYSTYPE is discouraged.  In particular, #defining YYSTYPE *and* either
2305   using %union or %defining api.value.type results in undefined behavior.
2307   Either define api.value.type, or use "%union":
2309     %union
2310     {
2311       int ival;
2312       char *sval;
2313     }
2314     %token <ival> INT "integer"
2315     %token <sval> STRING "string"
2316     %printer { fprintf (yyo, "%d", $$); } <ival>
2317     %destructor { free ($$); } <sval>
2319     /* In yylex().  */
2320     yylval.ival = 42; return INT;
2321     yylval.sval = "42"; return STRING;
2323   The %define variable api.value.type supports both keyword and code values.
2325   The keyword value 'union' means that the user provides genuine types, not
2326   union member names such as "ival" and "sval" above (WARNING: will fail if
2327   -y/--yacc/%yacc is enabled).
2329     %define api.value.type union
2330     %token <int> INT "integer"
2331     %token <char *> STRING "string"
2332     %printer { fprintf (yyo, "%d", $$); } <int>
2333     %destructor { free ($$); } <char *>
2335     /* In yylex().  */
2336     yylval.INT = 42; return INT;
2337     yylval.STRING = "42"; return STRING;
2339   The keyword value variant is somewhat equivalent, but for C++ special
2340   provision is made to allow classes to be used (more about this below).
2342     %define api.value.type variant
2343     %token <int> INT "integer"
2344     %token <std::string> STRING "string"
2346   Code values (in braces) denote user defined types.  This is where YYSTYPE
2347   used to be used.
2349     %code requires
2350     {
2351       struct my_value
2352       {
2353         enum
2354         {
2355           is_int, is_string
2356         } kind;
2357         union
2358         {
2359           int ival;
2360           char *sval;
2361         } u;
2362       };
2363     }
2364     %define api.value.type {struct my_value}
2365     %token <u.ival> INT "integer"
2366     %token <u.sval> STRING "string"
2367     %printer { fprintf (yyo, "%d", $$); } <u.ival>
2368     %destructor { free ($$); } <u.sval>
2370     /* In yylex().  */
2371     yylval.u.ival = 42; return INT;
2372     yylval.u.sval = "42"; return STRING;
2374 ** Variable parse.error
2376   This variable controls the verbosity of error messages.  The use of the
2377   %error-verbose directive is deprecated in favor of "%define parse.error
2378   verbose".
2380 ** Deprecated %define variable names
2382   The following variables have been renamed for consistency.  Backward
2383   compatibility is ensured, but upgrading is recommended.
2385     lr.default-reductions      -> lr.default-reduction
2386     lr.keep-unreachable-states -> lr.keep-unreachable-state
2387     namespace                  -> api.namespace
2388     stype                      -> api.value.type
2390 ** Semantic predicates
2392   Contributed by Paul Hilfinger.
2394   The new, experimental, semantic-predicate feature allows actions of the
2395   form "%?{ BOOLEAN-EXPRESSION }", which cause syntax errors (as for
2396   YYERROR) if the expression evaluates to 0, and are evaluated immediately
2397   in GLR parsers, rather than being deferred.  The result is that they allow
2398   the programmer to prune possible parses based on the values of run-time
2399   expressions.
2401 ** The directive %expect-rr is now an error in non GLR mode
2403   It used to be an error only if used in non GLR mode, _and_ if there are
2404   reduce/reduce conflicts.
2406 ** Tokens are numbered in their order of appearance
2408   Contributed by Valentin Tolmer.
2410   With '%token A B', A had a number less than the one of B.  However,
2411   precedence declarations used to generate a reversed order.  This is now
2412   fixed, and introducing tokens with any of %token, %left, %right,
2413   %precedence, or %nonassoc yields the same result.
2415   When mixing declarations of tokens with a literal character (e.g., 'a') or
2416   with an identifier (e.g., B) in a precedence declaration, Bison numbered
2417   the literal characters first.  For example
2419     %right A B 'c' 'd'
2421   would lead to the tokens declared in this order: 'c' 'd' A B.  Again, the
2422   input order is now preserved.
2424   These changes were made so that one can remove useless precedence and
2425   associativity declarations (i.e., map %nonassoc, %left or %right to
2426   %precedence, or to %token) and get exactly the same output.
2428 ** Useless precedence and associativity
2430   Contributed by Valentin Tolmer.
2432   When developing and maintaining a grammar, useless associativity and
2433   precedence directives are common.  They can be a nuisance: new ambiguities
2434   arising are sometimes masked because their conflicts are resolved due to
2435   the extra precedence or associativity information.  Furthermore, it can
2436   hinder the comprehension of a new grammar: one will wonder about the role
2437   of a precedence, where in fact it is useless.  The following changes aim
2438   at detecting and reporting these extra directives.
2440 *** Precedence warning category
2442   A new category of warning, -Wprecedence, was introduced. It flags the
2443   useless precedence and associativity directives.
2445 *** Useless associativity
2447   Bison now warns about symbols with a declared associativity that is never
2448   used to resolve conflicts.  In that case, using %precedence is sufficient;
2449   the parsing tables will remain unchanged.  Solving these warnings may raise
2450   useless precedence warnings, as the symbols no longer have associativity.
2451   For example:
2453     %left '+'
2454     %left '*'
2455     %%
2456     exp:
2457       "number"
2458     | exp '+' "number"
2459     | exp '*' exp
2460     ;
2462   will produce a
2464     warning: useless associativity for '+', use %precedence [-Wprecedence]
2465      %left '+'
2466            ^^^
2468 *** Useless precedence
2470   Bison now warns about symbols with a declared precedence and no declared
2471   associativity (i.e., declared with %precedence), and whose precedence is
2472   never used.  In that case, the symbol can be safely declared with %token
2473   instead, without modifying the parsing tables.  For example:
2475     %precedence '='
2476     %%
2477     exp: "var" '=' "number";
2479   will produce a
2481     warning: useless precedence for '=' [-Wprecedence]
2482      %precedence '='
2483                  ^^^
2485 *** Useless precedence and associativity
2487   In case of both useless precedence and associativity, the issue is flagged
2488   as follows:
2490     %nonassoc '='
2491     %%
2492     exp: "var" '=' "number";
2494   The warning is:
2496     warning: useless precedence and associativity for '=' [-Wprecedence]
2497      %nonassoc '='
2498                ^^^
2500 ** Empty rules
2502   With help from Joel E. Denny and Gabriel Rassoul.
2504   Empty rules (i.e., with an empty right-hand side) can now be explicitly
2505   marked by the new %empty directive.  Using %empty on a non-empty rule is
2506   an error.  The new -Wempty-rule warning reports empty rules without
2507   %empty.  On the following grammar:
2509     %%
2510     s: a b c;
2511     a: ;
2512     b: %empty;
2513     c: 'a' %empty;
2515   bison reports:
2517     3.4-5: warning: empty rule without %empty [-Wempty-rule]
2518      a: {}
2519         ^^
2520     5.8-13: error: %empty on non-empty rule
2521      c: 'a' %empty {};
2522             ^^^^^^
2524 ** Java skeleton improvements
2526   The constants for token names were moved to the Lexer interface.  Also, it
2527   is possible to add code to the parser's constructors using "%code init"
2528   and "%define init_throws".
2529   Contributed by Paolo Bonzini.
2531   The Java skeleton now supports push parsing.
2532   Contributed by Dennis Heimbigner.
2534 ** C++ skeletons improvements
2536 *** The parser header is no longer mandatory (lalr1.cc, glr.cc)
2538   Using %defines is now optional.  Without it, the needed support classes
2539   are defined in the generated parser, instead of additional files (such as
2540   location.hh, position.hh and stack.hh).
2542 *** Locations are no longer mandatory (lalr1.cc, glr.cc)
2544   Both lalr1.cc and glr.cc no longer require %location.
2546 *** syntax_error exception (lalr1.cc)
2548   The C++ parser features a syntax_error exception, which can be
2549   thrown from the scanner or from user rules to raise syntax errors.
2550   This facilitates reporting errors caught in sub-functions (e.g.,
2551   rejecting too large integral literals from a conversion function
2552   used by the scanner, or rejecting invalid combinations from a
2553   factory invoked by the user actions).
2555 *** %define api.value.type variant
2557   This is based on a submission from Michiel De Wilde.  With help
2558   from Théophile Ranquet.
2560   In this mode, complex C++ objects can be used as semantic values.  For
2561   instance:
2563     %token <::std::string> TEXT;
2564     %token <int> NUMBER;
2565     %token SEMICOLON ";"
2566     %type <::std::string> item;
2567     %type <::std::list<std::string>> list;
2568     %%
2569     result:
2570       list  { std::cout << $1 << std::endl; }
2571     ;
2573     list:
2574       %empty        { /* Generates an empty string list. */ }
2575     | list item ";" { std::swap ($$, $1); $$.push_back ($2); }
2576     ;
2578     item:
2579       TEXT    { std::swap ($$, $1); }
2580     | NUMBER  { $$ = string_cast ($1); }
2581     ;
2583 *** %define api.token.constructor
2585   When variants are enabled, Bison can generate functions to build the
2586   tokens.  This guarantees that the token type (e.g., NUMBER) is consistent
2587   with the semantic value (e.g., int):
2589     parser::symbol_type yylex ()
2590     {
2591       parser::location_type loc = ...;
2592       ...
2593       return parser::make_TEXT ("Hello, world!", loc);
2594       ...
2595       return parser::make_NUMBER (42, loc);
2596       ...
2597       return parser::make_SEMICOLON (loc);
2598       ...
2599     }
2601 *** C++ locations
2603   There are operator- and operator-= for 'location'.  Negative line/column
2604   increments can no longer underflow the resulting value.
2607 * Noteworthy changes in release 2.7.1 (2013-04-15) [stable]
2609 ** Bug fixes
2611 *** Fix compiler attribute portability (yacc.c)
2613   With locations enabled, __attribute__ was used unprotected.
2615 *** Fix some compiler warnings (lalr1.cc)
2618 * Noteworthy changes in release 2.7 (2012-12-12) [stable]
2620 ** Bug fixes
2622   Warnings about uninitialized yylloc in yyparse have been fixed.
2624   Restored C90 compliance (yet no report was ever made).
2626 ** Diagnostics are improved
2628   Contributed by Théophile Ranquet.
2630 *** Changes in the format of error messages
2632   This used to be the format of many error reports:
2634     input.y:2.7-12: %type redeclaration for exp
2635     input.y:1.7-12: previous declaration
2637   It is now:
2639     input.y:2.7-12: error: %type redeclaration for exp
2640     input.y:1.7-12:     previous declaration
2642 *** New format for error reports: carets
2644   Caret errors have been added to Bison:
2646     input.y:2.7-12: error: %type redeclaration for exp
2647      %type <sval> exp
2648            ^^^^^^
2649     input.y:1.7-12:     previous declaration
2650      %type <ival> exp
2651            ^^^^^^
2653   or
2655     input.y:3.20-23: error: ambiguous reference: '$exp'
2656      exp: exp '+' exp { $exp = $1 + $3; };
2657                         ^^^^
2658     input.y:3.1-3:       refers to: $exp at $$
2659      exp: exp '+' exp { $exp = $1 + $3; };
2660      ^^^
2661     input.y:3.6-8:       refers to: $exp at $1
2662      exp: exp '+' exp { $exp = $1 + $3; };
2663           ^^^
2664     input.y:3.14-16:     refers to: $exp at $3
2665      exp: exp '+' exp { $exp = $1 + $3; };
2666                   ^^^
2668   The default behavior for now is still not to display these unless
2669   explicitly asked with -fcaret (or -fall). However, in a later release, it
2670   will be made the default behavior (but may still be deactivated with
2671   -fno-caret).
2673 ** New value for %define variable: api.pure full
2675   The %define variable api.pure requests a pure (reentrant) parser. However,
2676   for historical reasons, using it in a location-tracking Yacc parser
2677   resulted in a yyerror function that did not take a location as a
2678   parameter. With this new value, the user may request a better pure parser,
2679   where yyerror does take a location as a parameter (in location-tracking
2680   parsers).
2682   The use of "%define api.pure true" is deprecated in favor of this new
2683   "%define api.pure full".
2685 ** New %define variable: api.location.type (glr.cc, lalr1.cc, lalr1.java)
2687   The %define variable api.location.type defines the name of the type to use
2688   for locations.  When defined, Bison no longer generates the position.hh
2689   and location.hh files, nor does the parser will include them: the user is
2690   then responsible to define her type.
2692   This can be used in programs with several parsers to factor their location
2693   and position files: let one of them generate them, and the others just use
2694   them.
2696   This feature was actually introduced, but not documented, in Bison 2.5,
2697   under the name "location_type" (which is maintained for backward
2698   compatibility).
2700   For consistency, lalr1.java's %define variables location_type and
2701   position_type are deprecated in favor of api.location.type and
2702   api.position.type.
2704 ** Exception safety (lalr1.cc)
2706   The parse function now catches exceptions, uses the %destructors to
2707   release memory (the lookahead symbol and the symbols pushed on the stack)
2708   before re-throwing the exception.
2710   This feature is somewhat experimental.  User feedback would be
2711   appreciated.
2713 ** Graph improvements in DOT and XSLT
2715   Contributed by Théophile Ranquet.
2717   The graphical presentation of the states is more readable: their shape is
2718   now rectangular, the state number is clearly displayed, and the items are
2719   numbered and left-justified.
2721   The reductions are now explicitly represented as transitions to other
2722   diamond shaped nodes.
2724   These changes are present in both --graph output and xml2dot.xsl XSLT
2725   processing, with minor (documented) differences.
2727 ** %language is no longer an experimental feature.
2729   The introduction of this feature, in 2.4, was four years ago. The
2730   --language option and the %language directive are no longer experimental.
2732 ** Documentation
2734   The sections about shift/reduce and reduce/reduce conflicts resolution
2735   have been fixed and extended.
2737   Although introduced more than four years ago, XML and Graphviz reports
2738   were not properly documented.
2740   The translation of midrule actions is now described.
2743 * Noteworthy changes in release 2.6.5 (2012-11-07) [stable]
2745   We consider compiler warnings about Bison generated parsers to be bugs.
2746   Rather than working around them in your own project, please consider
2747   reporting them to us.
2749 ** Bug fixes
2751   Warnings about uninitialized yylval and/or yylloc for push parsers with a
2752   pure interface have been fixed for GCC 4.0 up to 4.8, and Clang 2.9 to
2753   3.2.
2755   Other issues in the test suite have been addressed.
2757   Null characters are correctly displayed in error messages.
2759   When possible, yylloc is correctly initialized before calling yylex.  It
2760   is no longer necessary to initialize it in the %initial-action.
2763 * Noteworthy changes in release 2.6.4 (2012-10-23) [stable]
2765   Bison 2.6.3's --version was incorrect.  This release fixes this issue.
2768 * Noteworthy changes in release 2.6.3 (2012-10-22) [stable]
2770 ** Bug fixes
2772   Bugs and portability issues in the test suite have been fixed.
2774   Some errors in translations have been addressed, and --help now directs
2775   users to the appropriate place to report them.
2777   Stray Info files shipped by accident are removed.
2779   Incorrect definitions of YY_, issued by yacc.c when no parser header is
2780   generated, are removed.
2782   All the generated headers are self-contained.
2784 ** Header guards (yacc.c, glr.c, glr.cc)
2786   In order to avoid collisions, the header guards are now
2787   YY_<PREFIX>_<FILE>_INCLUDED, instead of merely <PREFIX>_<FILE>.
2788   For instance the header generated from
2790     %define api.prefix "calc"
2791     %defines "lib/parse.h"
2793   will use YY_CALC_LIB_PARSE_H_INCLUDED as guard.
2795 ** Fix compiler warnings in the generated parser (yacc.c, glr.c)
2797   The compilation of pure parsers (%define api.pure) can trigger GCC
2798   warnings such as:
2800     input.c: In function 'yyparse':
2801     input.c:1503:12: warning: 'yylval' may be used uninitialized in this
2802                               function [-Wmaybe-uninitialized]
2803        *++yyvsp = yylval;
2804                 ^
2806   This is now fixed; pragmas to avoid these warnings are no longer needed.
2808   Warnings from clang ("equality comparison with extraneous parentheses" and
2809   "function declared 'noreturn' should not return") have also been
2810   addressed.
2813 * Noteworthy changes in release 2.6.2 (2012-08-03) [stable]
2815 ** Bug fixes
2817   Buffer overruns, complaints from Flex, and portability issues in the test
2818   suite have been fixed.
2820 ** Spaces in %lex- and %parse-param (lalr1.cc, glr.cc)
2822   Trailing end-of-lines in %parse-param or %lex-param would result in
2823   invalid C++.  This is fixed.
2825 ** Spurious spaces and end-of-lines
2827   The generated files no longer end (nor start) with empty lines.
2830 * Noteworthy changes in release 2.6.1 (2012-07-30) [stable]
2832  Bison no longer executes user-specified M4 code when processing a grammar.
2834 ** Future Changes
2836   In addition to the removal of the features announced in Bison 2.6, the
2837   next major release will remove the "Temporary hack for adding a semicolon
2838   to the user action", as announced in the release 2.5.  Instead of:
2840     exp: exp "+" exp { $$ = $1 + $3 };
2842   write:
2844     exp: exp "+" exp { $$ = $1 + $3; };
2846 ** Bug fixes
2848 *** Type names are now properly escaped.
2850 *** glr.cc: set_debug_level and debug_level work as expected.
2852 *** Stray @ or $ in actions
2854   While Bison used to warn about stray $ or @ in action rules, it did not
2855   for other actions such as printers, destructors, or initial actions.  It
2856   now does.
2858 ** Type names in actions
2860   For consistency with rule actions, it is now possible to qualify $$ by a
2861   type-name in destructors, printers, and initial actions.  For instance:
2863     %printer { fprintf (yyo, "(%d, %f)", $<ival>$, $<fval>$); } <*> <>;
2865   will display two values for each typed and untyped symbol (provided
2866   that YYSTYPE has both "ival" and "fval" fields).
2869 * Noteworthy changes in release 2.6 (2012-07-19) [stable]
2871 ** Future changes
2873   The next major release of Bison will drop support for the following
2874   deprecated features.  Please report disagreements to bug-bison@gnu.org.
2876 *** K&R C parsers
2878   Support for generating parsers in K&R C will be removed.  Parsers
2879   generated for C support ISO C90, and are tested with ISO C99 and ISO C11
2880   compilers.
2882 *** Features deprecated since Bison 1.875
2884   The definitions of yystype and yyltype will be removed; use YYSTYPE and
2885   YYLTYPE.
2887   YYPARSE_PARAM and YYLEX_PARAM, deprecated in favor of %parse-param and
2888   %lex-param, will no longer be supported.
2890   Support for the preprocessor symbol YYERROR_VERBOSE will be removed, use
2891   %error-verbose.
2893 *** The generated header will be included (yacc.c)
2895   Instead of duplicating the content of the generated header (definition of
2896   YYSTYPE, yyparse declaration etc.), the generated parser will include it,
2897   as is already the case for GLR or C++ parsers.  This change is deferred
2898   because existing versions of ylwrap (e.g., Automake 1.12.1) do not support
2899   it.
2901 ** Generated Parser Headers
2903 *** Guards (yacc.c, glr.c, glr.cc)
2905   The generated headers are now guarded, as is already the case for C++
2906   parsers (lalr1.cc).  For instance, with --defines=foo.h:
2908     #ifndef YY_FOO_H
2909     # define YY_FOO_H
2910     ...
2911     #endif /* !YY_FOO_H  */
2913 *** New declarations (yacc.c, glr.c)
2915   The generated header now declares yydebug and yyparse.  Both honor
2916   --name-prefix=bar_, and yield
2918     int bar_parse (void);
2920   rather than
2922     #define yyparse bar_parse
2923     int yyparse (void);
2925   in order to facilitate the inclusion of several parser headers inside a
2926   single compilation unit.
2928 *** Exported symbols in C++
2930   The symbols YYTOKEN_TABLE and YYERROR_VERBOSE, which were defined in the
2931   header, are removed, as they prevent the possibility of including several
2932   generated headers from a single compilation unit.
2934 *** YYLSP_NEEDED
2936   For the same reasons, the undocumented and unused macro YYLSP_NEEDED is no
2937   longer defined.
2939 ** New %define variable: api.prefix
2941   Now that the generated headers are more complete and properly protected
2942   against multiple inclusions, constant names, such as YYSTYPE are a
2943   problem.  While yyparse and others are properly renamed by %name-prefix,
2944   YYSTYPE, YYDEBUG and others have never been affected by it.  Because it
2945   would introduce backward compatibility issues in projects not expecting
2946   YYSTYPE to be renamed, instead of changing the behavior of %name-prefix,
2947   it is deprecated in favor of a new %define variable: api.prefix.
2949   The following examples compares both:
2951     %name-prefix "bar_"               | %define api.prefix "bar_"
2952     %token <ival> FOO                   %token <ival> FOO
2953     %union { int ival; }                %union { int ival; }
2954     %%                                  %%
2955     exp: 'a';                           exp: 'a';
2957   bison generates:
2959     #ifndef BAR_FOO_H                   #ifndef BAR_FOO_H
2960     # define BAR_FOO_H                  # define BAR_FOO_H
2962     /* Enabling traces.  */             /* Enabling traces.  */
2963     # ifndef YYDEBUG                  | # ifndef BAR_DEBUG
2964                                       > #  if defined YYDEBUG
2965                                       > #   if YYDEBUG
2966                                       > #    define BAR_DEBUG 1
2967                                       > #   else
2968                                       > #    define BAR_DEBUG 0
2969                                       > #   endif
2970                                       > #  else
2971     #  define YYDEBUG 0               | #   define BAR_DEBUG 0
2972                                       > #  endif
2973     # endif                           | # endif
2975     # if YYDEBUG                      | # if BAR_DEBUG
2976     extern int bar_debug;               extern int bar_debug;
2977     # endif                             # endif
2979     /* Tokens.  */                      /* Tokens.  */
2980     # ifndef YYTOKENTYPE              | # ifndef BAR_TOKENTYPE
2981     #  define YYTOKENTYPE             | #  define BAR_TOKENTYPE
2982        enum yytokentype {             |    enum bar_tokentype {
2983          FOO = 258                           FOO = 258
2984        };                                  };
2985     # endif                             # endif
2987     #if ! defined YYSTYPE \           | #if ! defined BAR_STYPE \
2988      && ! defined YYSTYPE_IS_DECLARED |  && ! defined BAR_STYPE_IS_DECLARED
2989     typedef union YYSTYPE             | typedef union BAR_STYPE
2990     {                                   {
2991      int ival;                           int ival;
2992     } YYSTYPE;                        | } BAR_STYPE;
2993     # define YYSTYPE_IS_DECLARED 1    | # define BAR_STYPE_IS_DECLARED 1
2994     #endif                              #endif
2996     extern YYSTYPE bar_lval;          | extern BAR_STYPE bar_lval;
2998     int bar_parse (void);               int bar_parse (void);
3000     #endif /* !BAR_FOO_H  */            #endif /* !BAR_FOO_H  */
3003 * Noteworthy changes in release 2.5.1 (2012-06-05) [stable]
3005 ** Future changes:
3007   The next major release will drop support for generating parsers in K&R C.
3009 ** yacc.c: YYBACKUP works as expected.
3011 ** glr.c improvements:
3013 *** Location support is eliminated when not requested:
3015   GLR parsers used to include location-related code even when locations were
3016   not requested, and therefore not even usable.
3018 *** __attribute__ is preserved:
3020   __attribute__ is no longer disabled when __STRICT_ANSI__ is defined (i.e.,
3021   when -std is passed to GCC).
3023 ** lalr1.java: several fixes:
3025   The Java parser no longer throws ArrayIndexOutOfBoundsException if the
3026   first token leads to a syntax error.  Some minor clean ups.
3028 ** Changes for C++:
3030 *** C++11 compatibility:
3032   C and C++ parsers use "nullptr" instead of "0" when __cplusplus is 201103L
3033   or higher.
3035 *** Header guards
3037   The header files such as "parser.hh", "location.hh", etc. used a constant
3038   name for preprocessor guards, for instance:
3040     #ifndef BISON_LOCATION_HH
3041     # define BISON_LOCATION_HH
3042     ...
3043     #endif // !BISON_LOCATION_HH
3045   The inclusion guard is now computed from "PREFIX/FILE-NAME", where lower
3046   case characters are converted to upper case, and series of
3047   non-alphanumerical characters are converted to an underscore.
3049   With "bison -o lang++/parser.cc", "location.hh" would now include:
3051     #ifndef YY_LANG_LOCATION_HH
3052     # define YY_LANG_LOCATION_HH
3053     ...
3054     #endif // !YY_LANG_LOCATION_HH
3056 *** C++ locations:
3058   The position and location constructors (and their initialize methods)
3059   accept new arguments for line and column.  Several issues in the
3060   documentation were fixed.
3062 ** liby is no longer asking for "rpl_fprintf" on some platforms.
3064 ** Changes in the manual:
3066 *** %printer is documented
3068   The "%printer" directive, supported since at least Bison 1.50, is finally
3069   documented.  The "mfcalc" example is extended to demonstrate it.
3071   For consistency with the C skeletons, the C++ parsers now also support
3072   "yyoutput" (as an alias to "debug_stream ()").
3074 *** Several improvements have been made:
3076   The layout for grammar excerpts was changed to a more compact scheme.
3077   Named references are motivated.  The description of the automaton
3078   description file (*.output) is updated to the current format.  Incorrect
3079   index entries were fixed.  Some other errors were fixed.
3081 ** Building bison:
3083 *** Conflicting prototypes with recent/modified Flex.
3085   Fixed build problems with the current, unreleased, version of Flex, and
3086   some modified versions of 2.5.35, which have modified function prototypes.
3088 *** Warnings during the build procedure have been eliminated.
3090 *** Several portability problems in the test suite have been fixed:
3092   This includes warnings with some compilers, unexpected behavior of tools
3093   such as diff, warning messages from the test suite itself, etc.
3095 *** The install-pdf target works properly:
3097   Running "make install-pdf" (or -dvi, -html, -info, and -ps) no longer
3098   halts in the middle of its course.
3101 * Noteworthy changes in release 2.5 (2011-05-14)
3103 ** Grammar symbol names can now contain non-initial dashes:
3105   Consistently with directives (such as %error-verbose) and with
3106   %define variables (e.g. push-pull), grammar symbol names may contain
3107   dashes in any position except the beginning.  This is a GNU
3108   extension over POSIX Yacc.  Thus, use of this extension is reported
3109   by -Wyacc and rejected in Yacc mode (--yacc).
3111 ** Named references:
3113   Historically, Yacc and Bison have supported positional references
3114   ($n, $$) to allow access to symbol values from inside of semantic
3115   actions code.
3117   Starting from this version, Bison can also accept named references.
3118   When no ambiguity is possible, original symbol names may be used
3119   as named references:
3121     if_stmt : "if" cond_expr "then" then_stmt ';'
3122     { $if_stmt = mk_if_stmt($cond_expr, $then_stmt); }
3124   In the more common case, explicit names may be declared:
3126     stmt[res] : "if" expr[cond] "then" stmt[then] "else" stmt[else] ';'
3127     { $res = mk_if_stmt($cond, $then, $else); }
3129   Location information is also accessible using @name syntax.  When
3130   accessing symbol names containing dots or dashes, explicit bracketing
3131   ($[sym.1]) must be used.
3133   These features are experimental in this version.  More user feedback
3134   will help to stabilize them.
3135   Contributed by Alex Rozenman.
3137 ** IELR(1) and canonical LR(1):
3139   IELR(1) is a minimal LR(1) parser table generation algorithm.  That
3140   is, given any context-free grammar, IELR(1) generates parser tables
3141   with the full language-recognition power of canonical LR(1) but with
3142   nearly the same number of parser states as LALR(1).  This reduction
3143   in parser states is often an order of magnitude.  More importantly,
3144   because canonical LR(1)'s extra parser states may contain duplicate
3145   conflicts in the case of non-LR(1) grammars, the number of conflicts
3146   for IELR(1) is often an order of magnitude less as well.  This can
3147   significantly reduce the complexity of developing of a grammar.
3149   Bison can now generate IELR(1) and canonical LR(1) parser tables in
3150   place of its traditional LALR(1) parser tables, which remain the
3151   default.  You can specify the type of parser tables in the grammar
3152   file with these directives:
3154     %define lr.type lalr
3155     %define lr.type ielr
3156     %define lr.type canonical-lr
3158   The default-reduction optimization in the parser tables can also be
3159   adjusted using "%define lr.default-reductions".  For details on both
3160   of these features, see the new section "Tuning LR" in the Bison
3161   manual.
3163   These features are experimental.  More user feedback will help to
3164   stabilize them.
3166 ** LAC (Lookahead Correction) for syntax error handling
3168   Contributed by Joel E. Denny.
3170   Canonical LR, IELR, and LALR can suffer from a couple of problems
3171   upon encountering a syntax error.  First, the parser might perform
3172   additional parser stack reductions before discovering the syntax
3173   error.  Such reductions can perform user semantic actions that are
3174   unexpected because they are based on an invalid token, and they
3175   cause error recovery to begin in a different syntactic context than
3176   the one in which the invalid token was encountered.  Second, when
3177   verbose error messages are enabled (with %error-verbose or the
3178   obsolete "#define YYERROR_VERBOSE"), the expected token list in the
3179   syntax error message can both contain invalid tokens and omit valid
3180   tokens.
3182   The culprits for the above problems are %nonassoc, default
3183   reductions in inconsistent states, and parser state merging.  Thus,
3184   IELR and LALR suffer the most.  Canonical LR can suffer only if
3185   %nonassoc is used or if default reductions are enabled for
3186   inconsistent states.
3188   LAC is a new mechanism within the parsing algorithm that solves
3189   these problems for canonical LR, IELR, and LALR without sacrificing
3190   %nonassoc, default reductions, or state merging.  When LAC is in
3191   use, canonical LR and IELR behave almost exactly the same for both
3192   syntactically acceptable and syntactically unacceptable input.
3193   While LALR still does not support the full language-recognition
3194   power of canonical LR and IELR, LAC at least enables LALR's syntax
3195   error handling to correctly reflect LALR's language-recognition
3196   power.
3198   Currently, LAC is only supported for deterministic parsers in C.
3199   You can enable LAC with the following directive:
3201     %define parse.lac full
3203   See the new section "LAC" in the Bison manual for additional
3204   details including a few caveats.
3206   LAC is an experimental feature.  More user feedback will help to
3207   stabilize it.
3209 ** %define improvements:
3211 *** Can now be invoked via the command line:
3213   Each of these command-line options
3215     -D NAME[=VALUE]
3216     --define=NAME[=VALUE]
3218     -F NAME[=VALUE]
3219     --force-define=NAME[=VALUE]
3221   is equivalent to this grammar file declaration
3223     %define NAME ["VALUE"]
3225   except that the manner in which Bison processes multiple definitions
3226   for the same NAME differs.  Most importantly, -F and --force-define
3227   quietly override %define, but -D and --define do not.  For further
3228   details, see the section "Bison Options" in the Bison manual.
3230 *** Variables renamed:
3232   The following %define variables
3234     api.push_pull
3235     lr.keep_unreachable_states
3237   have been renamed to
3239     api.push-pull
3240     lr.keep-unreachable-states
3242   The old names are now deprecated but will be maintained indefinitely
3243   for backward compatibility.
3245 *** Values no longer need to be quoted in the grammar file:
3247   If a %define value is an identifier, it no longer needs to be placed
3248   within quotations marks.  For example,
3250     %define api.push-pull "push"
3252   can be rewritten as
3254     %define api.push-pull push
3256 *** Unrecognized variables are now errors not warnings.
3258 *** Multiple invocations for any variable is now an error not a warning.
3260 ** Unrecognized %code qualifiers are now errors not warnings.
3262 ** Character literals not of length one:
3264   Previously, Bison quietly converted all character literals to length
3265   one.  For example, without warning, Bison interpreted the operators in
3266   the following grammar to be the same token:
3268     exp: exp '++'
3269        | exp '+' exp
3270        ;
3272   Bison now warns when a character literal is not of length one.  In
3273   some future release, Bison will start reporting an error instead.
3275 ** Destructor calls fixed for lookaheads altered in semantic actions:
3277   Previously for deterministic parsers in C, if a user semantic action
3278   altered yychar, the parser in some cases used the old yychar value to
3279   determine which destructor to call for the lookahead upon a syntax
3280   error or upon parser return.  This bug has been fixed.
3282 ** C++ parsers use YYRHSLOC:
3284   Similarly to the C parsers, the C++ parsers now define the YYRHSLOC
3285   macro and use it in the default YYLLOC_DEFAULT.  You are encouraged
3286   to use it.  If, for instance, your location structure has "first"
3287   and "last" members, instead of
3289     # define YYLLOC_DEFAULT(Current, Rhs, N)                             \
3290       do                                                                 \
3291         if (N)                                                           \
3292           {                                                              \
3293             (Current).first = (Rhs)[1].location.first;                   \
3294             (Current).last  = (Rhs)[N].location.last;                    \
3295           }                                                              \
3296         else                                                             \
3297           {                                                              \
3298             (Current).first = (Current).last = (Rhs)[0].location.last;   \
3299           }                                                              \
3300       while (false)
3302   use:
3304     # define YYLLOC_DEFAULT(Current, Rhs, N)                             \
3305       do                                                                 \
3306         if (N)                                                           \
3307           {                                                              \
3308             (Current).first = YYRHSLOC (Rhs, 1).first;                   \
3309             (Current).last  = YYRHSLOC (Rhs, N).last;                    \
3310           }                                                              \
3311         else                                                             \
3312           {                                                              \
3313             (Current).first = (Current).last = YYRHSLOC (Rhs, 0).last;   \
3314           }                                                              \
3315       while (false)
3317 ** YYLLOC_DEFAULT in C++:
3319   The default implementation of YYLLOC_DEFAULT used to be issued in
3320   the header file.  It is now output in the implementation file, after
3321   the user %code sections so that its #ifndef guard does not try to
3322   override the user's YYLLOC_DEFAULT if provided.
3324 ** YYFAIL now produces warnings and Java parsers no longer implement it:
3326   YYFAIL has existed for many years as an undocumented feature of
3327   deterministic parsers in C generated by Bison.  More recently, it was
3328   a documented feature of Bison's experimental Java parsers.  As
3329   promised in Bison 2.4.2's NEWS entry, any appearance of YYFAIL in a
3330   semantic action now produces a deprecation warning, and Java parsers
3331   no longer implement YYFAIL at all.  For further details, including a
3332   discussion of how to suppress C preprocessor warnings about YYFAIL
3333   being unused, see the Bison 2.4.2 NEWS entry.
3335 ** Temporary hack for adding a semicolon to the user action:
3337   Previously, Bison appended a semicolon to every user action for
3338   reductions when the output language defaulted to C (specifically, when
3339   neither %yacc, %language, %skeleton, or equivalent command-line
3340   options were specified).  This allowed actions such as
3342     exp: exp "+" exp { $$ = $1 + $3 };
3344   instead of
3346     exp: exp "+" exp { $$ = $1 + $3; };
3348   As a first step in removing this misfeature, Bison now issues a
3349   warning when it appends a semicolon.  Moreover, in cases where Bison
3350   cannot easily determine whether a semicolon is needed (for example, an
3351   action ending with a cpp directive or a braced compound initializer),
3352   it no longer appends one.  Thus, the C compiler might now complain
3353   about a missing semicolon where it did not before.  Future releases of
3354   Bison will cease to append semicolons entirely.
3356 ** Verbose syntax error message fixes:
3358   When %error-verbose or the obsolete "#define YYERROR_VERBOSE" is
3359   specified, syntax error messages produced by the generated parser
3360   include the unexpected token as well as a list of expected tokens.
3361   The effect of %nonassoc on these verbose messages has been corrected
3362   in two ways, but a more complete fix requires LAC, described above:
3364 *** When %nonassoc is used, there can exist parser states that accept no
3365     tokens, and so the parser does not always require a lookahead token
3366     in order to detect a syntax error.  Because no unexpected token or
3367     expected tokens can then be reported, the verbose syntax error
3368     message described above is suppressed, and the parser instead
3369     reports the simpler message, "syntax error".  Previously, this
3370     suppression was sometimes erroneously triggered by %nonassoc when a
3371     lookahead was actually required.  Now verbose messages are
3372     suppressed only when all previous lookaheads have already been
3373     shifted or discarded.
3375 *** Previously, the list of expected tokens erroneously included tokens
3376     that would actually induce a syntax error because conflicts for them
3377     were resolved with %nonassoc in the current parser state.  Such
3378     tokens are now properly omitted from the list.
3380 *** Expected token lists are still often wrong due to state merging
3381     (from LALR or IELR) and default reductions, which can both add
3382     invalid tokens and subtract valid tokens.  Canonical LR almost
3383     completely fixes this problem by eliminating state merging and
3384     default reductions.  However, there is one minor problem left even
3385     when using canonical LR and even after the fixes above.  That is,
3386     if the resolution of a conflict with %nonassoc appears in a later
3387     parser state than the one at which some syntax error is
3388     discovered, the conflicted token is still erroneously included in
3389     the expected token list.  Bison's new LAC implementation,
3390     described above, eliminates this problem and the need for
3391     canonical LR.  However, LAC is still experimental and is disabled
3392     by default.
3394 ** Java skeleton fixes:
3396 *** A location handling bug has been fixed.
3398 *** The top element of each of the value stack and location stack is now
3399     cleared when popped so that it can be garbage collected.
3401 *** Parser traces now print the top element of the stack.
3403 ** -W/--warnings fixes:
3405 *** Bison now properly recognizes the "no-" versions of categories:
3407   For example, given the following command line, Bison now enables all
3408   warnings except warnings for incompatibilities with POSIX Yacc:
3410     bison -Wall,no-yacc gram.y
3412 *** Bison now treats S/R and R/R conflicts like other warnings:
3414   Previously, conflict reports were independent of Bison's normal
3415   warning system.  Now, Bison recognizes the warning categories
3416   "conflicts-sr" and "conflicts-rr".  This change has important
3417   consequences for the -W and --warnings command-line options.  For
3418   example:
3420     bison -Wno-conflicts-sr gram.y  # S/R conflicts not reported
3421     bison -Wno-conflicts-rr gram.y  # R/R conflicts not reported
3422     bison -Wnone            gram.y  # no conflicts are reported
3423     bison -Werror           gram.y  # any conflict is an error
3425   However, as before, if the %expect or %expect-rr directive is
3426   specified, an unexpected number of conflicts is an error, and an
3427   expected number of conflicts is not reported, so -W and --warning
3428   then have no effect on the conflict report.
3430 *** The "none" category no longer disables a preceding "error":
3432   For example, for the following command line, Bison now reports
3433   errors instead of warnings for incompatibilities with POSIX Yacc:
3435     bison -Werror,none,yacc gram.y
3437 *** The "none" category now disables all Bison warnings:
3439   Previously, the "none" category disabled only Bison warnings for
3440   which there existed a specific -W/--warning category.  However,
3441   given the following command line, Bison is now guaranteed to
3442   suppress all warnings:
3444     bison -Wnone gram.y
3446 ** Precedence directives can now assign token number 0:
3448   Since Bison 2.3b, which restored the ability of precedence
3449   directives to assign token numbers, doing so for token number 0 has
3450   produced an assertion failure.  For example:
3452     %left END 0
3454   This bug has been fixed.
3457 * Noteworthy changes in release 2.4.3 (2010-08-05)
3459 ** Bison now obeys -Werror and --warnings=error for warnings about
3460    grammar rules that are useless in the parser due to conflicts.
3462 ** Problems with spawning M4 on at least FreeBSD 8 and FreeBSD 9 have
3463    been fixed.
3465 ** Failures in the test suite for GCC 4.5 have been fixed.
3467 ** Failures in the test suite for some versions of Sun Studio C++ have
3468    been fixed.
3470 ** Contrary to Bison 2.4.2's NEWS entry, it has been decided that
3471    warnings about undefined %prec identifiers will not be converted to
3472    errors in Bison 2.5.  They will remain warnings, which should be
3473    sufficient for POSIX while avoiding backward compatibility issues.
3475 ** Minor documentation fixes.
3478 * Noteworthy changes in release 2.4.2 (2010-03-20)
3480 ** Some portability problems that resulted in failures and livelocks
3481    in the test suite on some versions of at least Solaris, AIX, HP-UX,
3482    RHEL4, and Tru64 have been addressed.  As a result, fatal Bison
3483    errors should no longer cause M4 to report a broken pipe on the
3484    affected platforms.
3486 ** "%prec IDENTIFIER" requires IDENTIFIER to be defined separately.
3488   POSIX specifies that an error be reported for any identifier that does
3489   not appear on the LHS of a grammar rule and that is not defined by
3490   %token, %left, %right, or %nonassoc.  Bison 2.3b and later lost this
3491   error report for the case when an identifier appears only after a
3492   %prec directive.  It is now restored.  However, for backward
3493   compatibility with recent Bison releases, it is only a warning for
3494   now.  In Bison 2.5 and later, it will return to being an error.
3495   [Between the 2.4.2 and 2.4.3 releases, it was decided that this
3496   warning will not be converted to an error in Bison 2.5.]
3498 ** Detection of GNU M4 1.4.6 or newer during configure is improved.
3500 ** Warnings from gcc's -Wundef option about undefined YYENABLE_NLS,
3501    YYLTYPE_IS_TRIVIAL, and __STRICT_ANSI__ in C/C++ parsers are now
3502    avoided.
3504 ** %code is now a permanent feature.
3506   A traditional Yacc prologue directive is written in the form:
3508     %{CODE%}
3510   To provide a more flexible alternative, Bison 2.3b introduced the
3511   %code directive with the following forms for C/C++:
3513     %code          {CODE}
3514     %code requires {CODE}
3515     %code provides {CODE}
3516     %code top      {CODE}
3518   These forms are now considered permanent features of Bison.  See the
3519   %code entries in the section "Bison Declaration Summary" in the Bison
3520   manual for a summary of their functionality.  See the section
3521   "Prologue Alternatives" for a detailed discussion including the
3522   advantages of %code over the traditional Yacc prologue directive.
3524   Bison's Java feature as a whole including its current usage of %code
3525   is still considered experimental.
3527 ** YYFAIL is deprecated and will eventually be removed.
3529   YYFAIL has existed for many years as an undocumented feature of
3530   deterministic parsers in C generated by Bison.  Previously, it was
3531   documented for Bison's experimental Java parsers.  YYFAIL is no longer
3532   documented for Java parsers and is formally deprecated in both cases.
3533   Users are strongly encouraged to migrate to YYERROR, which is
3534   specified by POSIX.
3536   Like YYERROR, you can invoke YYFAIL from a semantic action in order to
3537   induce a syntax error.  The most obvious difference from YYERROR is
3538   that YYFAIL will automatically invoke yyerror to report the syntax
3539   error so that you don't have to.  However, there are several other
3540   subtle differences between YYERROR and YYFAIL, and YYFAIL suffers from
3541   inherent flaws when %error-verbose or "#define YYERROR_VERBOSE" is
3542   used.  For a more detailed discussion, see:
3544     https://lists.gnu.org/r/bison-patches/2009-12/msg00024.html
3546   The upcoming Bison 2.5 will remove YYFAIL from Java parsers, but
3547   deterministic parsers in C will continue to implement it.  However,
3548   because YYFAIL is already flawed, it seems futile to try to make new
3549   Bison features compatible with it.  Thus, during parser generation,
3550   Bison 2.5 will produce a warning whenever it discovers YYFAIL in a
3551   rule action.  In a later release, YYFAIL will be disabled for
3552   %error-verbose and "#define YYERROR_VERBOSE".  Eventually, YYFAIL will
3553   be removed altogether.
3555   There exists at least one case where Bison 2.5's YYFAIL warning will
3556   be a false positive.  Some projects add phony uses of YYFAIL and other
3557   Bison-defined macros for the sole purpose of suppressing C
3558   preprocessor warnings (from GCC cpp's -Wunused-macros, for example).
3559   To avoid Bison's future warning, such YYFAIL uses can be moved to the
3560   epilogue (that is, after the second "%%") in the Bison input file.  In
3561   this release (2.4.2), Bison already generates its own code to suppress
3562   C preprocessor warnings for YYFAIL, so projects can remove their own
3563   phony uses of YYFAIL if compatibility with Bison releases prior to
3564   2.4.2 is not necessary.
3566 ** Internationalization.
3568   Fix a regression introduced in Bison 2.4: Under some circumstances,
3569   message translations were not installed although supported by the
3570   host system.
3573 * Noteworthy changes in release 2.4.1 (2008-12-11)
3575 ** In the GLR defines file, unexpanded M4 macros in the yylval and yylloc
3576    declarations have been fixed.
3578 ** Temporary hack for adding a semicolon to the user action.
3580   Bison used to prepend a trailing semicolon at the end of the user
3581   action for reductions.  This allowed actions such as
3583     exp: exp "+" exp { $$ = $1 + $3 };
3585   instead of
3587     exp: exp "+" exp { $$ = $1 + $3; };
3589   Some grammars still depend on this "feature".  Bison 2.4.1 restores
3590   the previous behavior in the case of C output (specifically, when
3591   neither %language or %skeleton or equivalent command-line options
3592   are used) to leave more time for grammars depending on the old
3593   behavior to be adjusted.  Future releases of Bison will disable this
3594   feature.
3596 ** A few minor improvements to the Bison manual.
3599 * Noteworthy changes in release 2.4 (2008-11-02)
3601 ** %language is an experimental feature.
3603   We first introduced this feature in test release 2.3b as a cleaner
3604   alternative to %skeleton.  Since then, we have discussed the possibility of
3605   modifying its effect on Bison's output file names.  Thus, in this release,
3606   we consider %language to be an experimental feature that will likely evolve
3607   in future releases.
3609 ** Forward compatibility with GNU M4 has been improved.
3611 ** Several bugs in the C++ skeleton and the experimental Java skeleton have been
3612   fixed.
3615 * Noteworthy changes in release 2.3b (2008-05-27)
3617 ** The quotes around NAME that used to be required in the following directive
3618   are now deprecated:
3620     %define NAME "VALUE"
3622 ** The directive "%pure-parser" is now deprecated in favor of:
3624     %define api.pure
3626   which has the same effect except that Bison is more careful to warn about
3627   unreasonable usage in the latter case.
3629 ** Push Parsing
3631   Bison can now generate an LALR(1) parser in C with a push interface.  That
3632   is, instead of invoking "yyparse", which pulls tokens from "yylex", you can
3633   push one token at a time to the parser using "yypush_parse", which will
3634   return to the caller after processing each token.  By default, the push
3635   interface is disabled.  Either of the following directives will enable it:
3637     %define api.push_pull "push" // Just push; does not require yylex.
3638     %define api.push_pull "both" // Push and pull; requires yylex.
3640   See the new section "A Push Parser" in the Bison manual for details.
3642   The current push parsing interface is experimental and may evolve.  More user
3643   feedback will help to stabilize it.
3645 ** The -g and --graph options now output graphs in Graphviz DOT format,
3646   not VCG format.  Like --graph, -g now also takes an optional FILE argument
3647   and thus cannot be bundled with other short options.
3649 ** Java
3651   Bison can now generate an LALR(1) parser in Java.  The skeleton is
3652   "data/lalr1.java".  Consider using the new %language directive instead of
3653   %skeleton to select it.
3655   See the new section "Java Parsers" in the Bison manual for details.
3657   The current Java interface is experimental and may evolve.  More user
3658   feedback will help to stabilize it.
3659   Contributed by Paolo Bonzini.
3661 ** %language
3663   This new directive specifies the programming language of the generated
3664   parser, which can be C (the default), C++, or Java.  Besides the skeleton
3665   that Bison uses, the directive affects the names of the generated files if
3666   the grammar file's name ends in ".y".
3668 ** XML Automaton Report
3670   Bison can now generate an XML report of the LALR(1) automaton using the new
3671   "--xml" option.  The current XML schema is experimental and may evolve.  More
3672   user feedback will help to stabilize it.
3673   Contributed by Wojciech Polak.
3675 ** The grammar file may now specify the name of the parser header file using
3676   %defines.  For example:
3678     %defines "parser.h"
3680 ** When reporting useless rules, useless nonterminals, and unused terminals,
3681   Bison now employs the terms "useless in grammar" instead of "useless",
3682   "useless in parser" instead of "never reduced", and "unused in grammar"
3683   instead of "unused".
3685 ** Unreachable State Removal
3687   Previously, Bison sometimes generated parser tables containing unreachable
3688   states.  A state can become unreachable during conflict resolution if Bison
3689   disables a shift action leading to it from a predecessor state.  Bison now:
3691     1. Removes unreachable states.
3693     2. Does not report any conflicts that appeared in unreachable states.
3694        WARNING: As a result, you may need to update %expect and %expect-rr
3695        directives in existing grammar files.
3697     3. For any rule used only in such states, Bison now reports the rule as
3698        "useless in parser due to conflicts".
3700   This feature can be disabled with the following directive:
3702     %define lr.keep_unreachable_states
3704   See the %define entry in the "Bison Declaration Summary" in the Bison manual
3705   for further discussion.
3707 ** Lookahead Set Correction in the ".output" Report
3709   When instructed to generate a ".output" file including lookahead sets
3710   (using "--report=lookahead", for example), Bison now prints each reduction's
3711   lookahead set only next to the associated state's one item that (1) is
3712   associated with the same rule as the reduction and (2) has its dot at the end
3713   of its RHS.  Previously, Bison also erroneously printed the lookahead set
3714   next to all of the state's other items associated with the same rule.  This
3715   bug affected only the ".output" file and not the generated parser source
3716   code.
3718 ** --report-file=FILE is a new option to override the default ".output" file
3719   name.
3721 ** The "=" that used to be required in the following directives is now
3722   deprecated:
3724     %file-prefix "parser"
3725     %name-prefix "c_"
3726     %output "parser.c"
3728 ** An Alternative to "%{...%}" -- "%code QUALIFIER {CODE}"
3730   Bison 2.3a provided a new set of directives as a more flexible alternative to
3731   the traditional Yacc prologue blocks.  Those have now been consolidated into
3732   a single %code directive with an optional qualifier field, which identifies
3733   the purpose of the code and thus the location(s) where Bison should generate
3734   it:
3736     1. "%code          {CODE}" replaces "%after-header  {CODE}"
3737     2. "%code requires {CODE}" replaces "%start-header  {CODE}"
3738     3. "%code provides {CODE}" replaces "%end-header    {CODE}"
3739     4. "%code top      {CODE}" replaces "%before-header {CODE}"
3741   See the %code entries in section "Bison Declaration Summary" in the Bison
3742   manual for a summary of the new functionality.  See the new section "Prologue
3743   Alternatives" for a detailed discussion including the advantages of %code
3744   over the traditional Yacc prologues.
3746   The prologue alternatives are experimental.  More user feedback will help to
3747   determine whether they should become permanent features.
3749 ** Revised warning: unset or unused midrule values
3751   Since Bison 2.2, Bison has warned about midrule values that are set but not
3752   used within any of the actions of the parent rule.  For example, Bison warns
3753   about unused $2 in:
3755     exp: '1' { $$ = 1; } '+' exp { $$ = $1 + $4; };
3757   Now, Bison also warns about midrule values that are used but not set.  For
3758   example, Bison warns about unset $$ in the midrule action in:
3760     exp: '1' { $1 = 1; } '+' exp { $$ = $2 + $4; };
3762   However, Bison now disables both of these warnings by default since they
3763   sometimes prove to be false alarms in existing grammars employing the Yacc
3764   constructs $0 or $-N (where N is some positive integer).
3766   To enable these warnings, specify the option "--warnings=midrule-values" or
3767   "-W", which is a synonym for "--warnings=all".
3769 ** Default %destructor or %printer with "<*>" or "<>"
3771   Bison now recognizes two separate kinds of default %destructor's and
3772   %printer's:
3774     1. Place "<*>" in a %destructor/%printer symbol list to define a default
3775        %destructor/%printer for all grammar symbols for which you have formally
3776        declared semantic type tags.
3778     2. Place "<>" in a %destructor/%printer symbol list to define a default
3779        %destructor/%printer for all grammar symbols without declared semantic
3780        type tags.
3782   Bison no longer supports the "%symbol-default" notation from Bison 2.3a.
3783   "<*>" and "<>" combined achieve the same effect with one exception: Bison no
3784   longer applies any %destructor to a midrule value if that midrule value is
3785   not actually ever referenced using either $$ or $n in a semantic action.
3787   The default %destructor's and %printer's are experimental.  More user
3788   feedback will help to determine whether they should become permanent
3789   features.
3791   See the section "Freeing Discarded Symbols" in the Bison manual for further
3792   details.
3794 ** %left, %right, and %nonassoc can now declare token numbers.  This is required
3795   by POSIX.  However, see the end of section "Operator Precedence" in the Bison
3796   manual for a caveat concerning the treatment of literal strings.
3798 ** The nonfunctional --no-parser, -n, and %no-parser options have been
3799   completely removed from Bison.
3802 * Noteworthy changes in release 2.3a (2006-09-13)
3804 ** Instead of %union, you can define and use your own union type
3805   YYSTYPE if your grammar contains at least one <type> tag.
3806   Your YYSTYPE need not be a macro; it can be a typedef.
3807   This change is for compatibility with other Yacc implementations,
3808   and is required by POSIX.
3810 ** Locations columns and lines start at 1.
3811   In accordance with the GNU Coding Standards and Emacs.
3813 ** You may now declare per-type and default %destructor's and %printer's:
3815   For example:
3817     %union { char *string; }
3818     %token <string> STRING1
3819     %token <string> STRING2
3820     %type  <string> string1
3821     %type  <string> string2
3822     %union { char character; }
3823     %token <character> CHR
3824     %type  <character> chr
3825     %destructor { free ($$); } %symbol-default
3826     %destructor { free ($$); printf ("%d", @$.first_line); } STRING1 string1
3827     %destructor { } <character>
3829   guarantees that, when the parser discards any user-defined symbol that has a
3830   semantic type tag other than "<character>", it passes its semantic value to
3831   "free".  However, when the parser discards a "STRING1" or a "string1", it
3832   also prints its line number to "stdout".  It performs only the second
3833   "%destructor" in this case, so it invokes "free" only once.
3835   [Although we failed to mention this here in the 2.3a release, the default
3836   %destructor's and %printer's were experimental, and they were rewritten in
3837   future versions.]
3839 ** Except for LALR(1) parsers in C with POSIX Yacc emulation enabled (with "-y",
3840   "--yacc", or "%yacc"), Bison no longer generates #define statements for
3841   associating token numbers with token names.  Removing the #define statements
3842   helps to sanitize the global namespace during preprocessing, but POSIX Yacc
3843   requires them.  Bison still generates an enum for token names in all cases.
3845 ** Handling of traditional Yacc prologue blocks is now more consistent but
3846   potentially incompatible with previous releases of Bison.
3848   As before, you declare prologue blocks in your grammar file with the
3849   "%{ ... %}" syntax.  To generate the pre-prologue, Bison concatenates all
3850   prologue blocks that you've declared before the first %union.  To generate
3851   the post-prologue, Bison concatenates all prologue blocks that you've
3852   declared after the first %union.
3854   Previous releases of Bison inserted the pre-prologue into both the header
3855   file and the code file in all cases except for LALR(1) parsers in C.  In the
3856   latter case, Bison inserted it only into the code file.  For parsers in C++,
3857   the point of insertion was before any token definitions (which associate
3858   token numbers with names).  For parsers in C, the point of insertion was
3859   after the token definitions.
3861   Now, Bison never inserts the pre-prologue into the header file.  In the code
3862   file, it always inserts it before the token definitions.
3864 ** Bison now provides a more flexible alternative to the traditional Yacc
3865   prologue blocks: %before-header, %start-header, %end-header, and
3866   %after-header.
3868   For example, the following declaration order in the grammar file reflects the
3869   order in which Bison will output these code blocks.  However, you are free to
3870   declare these code blocks in your grammar file in whatever order is most
3871   convenient for you:
3873     %before-header {
3874       /* Bison treats this block like a pre-prologue block: it inserts it into
3875        * the code file before the contents of the header file.  It does *not*
3876        * insert it into the header file.  This is a good place to put
3877        * #include's that you want at the top of your code file.  A common
3878        * example is '#include "system.h"'.  */
3879     }
3880     %start-header {
3881       /* Bison inserts this block into both the header file and the code file.
3882        * In both files, the point of insertion is before any Bison-generated
3883        * token, semantic type, location type, and class definitions.  This is a
3884        * good place to define %union dependencies, for example.  */
3885     }
3886     %union {
3887       /* Unlike the traditional Yacc prologue blocks, the output order for the
3888        * new %*-header blocks is not affected by their declaration position
3889        * relative to any %union in the grammar file.  */
3890     }
3891     %end-header {
3892       /* Bison inserts this block into both the header file and the code file.
3893        * In both files, the point of insertion is after the Bison-generated
3894        * definitions.  This is a good place to declare or define public
3895        * functions or data structures that depend on the Bison-generated
3896        * definitions.  */
3897     }
3898     %after-header {
3899       /* Bison treats this block like a post-prologue block: it inserts it into
3900        * the code file after the contents of the header file.  It does *not*
3901        * insert it into the header file.  This is a good place to declare or
3902        * define internal functions or data structures that depend on the
3903        * Bison-generated definitions.  */
3904     }
3906   If you have multiple occurrences of any one of the above declarations, Bison
3907   will concatenate the contents in declaration order.
3909   [Although we failed to mention this here in the 2.3a release, the prologue
3910   alternatives were experimental, and they were rewritten in future versions.]
3912 ** The option "--report=look-ahead" has been changed to "--report=lookahead".
3913   The old spelling still works, but is not documented and may be removed
3914   in a future release.
3917 * Noteworthy changes in release 2.3 (2006-06-05)
3919 ** GLR grammars should now use "YYRECOVERING ()" instead of "YYRECOVERING",
3920   for compatibility with LALR(1) grammars.
3922 ** It is now documented that any definition of YYSTYPE or YYLTYPE should
3923   be to a type name that does not contain parentheses or brackets.
3926 * Noteworthy changes in release 2.2 (2006-05-19)
3928 ** The distribution terms for all Bison-generated parsers now permit
3929   using the parsers in nonfree programs.  Previously, this permission
3930   was granted only for Bison-generated LALR(1) parsers in C.
3932 ** %name-prefix changes the namespace name in C++ outputs.
3934 ** The C++ parsers export their token_type.
3936 ** Bison now allows multiple %union declarations, and concatenates
3937   their contents together.
3939 ** New warning: unused values
3940   Right-hand side symbols whose values are not used are reported,
3941   if the symbols have destructors.  For instance:
3943      exp: exp "?" exp ":" exp { $1 ? $1 : $3; }
3944         | exp "+" exp
3945         ;
3947   will trigger a warning about $$ and $5 in the first rule, and $3 in
3948   the second ($1 is copied to $$ by the default rule).  This example
3949   most likely contains three errors, and could be rewritten as:
3951      exp: exp "?" exp ":" exp
3952             { $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); }
3953         | exp "+" exp
3954             { $$ = $1 ? $1 : $3; if ($1) free ($3); }
3955         ;
3957   However, if the original actions were really intended, memory leaks
3958   and all, the warnings can be suppressed by letting Bison believe the
3959   values are used, e.g.:
3961      exp: exp "?" exp ":" exp { $1 ? $1 : $3; (void) ($$, $5); }
3962         | exp "+" exp         { $$ = $1; (void) $3; }
3963         ;
3965   If there are midrule actions, the warning is issued if no action
3966   uses it.  The following triggers no warning: $1 and $3 are used.
3968      exp: exp { push ($1); } '+' exp { push ($3); sum (); };
3970   The warning is intended to help catching lost values and memory leaks.
3971   If a value is ignored, its associated memory typically is not reclaimed.
3973 ** %destructor vs. YYABORT, YYACCEPT, and YYERROR.
3974   Destructors are now called when user code invokes YYABORT, YYACCEPT,
3975   and YYERROR, for all objects on the stack, other than objects
3976   corresponding to the right-hand side of the current rule.
3978 ** %expect, %expect-rr
3979   Incorrect numbers of expected conflicts are now actual errors,
3980   instead of warnings.
3982 ** GLR, YACC parsers.
3983   The %parse-params are available in the destructors (and the
3984   experimental printers) as per the documentation.
3986 ** Bison now warns if it finds a stray "$" or "@" in an action.
3988 ** %require "VERSION"
3989   This specifies that the grammar file depends on features implemented
3990   in Bison version VERSION or higher.
3992 ** lalr1.cc: The token and value types are now class members.
3993   The tokens were defined as free form enums and cpp macros.  YYSTYPE
3994   was defined as a free form union.  They are now class members:
3995   tokens are enumerations of the "yy::parser::token" struct, and the
3996   semantic values have the "yy::parser::semantic_type" type.
3998   If you do not want or can update to this scheme, the directive
3999   '%define "global_tokens_and_yystype" "1"' triggers the global
4000   definition of tokens and YYSTYPE.  This change is suitable both
4001   for previous releases of Bison, and this one.
4003   If you wish to update, then make sure older version of Bison will
4004   fail using '%require "2.2"'.
4006 ** DJGPP support added.
4009 * Noteworthy changes in release 2.1 (2005-09-16)
4011 ** The C++ lalr1.cc skeleton supports %lex-param.
4013 ** Bison-generated parsers now support the translation of diagnostics like
4014   "syntax error" into languages other than English.  The default
4015   language is still English.  For details, please see the new
4016   Internationalization section of the Bison manual.  Software
4017   distributors should also see the new PACKAGING file.  Thanks to
4018   Bruno Haible for this new feature.
4020 ** Wording in the Bison-generated parsers has been changed slightly to
4021   simplify translation.  In particular, the message "memory exhausted"
4022   has replaced "parser stack overflow", as the old message was not
4023   always accurate for modern Bison-generated parsers.
4025 ** Destructors are now called when the parser aborts, for all symbols left
4026   behind on the stack.  Also, the start symbol is now destroyed after a
4027   successful parse.  In both cases, the behavior was formerly inconsistent.
4029 ** When generating verbose diagnostics, Bison-generated parsers no longer
4030   quote the literal strings associated with tokens.  For example, for
4031   a syntax error associated with '%token NUM "number"' they might
4032   print 'syntax error, unexpected number' instead of 'syntax error,
4033   unexpected "number"'.
4036 * Noteworthy changes in release 2.0 (2004-12-25)
4038 ** Possibly-incompatible changes
4040   - Bison-generated parsers no longer default to using the alloca function
4041     (when available) to extend the parser stack, due to widespread
4042     problems in unchecked stack-overflow detection.  You can "#define
4043     YYSTACK_USE_ALLOCA 1" to require the use of alloca, but please read
4044     the manual to determine safe values for YYMAXDEPTH in that case.
4046   - Error token location.
4047     During error recovery, the location of the syntax error is updated
4048     to cover the whole sequence covered by the error token: it includes
4049     the shifted symbols thrown away during the first part of the error
4050     recovery, and the lookahead rejected during the second part.
4052   - Semicolon changes:
4053     . Stray semicolons are no longer allowed at the start of a grammar.
4054     . Semicolons are now required after in-grammar declarations.
4056   - Unescaped newlines are no longer allowed in character constants or
4057     string literals.  They were never portable, and GCC 3.4.0 has
4058     dropped support for them.  Better diagnostics are now generated if
4059     forget a closing quote.
4061   - NUL bytes are no longer allowed in Bison string literals, unfortunately.
4063 ** New features
4065   - GLR grammars now support locations.
4067   - New directive: %initial-action.
4068     This directive allows the user to run arbitrary code (including
4069     initializing @$) from yyparse before parsing starts.
4071   - A new directive "%expect-rr N" specifies the expected number of
4072     reduce/reduce conflicts in GLR parsers.
4074   - %token numbers can now be hexadecimal integers, e.g., "%token FOO 0x12d".
4075     This is a GNU extension.
4077   - The option "--report=lookahead" was changed to "--report=look-ahead".
4078     [However, this was changed back after 2.3.]
4080   - Experimental %destructor support has been added to lalr1.cc.
4082   - New configure option --disable-yacc, to disable installation of the
4083     yacc command and -ly library introduced in 1.875 for POSIX conformance.
4085 ** Bug fixes
4087   - For now, %expect-count violations are now just warnings, not errors.
4088     This is for compatibility with Bison 1.75 and earlier (when there are
4089     reduce/reduce conflicts) and with Bison 1.30 and earlier (when there
4090     are too many or too few shift/reduce conflicts).  However, in future
4091     versions of Bison we plan to improve the %expect machinery so that
4092     these violations will become errors again.
4094   - Within Bison itself, numbers (e.g., goto numbers) are no longer
4095     arbitrarily limited to 16-bit counts.
4097   - Semicolons are now allowed before "|" in grammar rules, as POSIX requires.
4100 * Noteworthy changes in release 1.875 (2003-01-01)
4102 ** The documentation license has been upgraded to version 1.2
4103   of the GNU Free Documentation License.
4105 ** syntax error processing
4107   - In Yacc-style parsers YYLLOC_DEFAULT is now used to compute error
4108     locations too.  This fixes bugs in error-location computation.
4110   - %destructor
4111     It is now possible to reclaim the memory associated to symbols
4112     discarded during error recovery.  This feature is still experimental.
4114   - %error-verbose
4115     This new directive is preferred over YYERROR_VERBOSE.
4117   - #defining yyerror to steal internal variables is discouraged.
4118     It is not guaranteed to work forever.
4120 ** POSIX conformance
4122   - Semicolons are once again optional at the end of grammar rules.
4123     This reverts to the behavior of Bison 1.33 and earlier, and improves
4124     compatibility with Yacc.
4126   - "parse error" -> "syntax error"
4127     Bison now uniformly uses the term "syntax error"; formerly, the code
4128     and manual sometimes used the term "parse error" instead.  POSIX
4129     requires "syntax error" in diagnostics, and it was thought better to
4130     be consistent.
4132   - The documentation now emphasizes that yylex and yyerror must be
4133     declared before use.  C99 requires this.
4135   - Bison now parses C99 lexical constructs like UCNs and
4136     backslash-newline within C escape sequences, as POSIX 1003.1-2001 requires.
4138   - File names are properly escaped in C output.  E.g., foo\bar.y is
4139     output as "foo\\bar.y".
4141   - Yacc command and library now available
4142     The Bison distribution now installs a "yacc" command, as POSIX requires.
4143     Also, Bison now installs a small library liby.a containing
4144     implementations of Yacc-compatible yyerror and main functions.
4145     This library is normally not useful, but POSIX requires it.
4147   - Type clashes now generate warnings, not errors.
4149   - If the user does not define YYSTYPE as a macro, Bison now declares it
4150     using typedef instead of defining it as a macro.
4151     For consistency, YYLTYPE is also declared instead of defined.
4153 ** Other compatibility issues
4155   - %union directives can now have a tag before the "{", e.g., the
4156     directive "%union foo {...}" now generates the C code
4157     "typedef union foo { ... } YYSTYPE;"; this is for Yacc compatibility.
4158     The default union tag is "YYSTYPE", for compatibility with Solaris 9 Yacc.
4159     For consistency, YYLTYPE's struct tag is now "YYLTYPE" not "yyltype".
4160     This is for compatibility with both Yacc and Bison 1.35.
4162   - ";" is output before the terminating "}" of an action, for
4163     compatibility with Bison 1.35.
4165   - Bison now uses a Yacc-style format for conflict reports, e.g.,
4166     "conflicts: 2 shift/reduce, 1 reduce/reduce".
4168   - "yystype" and "yyltype" are now obsolescent macros instead of being
4169     typedefs or tags; they are no longer documented and are planned to be
4170     withdrawn in a future release.
4172 ** GLR parser notes
4174   - GLR and inline
4175     Users of Bison have to decide how they handle the portability of the
4176     C keyword "inline".
4178   - "parsing stack overflow..." -> "parser stack overflow"
4179     GLR parsers now report "parser stack overflow" as per the Bison manual.
4181 ** %parse-param and %lex-param
4182   The macros YYPARSE_PARAM and YYLEX_PARAM provide a means to pass
4183   additional context to yyparse and yylex.  They suffer from several
4184   shortcomings:
4186   - a single argument only can be added,
4187   - their types are weak (void *),
4188   - this context is not passed to ancillary functions such as yyerror,
4189   - only yacc.c parsers support them.
4191   The new %parse-param/%lex-param directives provide a more precise control.
4192   For instance:
4194     %parse-param {int *nastiness}
4195     %lex-param   {int *nastiness}
4196     %parse-param {int *randomness}
4198   results in the following signatures:
4200     int yylex   (int *nastiness);
4201     int yyparse (int *nastiness, int *randomness);
4203   or, if both %pure-parser and %locations are used:
4205     int yylex   (YYSTYPE *lvalp, YYLTYPE *llocp, int *nastiness);
4206     int yyparse (int *nastiness, int *randomness);
4208 ** Bison now warns if it detects conflicting outputs to the same file,
4209   e.g., it generates a warning for "bison -d -o foo.h foo.y" since
4210   that command outputs both code and header to foo.h.
4212 ** #line in output files
4213   - --no-line works properly.
4215 ** Bison can no longer be built by a K&R C compiler; it requires C89 or
4216   later to be built.  This change originally took place a few versions
4217   ago, but nobody noticed until we recently asked someone to try
4218   building Bison with a K&R C compiler.
4221 * Noteworthy changes in release 1.75 (2002-10-14)
4223 ** Bison should now work on 64-bit hosts.
4225 ** Indonesian translation thanks to Tedi Heriyanto.
4227 ** GLR parsers
4228   Fix spurious parse errors.
4230 ** Pure parsers
4231   Some people redefine yyerror to steal yyparse' private variables.
4232   Reenable this trick until an official feature replaces it.
4234 ** Type Clashes
4235   In agreement with POSIX and with other Yaccs, leaving a default
4236   action is valid when $$ is untyped, and $1 typed:
4238         untyped: ... typed;
4240   but the converse remains an error:
4242         typed: ... untyped;
4244 ** Values of midrule actions
4245   The following code:
4247         foo: { ... } { $$ = $1; } ...
4249   was incorrectly rejected: $1 is defined in the second midrule
4250   action, and is equal to the $$ of the first midrule action.
4253 * Noteworthy changes in release 1.50 (2002-10-04)
4255 ** GLR parsing
4256   The declaration
4257      %glr-parser
4258   causes Bison to produce a Generalized LR (GLR) parser, capable of handling
4259   almost any context-free grammar, ambiguous or not.  The new declarations
4260   %dprec and %merge on grammar rules allow parse-time resolution of
4261   ambiguities.  Contributed by Paul Hilfinger.
4263   Unfortunately Bison 1.50 does not work properly on 64-bit hosts
4264   like the Alpha, so please stick to 32-bit hosts for now.
4266 ** Output Directory
4267   When not in Yacc compatibility mode, when the output file was not
4268   specified, running "bison foo/bar.y" created "foo/bar.c".  It
4269   now creates "bar.c".
4271 ** Undefined token
4272   The undefined token was systematically mapped to 2 which prevented
4273   the use of 2 by the user.  This is no longer the case.
4275 ** Unknown token numbers
4276   If yylex returned an out of range value, yyparse could die.  This is
4277   no longer the case.
4279 ** Error token
4280   According to POSIX, the error token must be 256.
4281   Bison extends this requirement by making it a preference: *if* the
4282   user specified that one of her tokens is numbered 256, then error
4283   will be mapped onto another number.
4285 ** Verbose error messages
4286   They no longer report "..., expecting error or..." for states where
4287   error recovery is possible.
4289 ** End token
4290   Defaults to "$end" instead of "$".
4292 ** Error recovery now conforms to documentation and to POSIX
4293   When a Bison-generated parser encounters a syntax error, it now pops
4294   the stack until it finds a state that allows shifting the error
4295   token.  Formerly, it popped the stack until it found a state that
4296   allowed some non-error action other than a default reduction on the
4297   error token.  The new behavior has long been the documented behavior,
4298   and has long been required by POSIX.  For more details, please see
4299   Paul Eggert, "Reductions during Bison error handling" (2002-05-20)
4300   <https://lists.gnu.org/r/bug-bison/2002-05/msg00038.html>.
4302 ** Traces
4303   Popped tokens and nonterminals are now reported.
4305 ** Larger grammars
4306   Larger grammars are now supported (larger token numbers, larger grammar
4307   size (= sum of the LHS and RHS lengths), larger LALR tables).
4308   Formerly, many of these numbers ran afoul of 16-bit limits;
4309   now these limits are 32 bits on most hosts.
4311 ** Explicit initial rule
4312   Bison used to play hacks with the initial rule, which the user does
4313   not write.  It is now explicit, and visible in the reports and
4314   graphs as rule 0.
4316 ** Useless rules
4317   Before, Bison reported the useless rules, but, although not used,
4318   included them in the parsers.  They are now actually removed.
4320 ** Useless rules, useless nonterminals
4321   They are now reported, as a warning, with their locations.
4323 ** Rules never reduced
4324   Rules that can never be reduced because of conflicts are now
4325   reported.
4327 ** Incorrect "Token not used"
4328   On a grammar such as
4330     %token useless useful
4331     %%
4332     exp: '0' %prec useful;
4334   where a token was used to set the precedence of the last rule,
4335   bison reported both "useful" and "useless" as useless tokens.
4337 ** Revert the C++ namespace changes introduced in 1.31
4338   as they caused too many portability hassles.
4340 ** Default locations
4341   By an accident of design, the default computation of @$ was
4342   performed after another default computation was performed: @$ = @1.
4343   The latter is now removed: YYLLOC_DEFAULT is fully responsible of
4344   the computation of @$.
4346 ** Token end-of-file
4347   The token end of file may be specified by the user, in which case,
4348   the user symbol is used in the reports, the graphs, and the verbose
4349   error messages instead of "$end", which remains being the default.
4350   For instance
4351     %token MYEOF 0
4352   or
4353     %token MYEOF 0 "end of file"
4355 ** Semantic parser
4356   This old option, which has been broken for ages, is removed.
4358 ** New translations
4359   Brazilian Portuguese, thanks to Alexandre Folle de Menezes.
4360   Croatian, thanks to Denis Lackovic.
4362 ** Incorrect token definitions
4363   When given
4364     %token 'a' "A"
4365   bison used to output
4366     #define 'a' 65
4368 ** Token definitions as enums
4369   Tokens are output both as the traditional #define's, and, provided
4370   the compiler supports ANSI C or is a C++ compiler, as enums.
4371   This lets debuggers display names instead of integers.
4373 ** Reports
4374   In addition to --verbose, bison supports --report=THINGS, which
4375   produces additional information:
4376   - itemset
4377     complete the core item sets with their closure
4378   - lookahead [changed to "look-ahead" in 1.875e through 2.3, but changed back]
4379     explicitly associate lookahead tokens to items
4380   - solved
4381     describe shift/reduce conflicts solving.
4382     Bison used to systematically output this information on top of
4383     the report.  Solved conflicts are now attached to their states.
4385 ** Type clashes
4386   Previous versions don't complain when there is a type clash on
4387   the default action if the rule has a midrule action, such as in:
4389     %type <foo> bar
4390     %%
4391     bar: '0' {} '0';
4393   This is fixed.
4395 ** GNU M4 is now required when using Bison.
4398 * Noteworthy changes in release 1.35 (2002-03-25)
4400 ** C Skeleton
4401   Some projects use Bison's C parser with C++ compilers, and define
4402   YYSTYPE as a class.  The recent adjustment of C parsers for data
4403   alignment and 64 bit architectures made this impossible.
4405   Because for the time being no real solution for C++ parser
4406   generation exists, kludges were implemented in the parser to
4407   maintain this use.  In the future, when Bison has C++ parsers, this
4408   kludge will be disabled.
4410   This kludge also addresses some C++ problems when the stack was
4411   extended.
4414 * Noteworthy changes in release 1.34 (2002-03-12)
4416 ** File name clashes are detected
4417   $ bison foo.y -d -o foo.x
4418   fatal error: header and parser would both be named "foo.x"
4420 ** A missing ";" at the end of a rule triggers a warning
4421   In accordance with POSIX, and in agreement with other
4422   Yacc implementations, Bison will mandate this semicolon in the near
4423   future.  This eases the implementation of a Bison parser of Bison
4424   grammars by making this grammar LALR(1) instead of LR(2).  To
4425   facilitate the transition, this release introduces a warning.
4427 ** Revert the C++ namespace changes introduced in 1.31, as they caused too
4428   many portability hassles.
4430 ** DJGPP support added.
4432 ** Fix test suite portability problems.
4435 * Noteworthy changes in release 1.33 (2002-02-07)
4437 ** Fix C++ issues
4438   Groff could not be compiled for the definition of size_t was lacking
4439   under some conditions.
4441 ** Catch invalid @n
4442   As is done with $n.
4445 * Noteworthy changes in release 1.32 (2002-01-23)
4447 ** Fix Yacc output file names
4449 ** Portability fixes
4451 ** Italian, Dutch translations
4454 * Noteworthy changes in release 1.31 (2002-01-14)
4456 ** Many Bug Fixes
4458 ** GNU Gettext and %expect
4459   GNU Gettext asserts 10 s/r conflicts, but there are 7.  Now that
4460   Bison dies on incorrect %expectations, we fear there will be
4461   too many bug reports for Gettext, so _for the time being_, %expect
4462   does not trigger an error when the input file is named "plural.y".
4464 ** Use of alloca in parsers
4465   If YYSTACK_USE_ALLOCA is defined to 0, then the parsers will use
4466   malloc exclusively.  Since 1.29, but was not NEWS'ed.
4468   alloca is used only when compiled with GCC, to avoid portability
4469   problems as on AIX.
4471 ** yyparse now returns 2 if memory is exhausted; formerly it dumped core.
4473 ** When the generated parser lacks debugging code, YYDEBUG is now 0
4474   (as POSIX requires) instead of being undefined.
4476 ** User Actions
4477   Bison has always permitted actions such as { $$ = $1 }: it adds the
4478   ending semicolon.  Now if in Yacc compatibility mode, the semicolon
4479   is no longer output: one has to write { $$ = $1; }.
4481 ** Better C++ compliance
4482   The output parsers try to respect C++ namespaces.
4483   [This turned out to be a failed experiment, and it was reverted later.]
4485 ** Reduced Grammars
4486   Fixed bugs when reporting useless nonterminals.
4488 ** 64 bit hosts
4489   The parsers work properly on 64 bit hosts.
4491 ** Error messages
4492   Some calls to strerror resulted in scrambled or missing error messages.
4494 ** %expect
4495   When the number of shift/reduce conflicts is correct, don't issue
4496   any warning.
4498 ** The verbose report includes the rule line numbers.
4500 ** Rule line numbers are fixed in traces.
4502 ** Swedish translation
4504 ** Parse errors
4505   Verbose parse error messages from the parsers are better looking.
4506   Before: parse error: unexpected `'/'', expecting `"number"' or `'-'' or `'(''
4507      Now: parse error: unexpected '/', expecting "number" or '-' or '('
4509 ** Fixed parser memory leaks.
4510   When the generated parser was using malloc to extend its stacks, the
4511   previous allocations were not freed.
4513 ** Fixed verbose output file.
4514   Some newlines were missing.
4515   Some conflicts in state descriptions were missing.
4517 ** Fixed conflict report.
4518   Option -v was needed to get the result.
4520 ** %expect
4521   Was not used.
4522   Mismatches are errors, not warnings.
4524 ** Fixed incorrect processing of some invalid input.
4526 ** Fixed CPP guards: 9foo.h uses BISON_9FOO_H instead of 9FOO_H.
4528 ** Fixed some typos in the documentation.
4530 ** %token MY_EOF 0 is supported.
4531   Before, MY_EOF was silently renumbered as 257.
4533 ** doc/refcard.tex is updated.
4535 ** %output, %file-prefix, %name-prefix.
4536   New.
4538 ** --output
4539   New, aliasing "--output-file".
4542 * Noteworthy changes in release 1.30 (2001-10-26)
4544 ** "--defines" and "--graph" have now an optional argument which is the
4545   output file name. "-d" and "-g" do not change; they do not take any
4546   argument.
4548 ** "%source_extension" and "%header_extension" are removed, failed
4549   experiment.
4551 ** Portability fixes.
4554 * Noteworthy changes in release 1.29 (2001-09-07)
4556 ** The output file does not define const, as this caused problems when used
4557   with common autoconfiguration schemes.  If you still use ancient compilers
4558   that lack const, compile with the equivalent of the C compiler option
4559   "-Dconst=".  Autoconf's AC_C_CONST macro provides one way to do this.
4561 ** Added "-g" and "--graph".
4563 ** The Bison manual is now distributed under the terms of the GNU FDL.
4565 ** The input and the output files has automatically a similar extension.
4567 ** Russian translation added.
4569 ** NLS support updated; should hopefully be less troublesome.
4571 ** Added the old Bison reference card.
4573 ** Added "--locations" and "%locations".
4575 ** Added "-S" and "--skeleton".
4577 ** "%raw", "-r", "--raw" is disabled.
4579 ** Special characters are escaped when output.  This solves the problems
4580   of the #line lines with path names including backslashes.
4582 ** New directives.
4583   "%yacc", "%fixed_output_files", "%defines", "%no_parser", "%verbose",
4584   "%debug", "%source_extension" and "%header_extension".
4586 ** @$
4587   Automatic location tracking.
4590 * Noteworthy changes in release 1.28 (1999-07-06)
4592 ** Should compile better now with K&R compilers.
4594 ** Added NLS.
4596 ** Fixed a problem with escaping the double quote character.
4598 ** There is now a FAQ.
4601 * Noteworthy changes in release 1.27
4603 ** The make rule which prevented bison.simple from being created on
4604   some systems has been fixed.
4607 * Noteworthy changes in release 1.26
4609 ** Bison now uses Automake.
4611 ** New mailing lists: <bug-bison@gnu.org> and <help-bison@gnu.org>.
4613 ** Token numbers now start at 257 as previously documented, not 258.
4615 ** Bison honors the TMPDIR environment variable.
4617 ** A couple of buffer overruns have been fixed.
4619 ** Problems when closing files should now be reported.
4621 ** Generated parsers should now work even on operating systems which do
4622   not provide alloca().
4625 * Noteworthy changes in release 1.25 (1995-10-16)
4627 ** Errors in the input grammar are not fatal; Bison keeps reading
4628 the grammar file, and reports all the errors found in it.
4630 ** Tokens can now be specified as multiple-character strings: for
4631 example, you could use "<=" for a token which looks like <=, instead
4632 of choosing a name like LESSEQ.
4634 ** The %token_table declaration says to write a table of tokens (names
4635 and numbers) into the parser file.  The yylex function can use this
4636 table to recognize multiple-character string tokens, or for other
4637 purposes.
4639 ** The %no_lines declaration says not to generate any #line preprocessor
4640 directives in the parser file.
4642 ** The %raw declaration says to use internal Bison token numbers, not
4643 Yacc-compatible token numbers, when token names are defined as macros.
4645 ** The --no-parser option produces the parser tables without including
4646 the parser engine; a project can now use its own parser engine.
4647 The actions go into a separate file called NAME.act, in the form of
4648 a switch statement body.
4651 * Noteworthy changes in release 1.23
4653 The user can define YYPARSE_PARAM as the name of an argument to be
4654 passed into yyparse.  The argument should have type void *.  It should
4655 actually point to an object.  Grammar actions can access the variable
4656 by casting it to the proper pointer type.
4658 Line numbers in output file corrected.
4661 * Noteworthy changes in release 1.22
4663 --help option added.
4666 * Noteworthy changes in release 1.20
4668 Output file does not redefine const for C++.
4670 -----
4672 LocalWords:  yacc YYBACKUP glr GCC lalr ArrayIndexOutOfBoundsException nullptr
4673 LocalWords:  cplusplus liby rpl fprintf mfcalc Wyacc stmt cond expr mk sym lr
4674 LocalWords:  IELR ielr Lookahead YYERROR nonassoc LALR's api lookaheads yychar
4675 LocalWords:  destructor lookahead YYRHSLOC YYLLOC Rhs ifndef YYFAIL cpp sr rr
4676 LocalWords:  preprocessor initializer Wno Wnone Werror FreeBSD prec livelocks
4677 LocalWords:  Solaris AIX UX RHEL Tru LHS gcc's Wundef YYENABLE NLS YYLTYPE VCG
4678 LocalWords:  yyerror cpp's Wunused yylval yylloc prepend yyparse yylex yypush
4679 LocalWords:  Graphviz xml nonterminals midrule destructor's YYSTYPE typedef ly
4680 LocalWords:  CHR chr printf stdout namespace preprocessing enum pre include's
4681 LocalWords:  YYRECOVERING nonfree destructors YYABORT YYACCEPT params enums de
4682 LocalWords:  struct yystype DJGPP lex param Haible NUM alloca YYSTACK NUL goto
4683 LocalWords:  YYMAXDEPTH Unescaped UCNs YYLTYPE's yyltype typedefs inline Yaccs
4684 LocalWords:  Heriyanto Reenable dprec Hilfinger Eggert MYEOF Folle Menezes EOF
4685 LocalWords:  Lackovic define's itemset Groff Gettext malloc NEWS'ed YYDEBUG YY
4686 LocalWords:  namespaces strerror const autoconfiguration Dconst Autoconf's FDL
4687 LocalWords:  Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
4688 LocalWords:  extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
4689 LocalWords:  lang yyoutput dvi html ps POSIX lvalp llocp Wother nterm arg init
4690 LocalWords:  TOK calc yyo fval Wconflicts parsers yystackp yyval yynerrs
4691 LocalWords:  Théophile Ranquet Santet fno fnone stype associativity Tolmer
4692 LocalWords:  Wprecedence Rassoul Wempty Paolo Bonzini parser's Michiel loc
4693 LocalWords:  redeclaration sval fcaret reentrant XSLT xsl Wmaybe yyvsp Tedi
4694 LocalWords:  pragmas noreturn untyped Rozenman unexpanded Wojciech Polak
4695 LocalWords:  Alexandre MERCHANTABILITY yytype emplace ptr automove lvalues
4696 LocalWords:  nonterminal yy args Pragma dereference yyformat rhs docdir bw
4697 LocalWords:  Redeclarations rpcalc Autoconf YFLAGS Makefiles PROG DECL num
4698 LocalWords:  Heimbigner AST src ast Makefile srcdir MinGW xxlex XXSTYPE CVE
4699 LocalWords:  XXLTYPE strictfp IDEs ffixit fdiagnostics parseable fixits
4700 LocalWords:  Wdeprecated yytext Variadic variadic yyrhs yyphrs RCS README
4701 LocalWords:  noexcept constexpr ispell american deprecations backend Teoh
4702 LocalWords:  YYPRINT Mangold Bonzini's Wdangling exVal baz checkable gcc
4703 LocalWords:  fsanitize Vogelsgesang lis redeclared stdint automata yytname
4704 LocalWords:  yysymbol yytnamerr yyreport ctx ARGMAX yysyntax stderr LPAREN
4705 LocalWords:  symrec yypcontext TOKENMAX yyexpected YYEMPTY yypstate YYEOF
4706 LocalWords:  autocompletion bistromathic submessages Cayuela lexcalc hoc
4707 LocalWords:  yytoken YYUNDEF YYerror basename Automake's UTF ifdef ffile
4708 LocalWords:  gotos readline Imbimbo Wcounterexamples Wcex Nonunifying rcex
4709 LocalWords:  Vais xsltproc YYNOMEM YYLOCATION signedness YYBISON MITRE's
4710 LocalWords:  libreadline YYMALLOC YYFREE MSVC redefinitions
4712 Local Variables:
4713 ispell-dictionary: "american"
4714 mode: outline
4715 fill-column: 76
4716 End:
4718 Copyright (C) 1995-2015, 2018-2021 Free Software Foundation, Inc.
4720 This file is part of Bison, the GNU Parser Generator.
4722 Permission is granted to copy, distribute and/or modify this document
4723 under the terms of the GNU Free Documentation License, Version 1.3 or
4724 any later version published by the Free Software Foundation; with no
4725 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
4726 Texts.  A copy of the license is included in the "GNU Free
4727 Documentation License" file as part of this distribution.