news: update
[bison.git] / NEWS
blob819f5fe6d83849efb1aa6c6c588a74da42543bc1
1 GNU Bison NEWS
3 * Noteworthy changes in release ?.? (????-??-??) [?]
5   Fixed portability issues of bison on Cygwin.
7   Improvements in glr2.cc: add support for custom error messages (`%define
8   parse.error custom`), allow linking several parsers together.
10 * Noteworthy changes in release 3.8.1 (2021-09-11) [stable]
12   The generation of prototypes for yylex and yyerror in Yacc mode is
13   breaking existing grammar files.  To avoid breaking too many grammars, the
14   prototypes are now generated when `-y/--yacc` is used *and* the
15   `POSIXLY_CORRECT` environment variable is defined.
17   Avoid using `-y`/`--yacc` simply to comply with Yacc's file name
18   conventions, rather, use `-o y.tab.c`.  Autoconf's AC_PROG_YACC macro uses
19   `-y`.  Avoid it if possible, for instance by using gnulib's gl_PROG_BISON.
21 * Noteworthy changes in release 3.8 (2021-09-07) [stable]
23 ** Backward incompatible changes
25   In conformance with the recommendations of the Graphviz team
26   (https://marc.info/?l=graphviz-devel&m=129418103126092), `-g`/`--graph`
27   now generates a *.gv file by default, instead of *.dot.  A transition
28   started in Bison 3.4.
30   To comply with the latest POSIX standard, in Yacc compatibility mode
31   (options `-y`/`--yacc`) Bison now generates prototypes for yyerror and
32   yylex.  In some situations, this is breaking compatibility: if the user
33   has already declared these functions but with some differences (e.g., to
34   declare them as static, or to use specific attributes), the generated
35   parser will fail to compile.  To disable these prototypes, #define yyerror
36   (to `yyerror`), and likewise for yylex.
38 ** Deprecated features
40   Support for the YYPRINT macro is removed. It worked only with yacc.c and
41   only for tokens.  It was obsoleted by %printer, introduced in Bison 1.50
42   (November 2002).
44   It has always been recommended to prefer `%define api.value.type foo` to
45   `#define YYSTYPE foo`.  The latter is supported in C for compatibility
46   with Yacc, but not in C++.  Warnings are now issued if `#define YYSTYPE`
47   is used in C++, and eventually support will be removed.
49   In C++ code, prefer value_type to semantic_type to denote the semantic
50   value type, which is specified by the `api.value.type` %define variable.
52 ** New features
54 *** A skeleton for the D programming language
56   The "lalr1.d" skeleton is now officially part of Bison.
58   It was originally contributed by Oliver Mangold, based on Paolo Bonzini's
59   lalr1.java, and was improved by H. S. Teoh.  Adela Vais then took over
60   maintenance and invested a lot of efforts to complete, test and document
61   it.
63   It now supports all the bells and whistles of the other deterministic
64   parsers, which include: pull/push interfaces, verbose and custom error
65   messages, lookahead correction, token constructors, internationalization,
66   locations, printers, token and symbol prefixes, etc.
68   Two examples demonstrate the D parsers: a basic one (examples/d/simple),
69   and an advanced one (examples/d/calc).
71 *** Option -H, --header and directive %header
73   The option `-H`/`--header` supersedes the option `--defines`, and the
74   directive %header supersedes %defines.  Both `--defines` and `%defines`
75   are, of course, maintained for backward compatibility.
77 *** Option --html
79   Since version 2.4 Bison can be used to generate HTML reports.  However it
80   was a two-step process: first bison must be invoked with option `--xml`,
81   and then xsltproc must be run to the convert the XML reports into HTML.
83   The new option `--html` combines these steps.  The xsltproc program must
84   be available.
86 *** A C++ native GLR parser
88   A new version of the C++ GLR parser was added: "glr2.cc".  It generates
89   "true C++11", instead of a C++ wrapper around a C parser as does the
90   existing "glr.cc" parser.  As a first significant consequence, it supports
91   `%define api.value.type variant`, contrary to glr.cc.
93   It should be upward compatible in terms of interface, feature and
94   performance to "glr.cc". To try it out, simply use
96   %skeleton "glr2.cc"
98   It will eventually replace "glr.cc".  However we need user feedback on
99   this skeleton.  _Please_ report your results and comments about it.
101 *** Counterexamples
103   Counterexamples now show the rule numbers, and always show ε for rules
104   with an empty right-hand side.  For instance
106     exp
107     ↳ 1: e1       e2     "a"
108          ↳ 3: ε • ↳ 1: ε
110   instead of
112     exp
113     ↳ e1  e2  "a"
114       ↳ • ↳ ε
116 *** Lookahead correction in Java
118   The Java skeleton (lalr1.java) now supports LAC, via the `parse.lac`
119   %define variable.
121 *** Abort parsing for memory exhaustion (C)
123   User actions may now use `YYNOMEM` (similar to `YYACCEPT` and `YYABORT`)
124   to abort the current parse with memory exhaustion.
126 *** Printing locations in debug traces (C)
128   The `YYLOCATION_PRINT(File, Loc)` macro prints a location.  It is defined
129   when (i) locations are enabled, (ii) the default type for locations is
130   used, (iii) debug traces are enabled, and (iv) `YYLOCATION_PRINT` is not
131   already defined.
133   Users may define `YYLOCATION_PRINT` to cover other cases.
135 *** GLR traces
137   There were no debug traces for deferred calls to user actions.  They are
138   logged now.
141 * Noteworthy changes in release 3.7.6 (2021-03-08) [stable]
143 ** Bug fixes
145 *** Reused Push Parsers
147   When a push-parser state structure is used for multiple parses, it was
148   possible for some state to leak from one run into the following one.
150 *** Fix Table Generation
152   In some very rare conditions, when there are many useless tokens, it was
153   possible to generate incorrect parsers.
156 * Noteworthy changes in release 3.7.5 (2021-01-24) [stable]
158 ** Bug fixes
160 *** Counterexample Generation
162   In some cases counterexample generation could crash.  This is fixed.
164 *** Fix Table Generation
166   In some very rare conditions, when there are many useless tokens, it was
167   possible to generate incorrect parsers.
169 *** GLR parsers now support %merge together with api.value.type=union.
171 *** C++ parsers use noexcept in more places.
173 *** Generated parsers avoid some warnings about signedness issues.
175 *** C-language parsers now avoid warnings from pedantic clang.
177 *** C-language parsers now work around quirks of HP-UX 11.23 (2003).
180 * Noteworthy changes in release 3.7.4 (2020-11-14) [stable]
182 ** Bug fixes
184 *** Bug fixes in yacc.c
186   In Yacc mode, all the tokens are defined twice: once as an enum, and then
187   as a macro.  YYEMPTY was missing its macro.
189 *** Bug fixes in lalr1.cc
191   The lalr1.cc skeleton used to emit internal assertions (using YY_ASSERT)
192   even when the `parse.assert` %define variable is not enabled.  It no
193   longer does.
195   The private internal macro YY_ASSERT now obeys the `api.prefix` %define
196   variable.
198   When there is a very large number of tokens, some assertions could be long
199   enough to hit arbitrary limits in Visual C++.  They have been rewritten to
200   work around this limitation.
202 ** Changes
204   The YYBISON macro in generated "regular C parsers" (from the "yacc.c"
205   skeleton) used to be defined to 1.  It is now defined to the version of
206   Bison as an integer (e.g., 30704 for version 3.7.4).
209 * Noteworthy changes in release 3.7.3 (2020-10-13) [stable]
211 ** Bug fixes
213   Fix concurrent build issues.
215   The bison executable is no longer linked uselessly against libreadline.
217   Fix incorrect use of yytname in glr.cc.
220 * Noteworthy changes in release 3.7.2 (2020-09-05) [stable]
222   This release of Bison fixes all known bugs reported for Bison in MITRE's
223   Common Vulnerabilities and Exposures (CVE) system.  These vulnerabilities
224   are only about bison-the-program itself, not the generated code.
226   Although these bugs are typically irrelevant to how Bison is used, they
227   are worth fixing if only to give users peace of mind.
229   There is no known vulnerability in the generated parsers.
231 ** Bug fixes
233   Fix concurrent build issues (introduced in Bison 3.5).
235   Push parsers always use YYMALLOC/YYFREE (no direct calls to malloc/free).
237   Fix portability issues of the test suite, and of bison itself.
239   Some unlikely crashes found by fuzzing have been fixed.  This is only
240   about bison itself, not the generated parsers.
243 * Noteworthy changes in release 3.7.1 (2020-08-02) [stable]
245 ** Bug fixes
247   Crash when a token alias contains a NUL byte.
249   Portability issues with libtextstyle.
251   Portability issues of Bison itself with MSVC.
253 ** Changes
255   Improvements and fixes in the documentation.
257   More precise location about symbol type redefinitions.
260 * Noteworthy changes in release 3.7 (2020-07-23) [stable]
262 ** Deprecated features
264   The YYPRINT macro, which works only with yacc.c and only for tokens, was
265   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
266   It is deprecated and its support will be removed eventually.
268   In conformance with the recommendations of the Graphviz team, in the next
269   version Bison the option `--graph` will generate a *.gv file by default,
270   instead of *.dot.  A transition started in Bison 3.4.
272 ** New features
274 *** Counterexample Generation
276   Contributed by Vincent Imbimbo.
278   When given `-Wcounterexamples`/`-Wcex`, bison will now output
279   counterexamples for conflicts.
281 **** Unifying Counterexamples
283   Unifying counterexamples are strings which can be parsed in two ways due
284   to the conflict.  For example on a grammar that contains the usual
285   "dangling else" ambiguity:
287     $ bison else.y
288     else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
289     else.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
291     $ bison else.y -Wcex
292     else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
293     else.y: warning: shift/reduce conflict on token "else" [-Wcounterexamples]
294       Example: "if" exp "then" "if" exp "then" exp • "else" exp
295       Shift derivation
296         exp
297         ↳ "if" exp "then" exp
298                           ↳ "if" exp "then" exp • "else" exp
299       Example: "if" exp "then" "if" exp "then" exp • "else" exp
300       Reduce derivation
301         exp
302         ↳ "if" exp "then" exp                     "else" exp
303                           ↳ "if" exp "then" exp •
305   When text styling is enabled, colors are used in the examples and the
306   derivations to highlight the structure of both analyses.  In this case,
308     "if" exp "then" [ "if" exp "then" exp • ] "else" exp
310   vs.
312     "if" exp "then" [ "if" exp "then" exp • "else" exp ]
315   The counterexamples are "focused", in two different ways.  First, they do
316   not clutter the output with all the derivations from the start symbol,
317   rather they start on the "conflicted nonterminal". They go straight to the
318   point.  Second, they don't "expand" nonterminal symbols uselessly.
320 **** Nonunifying Counterexamples
322   In the case of the dangling else, Bison found an example that can be
323   parsed in two ways (therefore proving that the grammar is ambiguous).
324   When it cannot find such an example, it instead generates two examples
325   that are the same up until the dot:
327     $ bison foo.y
328     foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
329     foo.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
330     foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
331         4 | a: expr
332           |    ^~~~
334     $ bison -Wcex foo.y
335     foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
336     foo.y: warning: shift/reduce conflict on token ID [-Wcounterexamples]
337       First example: expr • ID ',' ID $end
338       Shift derivation
339         $accept
340         ↳ s                      $end
341           ↳ a                 ID
342             ↳ expr
343               ↳ expr • ID ','
344       Second example: expr • ID $end
345       Reduce derivation
346         $accept
347         ↳ s             $end
348           ↳ a        ID
349             ↳ expr •
350     foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
351         4 | a: expr
352           |    ^~~~
354   In these cases, the parser usually doesn't have enough lookahead to
355   differentiate the two given examples.
357 **** Reports
359   Counterexamples are also included in the report when given
360   `--report=counterexamples`/`-rcex` (or `--report=all`), with more
361   technical details:
363     State 7
365       1 exp: "if" exp "then" exp •  [$end, "then", "else"]
366       2    | "if" exp "then" exp • "else" exp
368       "else"  shift, and go to state 8
370       "else"    [reduce using rule 1 (exp)]
371       $default  reduce using rule 1 (exp)
373       shift/reduce conflict on token "else":
374           1 exp: "if" exp "then" exp •
375           2 exp: "if" exp "then" exp • "else" exp
376         Example: "if" exp "then" "if" exp "then" exp • "else" exp
377         Shift derivation
378           exp
379           ↳ "if" exp "then" exp
380                             ↳ "if" exp "then" exp • "else" exp
381         Example: "if" exp "then" "if" exp "then" exp • "else" exp
382         Reduce derivation
383           exp
384           ↳ "if" exp "then" exp                     "else" exp
385                             ↳ "if" exp "then" exp •
387 *** File prefix mapping
389   Contributed by Joshua Watt.
391   Bison learned a new argument, `--file-prefix-map OLD=NEW`.  Any file path
392   in the output (specifically `#line` directives and `#ifdef` header guards)
393   that begins with the prefix OLD will have it replaced with the prefix NEW,
394   similar to the `-ffile-prefix-map` in GCC.  This option can be used to
395   make bison output reproducible.
397 ** Changes
399 *** Diagnostics
401   When text styling is enabled and the terminal supports it, the warnings
402   now include hyperlinks to the documentation.
404 *** Relocatable installation
406   When installed to be relocatable (via `configure --enable-relocatable`),
407   bison will now also look for a relocated m4.
409 *** C++ file names
411   The `filename_type` %define variable was renamed `api.filename.type`.
412   Instead of
414     %define filename_type "symbol"
416   write
418     %define api.filename.type {symbol}
420   (Or let `bison --update` do it for you).
422   It now defaults to `const std::string` instead of `std::string`.
424 *** Deprecated %define variable names
426   The following variables have been renamed for consistency.  Backward
427   compatibility is ensured, but upgrading is recommended.
429     filename_type       -> api.filename.type
430     package             -> api.package
432 *** Push parsers no longer clear their state when parsing is finished
434   Previously push-parsers cleared their state when parsing was finished (on
435   success and on failure).  This made it impossible to check if there were
436   parse errors, since `yynerrs` was also reset.  This can be especially
437   troublesome when used in autocompletion, since a parser with error
438   recovery would suggest (irrelevant) expected tokens even if there were
439   failures.
441   Now the parser state can be examined when parsing is finished.  The parser
442   state is reset when starting a new parse.
444 ** Documentation
446 *** Examples
448   The bistromathic demonstrates %param and how to quote sources in the error
449   messages:
451     > 123 456
452     1.5-7: syntax error: expected end of file or + or - or * or / or ^ before number
453         1 | 123 456
454           |     ^~~
456 ** Bug fixes
458 *** Include the generated header (yacc.c)
460   Historically, when --defines was used, bison generated a header and pasted
461   an exact copy of it into the generated parser implementation file.  Since
462   Bison 3.4 it is possible to specify that the header should be `#include`d,
463   and how.  For instance
465     %define api.header.include {"parse.h"}
467   or
469     %define api.header.include {<parser/parse.h>}
471   Now api.header.include defaults to `"header-basename"`, as was intended in
472   Bison 3.4, where `header-basename` is the basename of the generated
473   header.  This is disabled when the generated header is `y.tab.h`, to
474   comply with Automake's ylwrap.
476 *** String aliases are faithfully propagated
478   Bison used to interpret user strings (i.e., decoding backslash escapes)
479   when reading them, and to escape them (i.e., issue non-printable
480   characters as backslash escapes, taking the locale into account) when
481   outputting them.  As a consequence non-ASCII strings (say in UTF-8) ended
482   up "ciphered" as sequences of backslash escapes.  This happened not only
483   in the generated sources (where the compiler will reinterpret them), but
484   also in all the generated reports (text, xml, html, dot, etc.).  Reports
485   were therefore not readable when string aliases were not pure ASCII.
486   Worse yet: the output depended on the user's locale.
488   Now Bison faithfully treats the string aliases exactly the way the user
489   spelled them.  This fixes all the aforementioned problems.  However, now,
490   string aliases semantically equivalent but syntactically different (e.g.,
491   "A", "\x41", "\101") are considered to be different.
493 *** Crash when generating IELR
495   An old, well hidden, bug in the generation of IELR parsers was fixed.
498 * Noteworthy changes in release 3.6.4 (2020-06-15) [stable]
500 ** Bug fixes
502   In glr.cc some internal macros leaked in the user's code, and could damage
503   access to the token kinds.
506 * Noteworthy changes in release 3.6.3 (2020-06-03) [stable]
508 ** Bug fixes
510   Incorrect comments in the generated parsers.
512   Warnings in push parsers (yacc.c).
514   Incorrect display of gotos in LAC traces (lalr1.cc).
517 * Noteworthy changes in release 3.6.2 (2020-05-17) [stable]
519 ** Bug fixes
521   Some tests were fixed.
523   When token aliases contain comment delimiters:
525     %token FOO "/* foo */"
527   bison used to emit "nested" comments, which is invalid C.
530 * Noteworthy changes in release 3.6.1 (2020-05-10) [stable]
532 ** Bug fixes
534   Restored ANSI-C compliance in yacc.c.
536   GNU readline portability issues.
538   In C++, yy::parser::symbol_name is now a public member, as was intended.
540 ** New features
542   In C++, yy::parser::symbol_type now has a public name() member function.
545 * Noteworthy changes in release 3.6 (2020-05-08) [stable]
547 ** Backward incompatible changes
549   TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose".
551   The YYERROR_VERBOSE macro is no longer supported; the parsers that still
552   depend on it will now produce Yacc-like error messages (just "syntax
553   error").  It was superseded by the "%error-verbose" directive in Bison
554   1.875 (2003-01-01).  Bison 2.6 (2012-07-19) clearly announced that support
555   for YYERROR_VERBOSE would be removed.  Note that since Bison 3.0
556   (2013-07-25), "%error-verbose" is deprecated in favor of "%define
557   parse.error verbose".
559 ** Deprecated features
561   The YYPRINT macro, which works only with yacc.c and only for tokens, was
562   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
563   It is deprecated and its support will be removed eventually.
565 ** New features
567 *** Improved syntax error messages
569   Two new values for the %define parse.error variable offer more control to
570   the user.  Available in all the skeletons (C, C++, Java).
572 **** %define parse.error detailed
574   The behavior of "%define parse.error detailed" is closely resembling that
575   of "%define parse.error verbose" with a few exceptions.  First, it is safe
576   to use non-ASCII characters in token aliases (with 'verbose', the result
577   depends on the locale with which bison was run).  Second, a yysymbol_name
578   function is exposed to the user, instead of the yytnamerr function and the
579   yytname table.  Third, token internationalization is supported (see
580   below).
582 **** %define parse.error custom
584   With this directive, the user forges and emits the syntax error message
585   herself by defining the yyreport_syntax_error function.  A new type,
586   yypcontext_t, captures the circumstances of the error, and provides the
587   user with functions to get details, such as yypcontext_expected_tokens to
588   get the list of expected token kinds.
590   A possible implementation of yyreport_syntax_error is:
592     int
593     yyreport_syntax_error (const yypcontext_t *ctx)
594     {
595       int res = 0;
596       YY_LOCATION_PRINT (stderr, *yypcontext_location (ctx));
597       fprintf (stderr, ": syntax error");
598       // Report the tokens expected at this point.
599       {
600         enum { TOKENMAX = 10 };
601         yysymbol_kind_t expected[TOKENMAX];
602         int n = yypcontext_expected_tokens (ctx, expected, TOKENMAX);
603         if (n < 0)
604           // Forward errors to yyparse.
605           res = n;
606         else
607           for (int i = 0; i < n; ++i)
608             fprintf (stderr, "%s %s",
609                      i == 0 ? ": expected" : " or", yysymbol_name (expected[i]));
610       }
611       // Report the unexpected token.
612       {
613         yysymbol_kind_t lookahead = yypcontext_token (ctx);
614         if (lookahead != YYSYMBOL_YYEMPTY)
615           fprintf (stderr, " before %s", yysymbol_name (lookahead));
616       }
617       fprintf (stderr, "\n");
618       return res;
619     }
621 **** Token aliases internationalization
623   When the %define variable parse.error is set to `custom` or `detailed`,
624   one may specify which token aliases are to be translated using _().  For
625   instance
627     %token
628         PLUS   "+"
629         MINUS  "-"
630       <double>
631         NUM _("number")
632       <symrec*>
633         FUN _("function")
634         VAR _("variable")
636   In that case the user must define _() and N_(), and yysymbol_name returns
637   the translated symbol (i.e., it returns '_("variable")' rather that
638   '"variable"').  In Java, the user must provide an i18n() function.
640 *** List of expected tokens (yacc.c)
642   Push parsers may invoke yypstate_expected_tokens at any point during
643   parsing (including even before submitting the first token) to get the list
644   of possible tokens.  This feature can be used to propose autocompletion
645   (see below the "bistromathic" example).
647   It makes little sense to use this feature without enabling LAC (lookahead
648   correction).
650 *** Returning the error token
652   When the scanner returns an invalid token or the undefined token
653   (YYUNDEF), the parser generates an error message and enters error
654   recovery.  Because of that error message, most scanners that find lexical
655   errors generate an error message, and then ignore the invalid input
656   without entering the error-recovery.
658   The scanners may now return YYerror, the error token, to enter the
659   error-recovery mode without triggering an additional error message.  See
660   the bistromathic for an example.
662 *** Deep overhaul of the symbol and token kinds
664   To avoid the confusion with types in programming languages, we now refer
665   to token and symbol "kinds" instead of token and symbol "types".  The
666   documentation and error messages have been revised.
668   All the skeletons have been updated to use dedicated enum types rather
669   than integral types.  Special symbols are now regular citizens, instead of
670   being declared in ad hoc ways.
672 **** Token kinds
674   The "token kind" is what is returned by the scanner, e.g., PLUS, NUMBER,
675   LPAREN, etc.  While backward compatibility is of course ensured, users are
676   nonetheless invited to replace their uses of "enum yytokentype" by
677   "yytoken_kind_t".
679   This type now also includes tokens that were previously hidden: YYEOF (end
680   of input), YYUNDEF (undefined token), and YYerror (error token).  They
681   now have string aliases, internationalized when internationalization is
682   enabled.  Therefore, by default, error messages now refer to "end of file"
683   (internationalized) rather than the cryptic "$end", or to "invalid token"
684   rather than "$undefined".
686   Therefore in most cases it is now useless to define the end-of-line token
687   as follows:
689     %token T_EOF 0 "end of file"
691   Rather simply use "YYEOF" in your scanner.
693 **** Symbol kinds
695   The "symbol kinds" is what the parser actually uses.  (Unless the
696   api.token.raw %define variable is used, the symbol kind of a terminal
697   differs from the corresponding token kind.)
699   They are now exposed as a enum, "yysymbol_kind_t".
701   This allows users to tailor the error messages the way they want, or to
702   process some symbols in a specific way in autocompletion (see the
703   bistromathic example below).
705 *** Modernize display of explanatory statements in diagnostics
707   Since Bison 2.7, output was indented four spaces for explanatory
708   statements.  For example:
710     input.y:2.7-13: error: %type redeclaration for exp
711     input.y:1.7-11:     previous declaration
713   Since the introduction of caret-diagnostics, it became less clear.  This
714   indentation has been removed and submessages are displayed similarly as in
715   GCC:
717     input.y:2.7-13: error: %type redeclaration for exp
718         2 | %type <float> exp
719           |       ^~~~~~~
720     input.y:1.7-11: note: previous declaration
721         1 | %type <int> exp
722           |       ^~~~~
724   Contributed by Victor Morales Cayuela.
726 *** C++
728   The token and symbol kinds are yy::parser::token_kind_type and
729   yy::parser::symbol_kind_type.
731   The symbol_type::kind() member function allows to get the kind of a
732   symbol.  This can be used to write unit tests for scanners, e.g.,
734     yy::parser::symbol_type t = make_NUMBER ("123");
735     assert (t.kind () == yy::parser::symbol_kind::S_NUMBER);
736     assert (t.value.as<int> () == 123);
738 ** Documentation
740 *** User Manual
742   In order to avoid ambiguities with "type" as in "typing", we now refer to
743   the "token kind" (e.g., `PLUS`, `NUMBER`, etc.) rather than the "token
744   type".  We now also refer to the "symbol type" (e.g., `PLUS`, `expr`,
745   etc.).
747 *** Examples
749   There are now examples/java: a very simple calculator, and a more complete
750   one (push-parser, location tracking, and debug traces).
752   The lexcalc example (a simple example in C based on Flex and Bison) now
753   also demonstrates location tracking.
756   A new C example, bistromathic, is a fully featured interactive calculator
757   using many Bison features: pure interface, push parser, autocompletion
758   based on the current parser state (using yypstate_expected_tokens),
759   location tracking, internationalized custom error messages, lookahead
760   correction, rich debug traces, etc.
762   It shows how to depend on the symbol kinds to tailor autocompletion.  For
763   instance it recognizes the symbol kind "VARIABLE" to propose
764   autocompletion on the existing variables, rather than of the word
765   "variable".
768 * Noteworthy changes in release 3.5.4 (2020-04-05) [stable]
770 ** WARNING: Future backward-incompatibilities!
772   TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose".
774   Bison 3.6 will no longer support the YYERROR_VERBOSE macro; the parsers
775   that still depend on it will produce Yacc-like error messages (just
776   "syntax error").  It was superseded by the "%error-verbose" directive in
777   Bison 1.875 (2003-01-01).  Bison 2.6 (2012-07-19) clearly announced that
778   support for YYERROR_VERBOSE would be removed.  Note that since Bison 3.0
779   (2013-07-25), "%error-verbose" is deprecated in favor of "%define
780   parse.error verbose".
782 ** Bug fixes
784   Fix portability issues of the package itself on old compilers.
786   Fix api.token.raw support in Java.
789 * Noteworthy changes in release 3.5.3 (2020-03-08) [stable]
791 ** Bug fixes
793   Error messages could quote lines containing zero-width characters (such as
794   \005) with incorrect styling.  Fixes for similar issues with unexpectedly
795   short lines (e.g., the file was changed between parsing and diagnosing).
797   Some unlikely crashes found by fuzzing have been fixed.  This is only
798   about bison itself, not the generated parsers.
801 * Noteworthy changes in release 3.5.2 (2020-02-13) [stable]
803 ** Bug fixes
805   Portability issues and minor cosmetic issues.
807   The lalr1.cc skeleton properly rejects unsupported values for parse.lac
808   (as yacc.c does).
811 * Noteworthy changes in release 3.5.1 (2020-01-19) [stable]
813 ** Bug fixes
815   Portability fixes.
817   Fix compiler warnings.
820 * Noteworthy changes in release 3.5 (2019-12-11) [stable]
822 ** Backward incompatible changes
824   Lone carriage-return characters (aka \r or ^M) in the grammar files are no
825   longer treated as end-of-lines.  This changes the diagnostics, and in
826   particular their locations.
828   In C++, line numbers and columns are now represented as 'int' not
829   'unsigned', so that integer overflow on positions is easily checkable via
830   'gcc -fsanitize=undefined' and the like.  This affects the API for
831   positions.  The default position and location classes now expose
832   'counter_type' (int), used to define line and column numbers.
834 ** Deprecated features
836   The YYPRINT macro, which works only with yacc.c and only for tokens, was
837   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
838   It is deprecated and its support will be removed eventually.
840 ** New features
842 *** Lookahead correction in C++
844   Contributed by Adrian Vogelsgesang.
846   The C++ deterministic skeleton (lalr1.cc) now supports LAC, via the
847   %define variable parse.lac.
849 *** Variable api.token.raw: Optimized token numbers (all skeletons)
851   In the generated parsers, tokens have two numbers: the "external" token
852   number as returned by yylex (which starts at 257), and the "internal"
853   symbol number (which starts at 3).  Each time yylex is called, a table
854   lookup maps the external token number to the internal symbol number.
856   When the %define variable api.token.raw is set, tokens are assigned their
857   internal number, which saves one table lookup per token, and also saves
858   the generation of the mapping table.
860   The gain is typically moderate, but in extreme cases (very simple user
861   actions), a 10% improvement can be observed.
863 *** Generated parsers use better types for states
865   Stacks now use the best integral type for state numbers, instead of always
866   using 15 bits.  As a result "small" parsers now have a smaller memory
867   footprint (they use 8 bits), and there is support for large automata (16
868   bits), and extra large (using int, i.e., typically 31 bits).
870 *** Generated parsers prefer signed integer types
872   Bison skeletons now prefer signed to unsigned integer types when either
873   will do, as the signed types are less error-prone and allow for better
874   checking with 'gcc -fsanitize=undefined'.  Also, the types chosen are now
875   portable to unusual machines where char, short and int are all the same
876   width.  On non-GNU platforms this may entail including <limits.h> and (if
877   available) <stdint.h> to define integer types and constants.
879 *** A skeleton for the D programming language
881   For the last few releases, Bison has shipped a stealth experimental
882   skeleton: lalr1.d.  It was first contributed by Oliver Mangold, based on
883   Paolo Bonzini's lalr1.java, and was cleaned and improved thanks to
884   H. S. Teoh.
886   However, because nobody has committed to improving, testing, and
887   documenting this skeleton, it is not clear that it will be supported in
888   the future.
890   The lalr1.d skeleton *is functional*, and works well, as demonstrated in
891   examples/d/calc.d.  Please try it, enjoy it, and... commit to support it.
893 *** Debug traces in Java
895   The Java backend no longer emits code and data for parser tracing if the
896   %define variable parse.trace is not defined.
898 ** Diagnostics
900 *** New diagnostic: -Wdangling-alias
902   String literals, which allow for better error messages, are (too)
903   liberally accepted by Bison, which might result in silent errors.  For
904   instance
906     %type <exVal> cond "condition"
908   does not define "condition" as a string alias to 'cond' (nonterminal
909   symbols do not have string aliases).  It is rather equivalent to
911     %nterm <exVal> cond
912     %token <exVal> "condition"
914   i.e., it gives the type 'exVal' to the "condition" token, which was
915   clearly not the intention.
917   Also, because string aliases need not be defined, typos such as "baz"
918   instead of "bar" will be not reported.
920   The option `-Wdangling-alias` catches these situations.  On
922     %token BAR "bar"
923     %type <ival> foo "foo"
924     %%
925     foo: "baz" {}
927   bison -Wdangling-alias reports
929     warning: string literal not attached to a symbol
930           | %type <ival> foo "foo"
931           |                  ^~~~~
932     warning: string literal not attached to a symbol
933           | foo: "baz" {}
934           |      ^~~~~
936    The `-Wall` option does not (yet?) include `-Wdangling-alias`.
938 *** Better POSIX Yacc compatibility diagnostics
940   POSIX Yacc restricts %type to nonterminals.  This is now diagnosed by
941   -Wyacc.
943     %token TOKEN1
944     %type  <ival> TOKEN1 TOKEN2 't'
945     %token TOKEN2
946     %%
947     expr:
949   gives with -Wyacc
951     input.y:2.15-20: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
952         2 | %type  <ival> TOKEN1 TOKEN2 't'
953           |               ^~~~~~
954     input.y:2.29-31: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
955         2 | %type  <ival> TOKEN1 TOKEN2 't'
956           |                             ^~~
957     input.y:2.22-27: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
958         2 | %type  <ival> TOKEN1 TOKEN2 't'
959           |                      ^~~~~~
961 *** Diagnostics with insertion
963   The diagnostics now display the suggestion below the underlined source.
964   Replacement for undeclared symbols are now also suggested.
966     $ cat /tmp/foo.y
967     %%
968     list: lis '.' |
970     $ bison -Wall foo.y
971     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'?
972         2 | list: lis '.' |
973           |       ^~~
974           |       list
975     foo.y:2.16: warning: empty rule without %empty [-Wempty-rule]
976         2 | list: lis '.' |
977           |                ^
978           |                %empty
979     foo.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
981 *** Diagnostics about long lines
983   Quoted sources may now be truncated to fit the screen.  For instance, on a
984   30-column wide terminal:
986     $ cat foo.y
987     %token FOO                       FOO                         FOO
988     %%
989     exp: FOO
990     $ bison foo.y
991     foo.y:1.34-36: warning: symbol FOO redeclared [-Wother]
992         1 | …         FOO                  …
993           |           ^~~
994     foo.y:1.8-10:      previous declaration
995         1 | %token FOO                     …
996           |        ^~~
997     foo.y:1.62-64: warning: symbol FOO redeclared [-Wother]
998         1 | …         FOO
999           |           ^~~
1000     foo.y:1.8-10:      previous declaration
1001         1 | %token FOO                     …
1002           |        ^~~
1004 ** Changes
1006 *** Debugging glr.c and glr.cc
1008   The glr.c skeleton always had asserts to check its own behavior (not the
1009   user's).  These assertions are now under the control of the parse.assert
1010   %define variable (disabled by default).
1012 *** Clean up
1014   Several new compiler warnings in the generated output have been avoided.
1015   Some unused features are no longer emitted.  Cleaner generated code in
1016   general.
1018 ** Bug Fixes
1020   Portability issues in the test suite.
1022   In theory, parsers using %nonassoc could crash when reporting verbose
1023   error messages. This unlikely bug has been fixed.
1025   In Java, %define api.prefix was ignored.  It now behaves as expected.
1028 * Noteworthy changes in release 3.4.2 (2019-09-12) [stable]
1030 ** Bug fixes
1032   In some cases, when warnings are disabled, bison could emit tons of white
1033   spaces as diagnostics.
1035   When running out of memory, bison could crash (found by fuzzing).
1037   When defining twice the EOF token, bison would crash.
1039   New warnings from recent compilers have been addressed in the generated
1040   parsers (yacc.c, glr.c, glr.cc).
1042   When lone carriage-return characters appeared in the input file,
1043   diagnostics could hang forever.
1046 * Noteworthy changes in release 3.4.1 (2019-05-22) [stable]
1048 ** Bug fixes
1050   Portability fixes.
1053 * Noteworthy changes in release 3.4 (2019-05-19) [stable]
1055 ** Deprecated features
1057   The %pure-parser directive is deprecated in favor of '%define api.pure'
1058   since Bison 2.3b (2008-05-27), but no warning was issued; there is one
1059   now.  Note that since Bison 2.7 you are strongly encouraged to use
1060   '%define api.pure full' instead of '%define api.pure'.
1062 ** New features
1064 *** Colored diagnostics
1066   As an experimental feature, diagnostics are now colored, controlled by the
1067   new options --color and --style.
1069   To use them, install the libtextstyle library before configuring Bison.
1070   It is available from
1072     https://alpha.gnu.org/gnu/gettext/
1074   for instance
1076     https://alpha.gnu.org/gnu/gettext/libtextstyle-0.8.tar.gz
1078   The option --color supports the following arguments:
1079     - always, yes: Enable colors.
1080     - never, no: Disable colors.
1081     - auto, tty (default): Enable colors if the output device is a tty.
1083   To customize the styles, create a CSS file similar to
1085     /* bison-bw.css */
1086     .warning   { }
1087     .error     { font-weight: 800; text-decoration: underline; }
1088     .note      { }
1090   then invoke bison with --style=bison-bw.css, or set the BISON_STYLE
1091   environment variable to "bison-bw.css".
1093 *** Disabling output
1095   When given -fsyntax-only, the diagnostics are reported, but no output is
1096   generated.
1098   The name of this option is somewhat misleading as bison does more than
1099   just checking the syntax: every stage is run (including checking for
1100   conflicts for instance), except the generation of the output files.
1102 *** Include the generated header (yacc.c)
1104   Before, when --defines is used, bison generated a header, and pasted an
1105   exact copy of it into the generated parser implementation file.  If the
1106   header name is not "y.tab.h", it is now #included instead of being
1107   duplicated.
1109   To use an '#include' even if the header name is "y.tab.h" (which is what
1110   happens with --yacc, or when using the Autotools' ylwrap), define
1111   api.header.include to the exact argument to pass to #include.  For
1112   instance:
1114     %define api.header.include {"parse.h"}
1116   or
1118     %define api.header.include {<parser/parse.h>}
1120 *** api.location.type is now supported in C (yacc.c, glr.c)
1122   The %define variable api.location.type defines the name of the type to use
1123   for locations.  When defined, Bison no longer defines YYLTYPE.
1125   This can be used in programs with several parsers to factor their
1126   definition of locations: let one of them generate them, and the others
1127   just use them.
1129 ** Changes
1131 *** Graphviz output
1133   In conformance with the recommendations of the Graphviz team, if %require
1134   "3.4" (or better) is specified, the option --graph generates a *.gv file
1135   by default, instead of *.dot.
1137 *** Diagnostics overhaul
1139   Column numbers were wrong with multibyte characters, which would also
1140   result in skewed diagnostics with carets.  Beside, because we were
1141   indenting the quoted source with a single space, lines with tab characters
1142   were incorrectly underlined.
1144   To address these issues, and to be clearer, Bison now issues diagnostics
1145   as GCC9 does.  For instance it used to display (there's a tab before the
1146   opening brace):
1148     foo.y:3.37-38: error: $2 of ‘expr’ has no declared type
1149      expr: expr '+' "number"        { $$ = $1 + $2; }
1150                                          ^~
1151   It now reports
1153     foo.y:3.37-38: error: $2 of ‘expr’ has no declared type
1154         3 | expr: expr '+' "number" { $$ = $1 + $2; }
1155           |                                     ^~
1157   Other constructs now also have better locations, resulting in more precise
1158   diagnostics.
1160 *** Fix-it hints for %empty
1162   Running Bison with -Wempty-rules and --update will remove incorrect %empty
1163   annotations, and add the missing ones.
1165 *** Generated reports
1167   The format of the reports (parse.output) was improved for readability.
1169 *** Better support for --no-line.
1171   When --no-line is used, the generated files are now cleaner: no lines are
1172   generated instead of empty lines.  Together with using api.header.include,
1173   that should help people saving the generated files into version control
1174   systems get smaller diffs.
1176 ** Documentation
1178   A new example in C shows an simple infix calculator with a hand-written
1179   scanner (examples/c/calc).
1181   A new example in C shows a reentrant parser (capable of recursive calls)
1182   built with Flex and Bison (examples/c/reccalc).
1184   There is a new section about the history of Yaccs and Bison.
1186 ** Bug fixes
1188   A few obscure bugs were fixed, including the second oldest (known) bug in
1189   Bison: it was there when Bison was entered in the RCS version control
1190   system, in December 1987.  See the NEWS of Bison 3.3 for the previous
1191   oldest bug.
1194 * Noteworthy changes in release 3.3.2 (2019-02-03) [stable]
1196 ** Bug fixes
1198   Bison 3.3 failed to generate parsers for grammars with unused nonterminal
1199   symbols.
1202 * Noteworthy changes in release 3.3.1 (2019-01-27) [stable]
1204 ** Changes
1206   The option -y/--yacc used to imply -Werror=yacc, which turns uses of Bison
1207   extensions into errors.  It now makes them simple warnings (-Wyacc).
1210 * Noteworthy changes in release 3.3 (2019-01-26) [stable]
1212   A new mailing list was created, Bison Announce.  It is low traffic, and is
1213   only about announcing new releases and important messages (e.g., polls
1214   about major decisions to make).
1216   https://lists.gnu.org/mailman/listinfo/bison-announce
1218 ** Backward incompatible changes
1220   Support for DJGPP, which has been unmaintained and untested for years, is
1221   removed.
1223 ** Deprecated features
1225   A new feature, --update (see below) helps adjusting existing grammars to
1226   deprecations.
1228 *** Deprecated directives
1230   The %error-verbose directive is deprecated in favor of '%define
1231   parse.error verbose' since Bison 3.0, but no warning was issued.
1233   The '%name-prefix "xx"' directive is deprecated in favor of '%define
1234   api.prefix {xx}' since Bison 3.0, but no warning was issued.  These
1235   directives are slightly different, you might need to adjust your code.
1236   %name-prefix renames only symbols with external linkage, while api.prefix
1237   also renames types and macros, including YYDEBUG, YYTOKENTYPE,
1238   yytokentype, YYSTYPE, YYLTYPE, etc.
1240   Users of Flex that move from '%name-prefix "xx"' to '%define api.prefix
1241   {xx}' will typically have to update YY_DECL from
1243     #define YY_DECL int xxlex (YYSTYPE *yylval, YYLTYPE *yylloc)
1245   to
1247     #define YY_DECL int xxlex (XXSTYPE *yylval, XXLTYPE *yylloc)
1249 *** Deprecated %define variable names
1251   The following variables, mostly related to parsers in Java, have been
1252   renamed for consistency.  Backward compatibility is ensured, but upgrading
1253   is recommended.
1255     abstract           -> api.parser.abstract
1256     annotations        -> api.parser.annotations
1257     extends            -> api.parser.extends
1258     final              -> api.parser.final
1259     implements         -> api.parser.implements
1260     parser_class_name  -> api.parser.class
1261     public             -> api.parser.public
1262     strictfp           -> api.parser.strictfp
1264 ** New features
1266 *** Generation of fix-its for IDEs/Editors
1268   When given the new option -ffixit (aka -fdiagnostics-parseable-fixits),
1269   bison now generates machine readable editing instructions to fix some
1270   issues.  Currently, this is mostly limited to updating deprecated
1271   directives and removing duplicates.  For instance:
1273     $ cat foo.y
1274     %error-verbose
1275     %define parser_class_name "Parser"
1276     %define api.parser.class "Parser"
1277     %%
1278     exp:;
1280   See the "fix-it:" lines below:
1282     $ bison -ffixit foo.y
1283     foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated]
1284      %error-verbose
1285      ^~~~~~~~~~~~~~
1286     fix-it:"foo.y":{1:1-1:15}:"%define parse.error verbose"
1287     foo.y:2.1-34: warning: deprecated directive, use '%define api.parser.class {Parser}' [-Wdeprecated]
1288      %define parser_class_name "Parser"
1289      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1290     fix-it:"foo.y":{2:1-2:35}:"%define api.parser.class {Parser}"
1291     foo.y:3.1-33: error: %define variable 'api.parser.class' redefined
1292      %define api.parser.class "Parser"
1293      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1294     foo.y:2.1-34:     previous definition
1295      %define parser_class_name "Parser"
1296      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1297     fix-it:"foo.y":{3:1-3:34}:""
1298     foo.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
1300   This uses the same output format as GCC and Clang.
1302 *** Updating grammar files
1304   Fixes can be applied on the fly.  The previous example ends with the
1305   suggestion to re-run bison with the option -u/--update, which results in a
1306   cleaner grammar file.
1308     $ bison --update foo.y
1309     [...]
1310     bison: file 'foo.y' was updated (backup: 'foo.y~')
1312     $ cat foo.y
1313     %define parse.error verbose
1314     %define api.parser.class {Parser}
1315     %%
1316     exp:;
1318 *** Bison is now relocatable
1320   If you pass '--enable-relocatable' to 'configure', Bison is relocatable.
1322   A relocatable program can be moved or copied to a different location on
1323   the file system.  It can also be used through mount points for network
1324   sharing.  It is possible to make symbolic links to the installed and moved
1325   programs, and invoke them through the symbolic link.
1327 *** %expect and %expect-rr modifiers on individual rules
1329   One can now document (and check) which rules participate in shift/reduce
1330   and reduce/reduce conflicts.  This is particularly important GLR parsers,
1331   where conflicts are a normal occurrence.  For example,
1333       %glr-parser
1334       %expect 1
1335       %%
1337       ...
1339       argument_list:
1340         arguments %expect 1
1341       | arguments ','
1342       | %empty
1343       ;
1345       arguments:
1346         expression
1347       | argument_list ',' expression
1348       ;
1350       ...
1352   Looking at the output from -v, one can see that the shift/reduce conflict
1353   here is due to the fact that the parser does not know whether to reduce
1354   arguments to argument_list until it sees the token _after_ the following
1355   ','.  By marking the rule with %expect 1 (because there is a conflict in
1356   one state), we document the source of the 1 overall shift/reduce conflict.
1358   In GLR parsers, we can use %expect-rr in a rule for reduce/reduce
1359   conflicts.  In this case, we mark each of the conflicting rules.  For
1360   example,
1362       %glr-parser
1363       %expect-rr 1
1365       %%
1367       stmt:
1368         target_list '=' expr ';'
1369       | expr_list ';'
1370       ;
1372       target_list:
1373         target
1374       | target ',' target_list
1375       ;
1377       target:
1378         ID %expect-rr 1
1379       ;
1381       expr_list:
1382         expr
1383       | expr ',' expr_list
1384       ;
1386       expr:
1387         ID %expect-rr 1
1388       | ...
1389       ;
1391   In a statement such as
1393       x, y = 3, 4;
1395   the parser must reduce x to a target or an expr, but does not know which
1396   until it sees the '='.  So we notate the two possible reductions to
1397   indicate that each conflicts in one rule.
1399   This feature needs user feedback, and might evolve in the future.
1401 *** C++: Actual token constructors
1403   When variants and token constructors are enabled, in addition to the
1404   type-safe named token constructors (make_ID, make_INT, etc.), we now
1405   generate genuine constructors for symbol_type.
1407   For instance with these declarations
1409     %token           ':'
1410        <std::string> ID
1411        <int>         INT;
1413   you may use these constructors:
1415     symbol_type (int token, const std::string&);
1416     symbol_type (int token, const int&);
1417     symbol_type (int token);
1419   Correct matching between token types and value types is checked via
1420   'assert'; for instance, 'symbol_type (ID, 42)' would abort.  Named
1421   constructors are preferable, as they offer better type safety (for
1422   instance 'make_ID (42)' would not even compile), but symbol_type
1423   constructors may help when token types are discovered at run-time, e.g.,
1425      [a-z]+   {
1426                 if (auto i = lookup_keyword (yytext))
1427                   return yy::parser::symbol_type (i);
1428                 else
1429                   return yy::parser::make_ID (yytext);
1430               }
1432 *** C++: Variadic emplace
1434   If your application requires C++11 and you don't use symbol constructors,
1435   you may now use a variadic emplace for semantic values:
1437     %define api.value.type variant
1438     %token <std::pair<int, int>> PAIR
1440   in your scanner:
1442     int yylex (parser::semantic_type *lvalp)
1443     {
1444       lvalp->emplace <std::pair<int, int>> (1, 2);
1445       return parser::token::PAIR;
1446     }
1448 *** C++: Syntax error exceptions in GLR
1450   The glr.cc skeleton now supports syntax_error exceptions thrown from user
1451   actions, or from the scanner.
1453 *** More POSIX Yacc compatibility warnings
1455   More Bison specific directives are now reported with -y or -Wyacc.  This
1456   change was ready since the release of Bison 3.0 in September 2015.  It was
1457   delayed because Autoconf used to define YACC as `bison -y`, which resulted
1458   in numerous warnings for Bison users that use the GNU Build System.
1460   If you still experience that problem, either redefine YACC as `bison -o
1461   y.tab.c`, or pass -Wno-yacc to Bison.
1463 *** The tables yyrhs and yyphrs are back
1465   Because no Bison skeleton uses them, these tables were removed (no longer
1466   passed to the skeletons, not even computed) in 2008.  However, some users
1467   have expressed interest in being able to use them in their own skeletons.
1469 ** Bug fixes
1471 *** Incorrect number of reduce/reduce conflicts
1473   On a grammar such as
1475      exp: "num" | "num" | "num"
1477   bison used to report a single RR conflict, instead of two.  This is now
1478   fixed.  This was the oldest (known) bug in Bison: it was there when Bison
1479   was entered in the RCS version control system, in December 1987.
1481   Some grammar files might have to adjust their %expect-rr.
1483 *** Parser directives that were not careful enough
1485   Passing invalid arguments to %nterm, for instance character literals, used
1486   to result in unclear error messages.
1488 ** Documentation
1490   The examples/ directory (installed in .../share/doc/bison/examples) has
1491   been restructured per language for clarity.  The examples come with a
1492   README and a Makefile.  Not only can they be used to toy with Bison, they
1493   can also be starting points for your own grammars.
1495   There is now a Java example, and a simple example in C based on Flex and
1496   Bison (examples/c/lexcalc/).
1498 ** Changes
1500 *** Parsers in C++
1502   They now use noexcept and constexpr.  Please, report missing annotations.
1504 *** Symbol Declarations
1506   The syntax of the variation directives to declare symbols was overhauled
1507   for more consistency, and also better POSIX Yacc compliance (which, for
1508   instance, allows "%type" without actually providing a type).  The %nterm
1509   directive, supported by Bison since its inception, is now documented and
1510   officially supported.
1512   The syntax is now as follows:
1514     %token TAG? ( ID NUMBER? STRING? )+ ( TAG ( ID NUMBER? STRING? )+ )*
1515     %left  TAG? ( ID NUMBER? )+ ( TAG ( ID NUMBER? )+ )*
1516     %type  TAG? ( ID | CHAR | STRING )+ ( TAG ( ID | CHAR | STRING )+ )*
1517     %nterm TAG? ID+ ( TAG ID+ )*
1519   where TAG denotes a type tag such as ‘<ival>’, ID denotes an identifier
1520   such as ‘NUM’, NUMBER a decimal or hexadecimal integer such as ‘300’ or
1521   ‘0x12d’, CHAR a character literal such as ‘'+'’, and STRING a string
1522   literal such as ‘"number"’.  The post-fix quantifiers are ‘?’ (zero or
1523   one), ‘*’ (zero or more) and ‘+’ (one or more).
1526 * Noteworthy changes in release 3.2.4 (2018-12-24) [stable]
1528 ** Bug fixes
1530   Fix the move constructor of symbol_type.
1532   Always provide a copy constructor for symbol_type, even in modern C++.
1535 * Noteworthy changes in release 3.2.3 (2018-12-18) [stable]
1537 ** Bug fixes
1539   Properly support token constructors in C++ with types that include commas
1540   (e.g., std::pair<int, int>).  A regression introduced in Bison 3.2.
1543 * Noteworthy changes in release 3.2.2 (2018-11-21) [stable]
1545 ** Bug fixes
1547   C++ portability issues.
1550 * Noteworthy changes in release 3.2.1 (2018-11-09) [stable]
1552 ** Bug fixes
1554   Several portability issues have been fixed in the build system, in the
1555   test suite, and in the generated parsers in C++.
1558 * Noteworthy changes in release 3.2 (2018-10-29) [stable]
1560 ** Backward incompatible changes
1562   Support for DJGPP, which has been unmaintained and untested for years, is
1563   obsolete.  Unless there is activity to revive it, it will be removed.
1565 ** Changes
1567   %printers should use yyo rather than yyoutput to denote the output stream.
1569   Variant-based symbols in C++ should use emplace() rather than build().
1571   In C++ parsers, parser::operator() is now a synonym for the parser::parse.
1573 ** Documentation
1575   A new section, "A Simple C++ Example", is a tutorial for parsers in C++.
1577   A comment in the generated code now emphasizes that users should not
1578   depend upon non-documented implementation details, such as macros starting
1579   with YY_.
1581 ** New features
1583 *** C++: Support for move semantics (lalr1.cc)
1585   The lalr1.cc skeleton now fully supports C++ move semantics, while
1586   maintaining compatibility with C++98.  You may now store move-only types
1587   when using Bison's variants.  For instance:
1589     %code {
1590       #include <memory>
1591       #include <vector>
1592     }
1594     %skeleton "lalr1.cc"
1595     %define api.value.type variant
1597     %%
1599     %token <int> INT "int";
1600     %type <std::unique_ptr<int>> int;
1601     %type <std::vector<std::unique_ptr<int>>> list;
1603     list:
1604       %empty    {}
1605     | list int  { $$ = std::move($1); $$.emplace_back(std::move($2)); }
1607     int: "int"  { $$ = std::make_unique<int>($1); }
1609 *** C++: Implicit move of right-hand side values (lalr1.cc)
1611   In modern C++ (C++11 and later), you should always use 'std::move' with
1612   the values of the right-hand side symbols ($1, $2, etc.), as they will be
1613   popped from the stack anyway.  Using 'std::move' is mandatory for
1614   move-only types such as unique_ptr, and it provides a significant speedup
1615   for large types such as std::string, or std::vector, etc.
1617   If '%define api.value.automove' is set, every occurrence '$n' is replaced
1618   by 'std::move ($n)'.  The second rule in the previous grammar can be
1619   simplified to:
1621     list: list int  { $$ = $1; $$.emplace_back($2); }
1623   With automove enabled, the semantic values are no longer lvalues, so do
1624   not use the swap idiom:
1626     list: list int  { std::swap($$, $1); $$.emplace_back($2); }
1628   This idiom is anyway obsolete: it is preferable to move than to swap.
1630   A warning is issued when automove is enabled, and a value is used several
1631   times.
1633     input.yy:16.31-32: warning: multiple occurrences of $2 with api.value.automove enabled [-Wother]
1634     exp: "twice" exp   { $$ = $2 + $2; }
1635                                    ^^
1637   Enabling api.value.automove does not require support for modern C++.  The
1638   generated code is valid C++98/03, but will use copies instead of moves.
1640   The new examples/c++/variant-11.yy shows these features in action.
1642 *** C++: The implicit default semantic action is always run
1644   When variants are enabled, the default action was not run, so
1646     exp: "number"
1648   was equivalent to
1650     exp: "number"  {}
1652   It now behaves like in all the other cases, as
1654     exp: "number"  { $$ = $1; }
1656   possibly using std::move if automove is enabled.
1658   We do not expect backward compatibility issues.  However, beware of
1659   forward compatibility issues: if you rely on default actions with
1660   variants, be sure to '%require "3.2"' to avoid older versions of Bison to
1661   generate incorrect parsers.
1663 *** C++: Renaming location.hh
1665   When both %defines and %locations are enabled, Bison generates a
1666   location.hh file.  If you don't use locations outside of the parser, you
1667   may avoid its creation with:
1669     %define api.location.file none
1671   However this file is useful if, for instance, your parser builds an AST
1672   decorated with locations: you may use Bison's location independently of
1673   Bison's parser.  You can now give it another name, for instance:
1675     %define api.location.file "my-location.hh"
1677   This name can have directory components, and even be absolute.  The name
1678   under which the location file is included is controlled by
1679   api.location.include.
1681   This way it is possible to have several parsers share the same location
1682   file.
1684   For instance, in src/foo/parser.hh, generate the include/ast/loc.hh file:
1686     %locations
1687     %define api.namespace {foo}
1688     %define api.location.file "include/ast/loc.hh"
1689     %define api.location.include {<ast/loc.hh>}
1691   and use it in src/bar/parser.hh:
1693     %locations
1694     %define api.namespace {bar}
1695     %code requires {#include <ast/loc.hh>}
1696     %define api.location.type {bar::location}
1698   Absolute file names are supported, so in your Makefile, passing the flag
1699   -Dapi.location.file='"$(top_srcdir)/include/ast/location.hh"' to bison is
1700   safe.
1702 *** C++: stack.hh and position.hh are deprecated
1704   When asked to generate a header file (%defines), the lalr1.cc skeleton
1705   generates a stack.hh file.  This file had no interest for users; it is now
1706   made useless: its content is included in the parser definition.  It is
1707   still generated for backward compatibility.
1709   When in addition to %defines, location support is requested (%locations),
1710   the file position.hh is also generated.  It is now also useless: its
1711   content is now included in location.hh.
1713   These files are no longer generated when your grammar file requires at
1714   least Bison 3.2 (%require "3.2").
1716 ** Bug fixes
1718   Portability issues on MinGW and VS2015.
1720   Portability issues in the test suite.
1722   Portability/warning issues with Flex.
1725 * Noteworthy changes in release 3.1 (2018-08-27) [stable]
1727 ** Backward incompatible changes
1729   Compiling Bison now requires a C99 compiler---as announced during the
1730   release of Bison 3.0, five years ago.  Generated parsers do not require a
1731   C99 compiler.
1733   Support for DJGPP, which has been unmaintained and untested for years, is
1734   obsolete. Unless there is activity to revive it, the next release of Bison
1735   will have it removed.
1737 ** New features
1739 *** Typed midrule actions
1741   Because their type is unknown to Bison, the values of midrule actions are
1742   not treated like the others: they don't have %printer and %destructor
1743   support.  It also prevents C++ (Bison) variants to handle them properly.
1745   Typed midrule actions address these issues.  Instead of:
1747     exp: { $<ival>$ = 1; } { $<ival>$ = 2; }   { $$ = $<ival>1 + $<ival>2; }
1749   write:
1751     exp: <ival>{ $$ = 1; } <ival>{ $$ = 2; }   { $$ = $1 + $2; }
1753 *** Reports include the type of the symbols
1755   The sections about terminal and nonterminal symbols of the '*.output' file
1756   now specify their declared type.  For instance, for:
1758     %token <ival> NUM
1760   the report now shows '<ival>':
1762     Terminals, with rules where they appear
1764     NUM <ival> (258) 5
1766 *** Diagnostics about useless rules
1768   In the following grammar, the 'exp' nonterminal is trivially useless.  So,
1769   of course, its rules are useless too.
1771     %%
1772     input: '0' | exp
1773     exp: exp '+' exp | exp '-' exp | '(' exp ')'
1775   Previously all the useless rules were reported, including those whose
1776   left-hand side is the 'exp' nonterminal:
1778     warning: 1 nonterminal useless in grammar [-Wother]
1779     warning: 4 rules useless in grammar [-Wother]
1780     2.14-16: warning: nonterminal useless in grammar: exp [-Wother]
1781      input: '0' | exp
1782                   ^^^
1783     2.14-16: warning: rule useless in grammar [-Wother]
1784      input: '0' | exp
1785                   ^^^
1786     3.6-16: warning: rule useless in grammar [-Wother]
1787      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1788           ^^^^^^^^^^^
1789     3.20-30: warning: rule useless in grammar [-Wother]
1790      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1791                         ^^^^^^^^^^^
1792     3.34-44: warning: rule useless in grammar [-Wother]
1793      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1794                                       ^^^^^^^^^^^
1796   Now, rules whose left-hand side symbol is useless are no longer reported
1797   as useless.  The locations of the errors have also been adjusted to point
1798   to the first use of the nonterminal as a left-hand side of a rule:
1800     warning: 1 nonterminal useless in grammar [-Wother]
1801     warning: 4 rules useless in grammar [-Wother]
1802     3.1-3: warning: nonterminal useless in grammar: exp [-Wother]
1803      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1804      ^^^
1805     2.14-16: warning: rule useless in grammar [-Wother]
1806      input: '0' | exp
1807                   ^^^
1809 *** C++: Generated parsers can be compiled with -fno-exceptions (lalr1.cc)
1811   When compiled with exceptions disabled, the generated parsers no longer
1812   uses try/catch clauses.
1814   Currently only GCC and Clang are supported.
1816 ** Documentation
1818 *** A demonstration of variants
1820   A new example was added (installed in .../share/doc/bison/examples),
1821   'variant.yy', which shows how to use (Bison) variants in C++.
1823   The other examples were made nicer to read.
1825 *** Some features are no longer 'experimental'
1827   The following features, mature enough, are no longer flagged as
1828   experimental in the documentation: push parsers, default %printer and
1829   %destructor (typed: <*> and untyped: <>), %define api.value.type union and
1830   variant, Java parsers, XML output, LR family (lr, ielr, lalr), and
1831   semantic predicates (%?).
1833 ** Bug fixes
1835 *** GLR: Predicates support broken by #line directives
1837   Predicates (%?) in GLR such as
1839     widget:
1840       %? {new_syntax} 'w' id new_args
1841     | %?{!new_syntax} 'w' id old_args
1843   were issued with #lines in the middle of C code.
1845 *** Printer and destructor with broken #line directives
1847   The #line directives were not properly escaped when emitting the code for
1848   %printer/%destructor, which resulted in compiler errors if there are
1849   backslashes or double-quotes in the grammar file name.
1851 *** Portability on ICC
1853   The Intel compiler claims compatibility with GCC, yet rejects its _Pragma.
1854   Generated parsers now work around this.
1856 *** Various
1858   There were several small fixes in the test suite and in the build system,
1859   many warnings in bison and in the generated parsers were eliminated.  The
1860   documentation also received its share of minor improvements.
1862   Useless code was removed from C++ parsers, and some of the generated
1863   constructors are more 'natural'.
1866 * Noteworthy changes in release 3.0.5 (2018-05-27) [stable]
1868 ** Bug fixes
1870 *** C++: Fix support of 'syntax_error'
1872   One incorrect 'inline' resulted in linking errors about the constructor of
1873   the syntax_error exception.
1875 *** C++: Fix warnings
1877   GCC 7.3 (with -O1 or -O2 but not -O0 or -O3) issued null-dereference
1878   warnings about yyformat being possibly null.  It also warned about the
1879   deprecated implicit definition of copy constructors when there's a
1880   user-defined (copy) assignment operator.
1882 *** Location of errors
1884   In C++ parsers, out-of-bounds errors can happen when a rule with an empty
1885   ride-hand side raises a syntax error.  The behavior of the default parser
1886   (yacc.c) in such a condition was undefined.
1888   Now all the parsers match the behavior of glr.c: @$ is used as the
1889   location of the error.  This handles gracefully rules with and without
1890   rhs.
1892 *** Portability fixes in the test suite
1894   On some platforms, some Java and/or C++ tests were failing.
1897 * Noteworthy changes in release 3.0.4 (2015-01-23) [stable]
1899 ** Bug fixes
1901 *** C++ with Variants (lalr1.cc)
1903   Fix a compiler warning when no %destructor use $$.
1905 *** Test suites
1907   Several portability issues in tests were fixed.
1910 * Noteworthy changes in release 3.0.3 (2015-01-15) [stable]
1912 ** Bug fixes
1914 *** C++ with Variants (lalr1.cc)
1916   Problems with %destructor and '%define parse.assert' have been fixed.
1918 *** Named %union support (yacc.c, glr.c)
1920   Bison 3.0 introduced a regression on named %union such as
1922     %union foo { int ival; };
1924   The possibility to use a name was introduced "for Yacc compatibility".
1925   It is however not required by POSIX Yacc, and its usefulness is not clear.
1927 *** %define api.value.type union with %defines (yacc.c, glr.c)
1929   The C parsers were broken when %defines was used together with "%define
1930   api.value.type union".
1932 *** Redeclarations are reported in proper order
1934   On
1936     %token FOO "foo"
1937     %printer {} "foo"
1938     %printer {} FOO
1940   bison used to report:
1942     foo.yy:2.10-11: error: %printer redeclaration for FOO
1943      %printer {} "foo"
1944               ^^
1945     foo.yy:3.10-11:     previous declaration
1946      %printer {} FOO
1947               ^^
1949   Now, the "previous" declaration is always the first one.
1952 ** Documentation
1954   Bison now installs various files in its docdir (which defaults to
1955   '/usr/local/share/doc/bison'), including the three fully blown examples
1956   extracted from the documentation:
1958    - rpcalc
1959      Reverse Polish Calculator, a simple introductory example.
1960    - mfcalc
1961      Multi-function Calc, a calculator with memory and functions and located
1962      error messages.
1963    - calc++
1964      a calculator in C++ using variant support and token constructors.
1967 * Noteworthy changes in release 3.0.2 (2013-12-05) [stable]
1969 ** Bug fixes
1971 *** Generated source files when errors are reported
1973   When warnings are issued and -Werror is set, bison would still generate
1974   the source files (*.c, *.h...).  As a consequence, some runs of "make"
1975   could fail the first time, but not the second (as the files were generated
1976   anyway).
1978   This is fixed: bison no longer generates this source files, but, of
1979   course, still produces the various reports (*.output, *.xml, etc.).
1981 *** %empty is used in reports
1983   Empty right-hand sides are denoted by '%empty' in all the reports (text,
1984   dot, XML and formats derived from it).
1986 *** YYERROR and variants
1988   When C++ variant support is enabled, an error triggered via YYERROR, but
1989   not caught via error recovery, resulted in a double deletion.
1992 * Noteworthy changes in release 3.0.1 (2013-11-12) [stable]
1994 ** Bug fixes
1996 *** Errors in caret diagnostics
1998   On some platforms, some errors could result in endless diagnostics.
2000 *** Fixes of the -Werror option
2002   Options such as "-Werror -Wno-error=foo" were still turning "foo"
2003   diagnostics into errors instead of warnings.  This is fixed.
2005   Actually, for consistency with GCC, "-Wno-error=foo -Werror" now also
2006   leaves "foo" diagnostics as warnings.  Similarly, with "-Werror=foo
2007   -Wno-error", "foo" diagnostics are now errors.
2009 *** GLR Predicates
2011   As demonstrated in the documentation, one can now leave spaces between
2012   "%?" and its "{".
2014 *** Installation
2016   The yacc.1 man page is no longer installed if --disable-yacc was
2017   specified.
2019 *** Fixes in the test suite
2021   Bugs and portability issues.
2024 * Noteworthy changes in release 3.0 (2013-07-25) [stable]
2026 ** WARNING: Future backward-incompatibilities!
2028   Like other GNU packages, Bison will start using some of the C99 features
2029   for its own code, especially the definition of variables after statements.
2030   The generated C parsers still aim at C90.
2032 ** Backward incompatible changes
2034 *** Obsolete features
2036   Support for YYFAIL is removed (deprecated in Bison 2.4.2): use YYERROR.
2038   Support for yystype and yyltype is removed (deprecated in Bison 1.875):
2039   use YYSTYPE and YYLTYPE.
2041   Support for YYLEX_PARAM and YYPARSE_PARAM is removed (deprecated in Bison
2042   1.875): use %lex-param, %parse-param, or %param.
2044   Missing semicolons at the end of actions are no longer added (as announced
2045   in the release 2.5).
2047 *** Use of YACC='bison -y'
2049   TL;DR: With Autoconf <= 2.69, pass -Wno-yacc to (AM_)YFLAGS if you use
2050   Bison extensions.
2052   Traditional Yacc generates 'y.tab.c' whatever the name of the input file.
2053   Therefore Makefiles written for Yacc expect 'y.tab.c' (and possibly
2054   'y.tab.h' and 'y.output') to be generated from 'foo.y'.
2056   To this end, for ages, AC_PROG_YACC, Autoconf's macro to look for an
2057   implementation of Yacc, was using Bison as 'bison -y'.  While it does
2058   ensure compatible output file names, it also enables warnings for
2059   incompatibilities with POSIX Yacc.  In other words, 'bison -y' triggers
2060   warnings for Bison extensions.
2062   Autoconf 2.70+ fixes this incompatibility by using YACC='bison -o y.tab.c'
2063   (which also generates 'y.tab.h' and 'y.output' when needed).
2064   Alternatively, disable Yacc warnings by passing '-Wno-yacc' to your Yacc
2065   flags (YFLAGS, or AM_YFLAGS with Automake).
2067 ** Bug fixes
2069 *** The epilogue is no longer affected by internal #defines (glr.c)
2071   The glr.c skeleton uses defines such as #define yylval (yystackp->yyval) in
2072   generated code.  These weren't properly undefined before the inclusion of
2073   the user epilogue, so functions such as the following were butchered by the
2074   preprocessor expansion:
2076     int yylex (YYSTYPE *yylval);
2078   This is fixed: yylval, yynerrs, yychar, and yylloc are now valid
2079   identifiers for user-provided variables.
2081 *** stdio.h is no longer needed when locations are enabled (yacc.c)
2083   Changes in Bison 2.7 introduced a dependency on FILE and fprintf when
2084   locations are enabled.  This is fixed.
2086 *** Warnings about useless %pure-parser/%define api.pure are restored
2088 ** Diagnostics reported by Bison
2090   Most of these features were contributed by Théophile Ranquet and Victor
2091   Santet.
2093 *** Carets
2095   Version 2.7 introduced caret errors, for a prettier output.  These are now
2096   activated by default.  The old format can still be used by invoking Bison
2097   with -fno-caret (or -fnone).
2099   Some error messages that reproduced excerpts of the grammar are now using
2100   the caret information only.  For instance on:
2102     %%
2103     exp: 'a' | 'a';
2105   Bison 2.7 reports:
2107     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2108     in.y:2.12-14: warning: rule useless in parser due to conflicts: exp: 'a' [-Wother]
2110   Now bison reports:
2112     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2113     in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
2114      exp: 'a' | 'a';
2115                 ^^^
2117   and "bison -fno-caret" reports:
2119     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2120     in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
2122 *** Enhancements of the -Werror option
2124   The -Werror=CATEGORY option is now recognized, and will treat specified
2125   warnings as errors. The warnings need not have been explicitly activated
2126   using the -W option, this is similar to what GCC 4.7 does.
2128   For example, given the following command line, Bison will treat both
2129   warnings related to POSIX Yacc incompatibilities and S/R conflicts as
2130   errors (and only those):
2132     $ bison -Werror=yacc,error=conflicts-sr input.y
2134   If no categories are specified, -Werror will make all active warnings into
2135   errors. For example, the following line does the same the previous example:
2137     $ bison -Werror -Wnone -Wyacc -Wconflicts-sr input.y
2139   (By default -Wconflicts-sr,conflicts-rr,deprecated,other is enabled.)
2141   Note that the categories in this -Werror option may not be prefixed with
2142   "no-". However, -Wno-error[=CATEGORY] is valid.
2144   Note that -y enables -Werror=yacc. Therefore it is now possible to require
2145   Yacc-like behavior (e.g., always generate y.tab.c), but to report
2146   incompatibilities as warnings: "-y -Wno-error=yacc".
2148 *** The display of warnings is now richer
2150   The option that controls a given warning is now displayed:
2152     foo.y:4.6: warning: type clash on default action: <foo> != <bar> [-Wother]
2154   In the case of warnings treated as errors, the prefix is changed from
2155   "warning: " to "error: ", and the suffix is displayed, in a manner similar
2156   to GCC, as [-Werror=CATEGORY].
2158   For instance, where the previous version of Bison would report (and exit
2159   with failure):
2161     bison: warnings being treated as errors
2162     input.y:1.1: warning: stray ',' treated as white space
2164   it now reports:
2166     input.y:1.1: error: stray ',' treated as white space [-Werror=other]
2168 *** Deprecated constructs
2170   The new 'deprecated' warning category flags obsolete constructs whose
2171   support will be discontinued.  It is enabled by default.  These warnings
2172   used to be reported as 'other' warnings.
2174 *** Useless semantic types
2176   Bison now warns about useless (uninhabited) semantic types.  Since
2177   semantic types are not declared to Bison (they are defined in the opaque
2178   %union structure), it is %printer/%destructor directives about useless
2179   types that trigger the warning:
2181     %token <type1> term
2182     %type  <type2> nterm
2183     %printer    {} <type1> <type3>
2184     %destructor {} <type2> <type4>
2185     %%
2186     nterm: term { $$ = $1; };
2188     3.28-34: warning: type <type3> is used, but is not associated to any symbol
2189     4.28-34: warning: type <type4> is used, but is not associated to any symbol
2191 *** Undefined but unused symbols
2193   Bison used to raise an error for undefined symbols that are not used in
2194   the grammar.  This is now only a warning.
2196     %printer    {} symbol1
2197     %destructor {} symbol2
2198     %type <type>   symbol3
2199     %%
2200     exp: "a";
2202 *** Useless destructors or printers
2204   Bison now warns about useless destructors or printers.  In the following
2205   example, the printer for <type1>, and the destructor for <type2> are
2206   useless: all symbols of <type1> (token1) already have a printer, and all
2207   symbols of type <type2> (token2) already have a destructor.
2209     %token <type1> token1
2210            <type2> token2
2211            <type3> token3
2212            <type4> token4
2213     %printer    {} token1 <type1> <type3>
2214     %destructor {} token2 <type2> <type4>
2216 *** Conflicts
2218   The warnings and error messages about shift/reduce and reduce/reduce
2219   conflicts have been normalized.  For instance on the following foo.y file:
2221     %glr-parser
2222     %%
2223     exp: exp '+' exp | '0' | '0';
2225   compare the previous version of bison:
2227     $ bison foo.y
2228     foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2229     $ bison -Werror foo.y
2230     bison: warnings being treated as errors
2231     foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2233   with the new behavior:
2235     $ bison foo.y
2236     foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
2237     foo.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
2238     $ bison -Werror foo.y
2239     foo.y: error: 1 shift/reduce conflict [-Werror=conflicts-sr]
2240     foo.y: error: 2 reduce/reduce conflicts [-Werror=conflicts-rr]
2242   When %expect or %expect-rr is used, such as with bar.y:
2244     %expect 0
2245     %glr-parser
2246     %%
2247     exp: exp '+' exp | '0' | '0';
2249   Former behavior:
2251     $ bison bar.y
2252     bar.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2253     bar.y: expected 0 shift/reduce conflicts
2254     bar.y: expected 0 reduce/reduce conflicts
2256   New one:
2258     $ bison bar.y
2259     bar.y: error: shift/reduce conflicts: 1 found, 0 expected
2260     bar.y: error: reduce/reduce conflicts: 2 found, 0 expected
2262 ** Incompatibilities with POSIX Yacc
2264   The 'yacc' category is no longer part of '-Wall', enable it explicitly
2265   with '-Wyacc'.
2267 ** Additional yylex/yyparse arguments
2269   The new directive %param declares additional arguments to both yylex and
2270   yyparse.  The %lex-param, %parse-param, and %param directives support one
2271   or more arguments.  Instead of
2273     %lex-param   {arg1_type *arg1}
2274     %lex-param   {arg2_type *arg2}
2275     %parse-param {arg1_type *arg1}
2276     %parse-param {arg2_type *arg2}
2278   one may now declare
2280     %param {arg1_type *arg1} {arg2_type *arg2}
2282 ** Types of values for %define variables
2284   Bison used to make no difference between '%define foo bar' and '%define
2285   foo "bar"'.  The former is now called a 'keyword value', and the latter a
2286   'string value'.  A third kind was added: 'code values', such as '%define
2287   foo {bar}'.
2289   Keyword variables are used for fixed value sets, e.g.,
2291     %define lr.type lalr
2293   Code variables are used for value in the target language, e.g.,
2295     %define api.value.type {struct semantic_type}
2297   String variables are used remaining cases, e.g. file names.
2299 ** Variable api.token.prefix
2301   The variable api.token.prefix changes the way tokens are identified in
2302   the generated files.  This is especially useful to avoid collisions
2303   with identifiers in the target language.  For instance
2305     %token FILE for ERROR
2306     %define api.token.prefix {TOK_}
2307     %%
2308     start: FILE for ERROR;
2310   will generate the definition of the symbols TOK_FILE, TOK_for, and
2311   TOK_ERROR in the generated sources.  In particular, the scanner must
2312   use these prefixed token names, although the grammar itself still
2313   uses the short names (as in the sample rule given above).
2315 ** Variable api.value.type
2317   This new %define variable supersedes the #define macro YYSTYPE.  The use
2318   of YYSTYPE is discouraged.  In particular, #defining YYSTYPE *and* either
2319   using %union or %defining api.value.type results in undefined behavior.
2321   Either define api.value.type, or use "%union":
2323     %union
2324     {
2325       int ival;
2326       char *sval;
2327     }
2328     %token <ival> INT "integer"
2329     %token <sval> STRING "string"
2330     %printer { fprintf (yyo, "%d", $$); } <ival>
2331     %destructor { free ($$); } <sval>
2333     /* In yylex().  */
2334     yylval.ival = 42; return INT;
2335     yylval.sval = "42"; return STRING;
2337   The %define variable api.value.type supports both keyword and code values.
2339   The keyword value 'union' means that the user provides genuine types, not
2340   union member names such as "ival" and "sval" above (WARNING: will fail if
2341   -y/--yacc/%yacc is enabled).
2343     %define api.value.type union
2344     %token <int> INT "integer"
2345     %token <char *> STRING "string"
2346     %printer { fprintf (yyo, "%d", $$); } <int>
2347     %destructor { free ($$); } <char *>
2349     /* In yylex().  */
2350     yylval.INT = 42; return INT;
2351     yylval.STRING = "42"; return STRING;
2353   The keyword value variant is somewhat equivalent, but for C++ special
2354   provision is made to allow classes to be used (more about this below).
2356     %define api.value.type variant
2357     %token <int> INT "integer"
2358     %token <std::string> STRING "string"
2360   Code values (in braces) denote user defined types.  This is where YYSTYPE
2361   used to be used.
2363     %code requires
2364     {
2365       struct my_value
2366       {
2367         enum
2368         {
2369           is_int, is_string
2370         } kind;
2371         union
2372         {
2373           int ival;
2374           char *sval;
2375         } u;
2376       };
2377     }
2378     %define api.value.type {struct my_value}
2379     %token <u.ival> INT "integer"
2380     %token <u.sval> STRING "string"
2381     %printer { fprintf (yyo, "%d", $$); } <u.ival>
2382     %destructor { free ($$); } <u.sval>
2384     /* In yylex().  */
2385     yylval.u.ival = 42; return INT;
2386     yylval.u.sval = "42"; return STRING;
2388 ** Variable parse.error
2390   This variable controls the verbosity of error messages.  The use of the
2391   %error-verbose directive is deprecated in favor of "%define parse.error
2392   verbose".
2394 ** Deprecated %define variable names
2396   The following variables have been renamed for consistency.  Backward
2397   compatibility is ensured, but upgrading is recommended.
2399     lr.default-reductions      -> lr.default-reduction
2400     lr.keep-unreachable-states -> lr.keep-unreachable-state
2401     namespace                  -> api.namespace
2402     stype                      -> api.value.type
2404 ** Semantic predicates
2406   Contributed by Paul Hilfinger.
2408   The new, experimental, semantic-predicate feature allows actions of the
2409   form "%?{ BOOLEAN-EXPRESSION }", which cause syntax errors (as for
2410   YYERROR) if the expression evaluates to 0, and are evaluated immediately
2411   in GLR parsers, rather than being deferred.  The result is that they allow
2412   the programmer to prune possible parses based on the values of run-time
2413   expressions.
2415 ** The directive %expect-rr is now an error in non GLR mode
2417   It used to be an error only if used in non GLR mode, _and_ if there are
2418   reduce/reduce conflicts.
2420 ** Tokens are numbered in their order of appearance
2422   Contributed by Valentin Tolmer.
2424   With '%token A B', A had a number less than the one of B.  However,
2425   precedence declarations used to generate a reversed order.  This is now
2426   fixed, and introducing tokens with any of %token, %left, %right,
2427   %precedence, or %nonassoc yields the same result.
2429   When mixing declarations of tokens with a literal character (e.g., 'a') or
2430   with an identifier (e.g., B) in a precedence declaration, Bison numbered
2431   the literal characters first.  For example
2433     %right A B 'c' 'd'
2435   would lead to the tokens declared in this order: 'c' 'd' A B.  Again, the
2436   input order is now preserved.
2438   These changes were made so that one can remove useless precedence and
2439   associativity declarations (i.e., map %nonassoc, %left or %right to
2440   %precedence, or to %token) and get exactly the same output.
2442 ** Useless precedence and associativity
2444   Contributed by Valentin Tolmer.
2446   When developing and maintaining a grammar, useless associativity and
2447   precedence directives are common.  They can be a nuisance: new ambiguities
2448   arising are sometimes masked because their conflicts are resolved due to
2449   the extra precedence or associativity information.  Furthermore, it can
2450   hinder the comprehension of a new grammar: one will wonder about the role
2451   of a precedence, where in fact it is useless.  The following changes aim
2452   at detecting and reporting these extra directives.
2454 *** Precedence warning category
2456   A new category of warning, -Wprecedence, was introduced. It flags the
2457   useless precedence and associativity directives.
2459 *** Useless associativity
2461   Bison now warns about symbols with a declared associativity that is never
2462   used to resolve conflicts.  In that case, using %precedence is sufficient;
2463   the parsing tables will remain unchanged.  Solving these warnings may raise
2464   useless precedence warnings, as the symbols no longer have associativity.
2465   For example:
2467     %left '+'
2468     %left '*'
2469     %%
2470     exp:
2471       "number"
2472     | exp '+' "number"
2473     | exp '*' exp
2474     ;
2476   will produce a
2478     warning: useless associativity for '+', use %precedence [-Wprecedence]
2479      %left '+'
2480            ^^^
2482 *** Useless precedence
2484   Bison now warns about symbols with a declared precedence and no declared
2485   associativity (i.e., declared with %precedence), and whose precedence is
2486   never used.  In that case, the symbol can be safely declared with %token
2487   instead, without modifying the parsing tables.  For example:
2489     %precedence '='
2490     %%
2491     exp: "var" '=' "number";
2493   will produce a
2495     warning: useless precedence for '=' [-Wprecedence]
2496      %precedence '='
2497                  ^^^
2499 *** Useless precedence and associativity
2501   In case of both useless precedence and associativity, the issue is flagged
2502   as follows:
2504     %nonassoc '='
2505     %%
2506     exp: "var" '=' "number";
2508   The warning is:
2510     warning: useless precedence and associativity for '=' [-Wprecedence]
2511      %nonassoc '='
2512                ^^^
2514 ** Empty rules
2516   With help from Joel E. Denny and Gabriel Rassoul.
2518   Empty rules (i.e., with an empty right-hand side) can now be explicitly
2519   marked by the new %empty directive.  Using %empty on a non-empty rule is
2520   an error.  The new -Wempty-rule warning reports empty rules without
2521   %empty.  On the following grammar:
2523     %%
2524     s: a b c;
2525     a: ;
2526     b: %empty;
2527     c: 'a' %empty;
2529   bison reports:
2531     3.4-5: warning: empty rule without %empty [-Wempty-rule]
2532      a: {}
2533         ^^
2534     5.8-13: error: %empty on non-empty rule
2535      c: 'a' %empty {};
2536             ^^^^^^
2538 ** Java skeleton improvements
2540   The constants for token names were moved to the Lexer interface.  Also, it
2541   is possible to add code to the parser's constructors using "%code init"
2542   and "%define init_throws".
2543   Contributed by Paolo Bonzini.
2545   The Java skeleton now supports push parsing.
2546   Contributed by Dennis Heimbigner.
2548 ** C++ skeletons improvements
2550 *** The parser header is no longer mandatory (lalr1.cc, glr.cc)
2552   Using %defines is now optional.  Without it, the needed support classes
2553   are defined in the generated parser, instead of additional files (such as
2554   location.hh, position.hh and stack.hh).
2556 *** Locations are no longer mandatory (lalr1.cc, glr.cc)
2558   Both lalr1.cc and glr.cc no longer require %location.
2560 *** syntax_error exception (lalr1.cc)
2562   The C++ parser features a syntax_error exception, which can be
2563   thrown from the scanner or from user rules to raise syntax errors.
2564   This facilitates reporting errors caught in sub-functions (e.g.,
2565   rejecting too large integral literals from a conversion function
2566   used by the scanner, or rejecting invalid combinations from a
2567   factory invoked by the user actions).
2569 *** %define api.value.type variant
2571   This is based on a submission from Michiel De Wilde.  With help
2572   from Théophile Ranquet.
2574   In this mode, complex C++ objects can be used as semantic values.  For
2575   instance:
2577     %token <::std::string> TEXT;
2578     %token <int> NUMBER;
2579     %token SEMICOLON ";"
2580     %type <::std::string> item;
2581     %type <::std::list<std::string>> list;
2582     %%
2583     result:
2584       list  { std::cout << $1 << std::endl; }
2585     ;
2587     list:
2588       %empty        { /* Generates an empty string list. */ }
2589     | list item ";" { std::swap ($$, $1); $$.push_back ($2); }
2590     ;
2592     item:
2593       TEXT    { std::swap ($$, $1); }
2594     | NUMBER  { $$ = string_cast ($1); }
2595     ;
2597 *** %define api.token.constructor
2599   When variants are enabled, Bison can generate functions to build the
2600   tokens.  This guarantees that the token type (e.g., NUMBER) is consistent
2601   with the semantic value (e.g., int):
2603     parser::symbol_type yylex ()
2604     {
2605       parser::location_type loc = ...;
2606       ...
2607       return parser::make_TEXT ("Hello, world!", loc);
2608       ...
2609       return parser::make_NUMBER (42, loc);
2610       ...
2611       return parser::make_SEMICOLON (loc);
2612       ...
2613     }
2615 *** C++ locations
2617   There are operator- and operator-= for 'location'.  Negative line/column
2618   increments can no longer underflow the resulting value.
2621 * Noteworthy changes in release 2.7.1 (2013-04-15) [stable]
2623 ** Bug fixes
2625 *** Fix compiler attribute portability (yacc.c)
2627   With locations enabled, __attribute__ was used unprotected.
2629 *** Fix some compiler warnings (lalr1.cc)
2632 * Noteworthy changes in release 2.7 (2012-12-12) [stable]
2634 ** Bug fixes
2636   Warnings about uninitialized yylloc in yyparse have been fixed.
2638   Restored C90 compliance (yet no report was ever made).
2640 ** Diagnostics are improved
2642   Contributed by Théophile Ranquet.
2644 *** Changes in the format of error messages
2646   This used to be the format of many error reports:
2648     input.y:2.7-12: %type redeclaration for exp
2649     input.y:1.7-12: previous declaration
2651   It is now:
2653     input.y:2.7-12: error: %type redeclaration for exp
2654     input.y:1.7-12:     previous declaration
2656 *** New format for error reports: carets
2658   Caret errors have been added to Bison:
2660     input.y:2.7-12: error: %type redeclaration for exp
2661      %type <sval> exp
2662            ^^^^^^
2663     input.y:1.7-12:     previous declaration
2664      %type <ival> exp
2665            ^^^^^^
2667   or
2669     input.y:3.20-23: error: ambiguous reference: '$exp'
2670      exp: exp '+' exp { $exp = $1 + $3; };
2671                         ^^^^
2672     input.y:3.1-3:       refers to: $exp at $$
2673      exp: exp '+' exp { $exp = $1 + $3; };
2674      ^^^
2675     input.y:3.6-8:       refers to: $exp at $1
2676      exp: exp '+' exp { $exp = $1 + $3; };
2677           ^^^
2678     input.y:3.14-16:     refers to: $exp at $3
2679      exp: exp '+' exp { $exp = $1 + $3; };
2680                   ^^^
2682   The default behavior for now is still not to display these unless
2683   explicitly asked with -fcaret (or -fall). However, in a later release, it
2684   will be made the default behavior (but may still be deactivated with
2685   -fno-caret).
2687 ** New value for %define variable: api.pure full
2689   The %define variable api.pure requests a pure (reentrant) parser. However,
2690   for historical reasons, using it in a location-tracking Yacc parser
2691   resulted in a yyerror function that did not take a location as a
2692   parameter. With this new value, the user may request a better pure parser,
2693   where yyerror does take a location as a parameter (in location-tracking
2694   parsers).
2696   The use of "%define api.pure true" is deprecated in favor of this new
2697   "%define api.pure full".
2699 ** New %define variable: api.location.type (glr.cc, lalr1.cc, lalr1.java)
2701   The %define variable api.location.type defines the name of the type to use
2702   for locations.  When defined, Bison no longer generates the position.hh
2703   and location.hh files, nor does the parser will include them: the user is
2704   then responsible to define her type.
2706   This can be used in programs with several parsers to factor their location
2707   and position files: let one of them generate them, and the others just use
2708   them.
2710   This feature was actually introduced, but not documented, in Bison 2.5,
2711   under the name "location_type" (which is maintained for backward
2712   compatibility).
2714   For consistency, lalr1.java's %define variables location_type and
2715   position_type are deprecated in favor of api.location.type and
2716   api.position.type.
2718 ** Exception safety (lalr1.cc)
2720   The parse function now catches exceptions, uses the %destructors to
2721   release memory (the lookahead symbol and the symbols pushed on the stack)
2722   before re-throwing the exception.
2724   This feature is somewhat experimental.  User feedback would be
2725   appreciated.
2727 ** Graph improvements in DOT and XSLT
2729   Contributed by Théophile Ranquet.
2731   The graphical presentation of the states is more readable: their shape is
2732   now rectangular, the state number is clearly displayed, and the items are
2733   numbered and left-justified.
2735   The reductions are now explicitly represented as transitions to other
2736   diamond shaped nodes.
2738   These changes are present in both --graph output and xml2dot.xsl XSLT
2739   processing, with minor (documented) differences.
2741 ** %language is no longer an experimental feature.
2743   The introduction of this feature, in 2.4, was four years ago. The
2744   --language option and the %language directive are no longer experimental.
2746 ** Documentation
2748   The sections about shift/reduce and reduce/reduce conflicts resolution
2749   have been fixed and extended.
2751   Although introduced more than four years ago, XML and Graphviz reports
2752   were not properly documented.
2754   The translation of midrule actions is now described.
2757 * Noteworthy changes in release 2.6.5 (2012-11-07) [stable]
2759   We consider compiler warnings about Bison generated parsers to be bugs.
2760   Rather than working around them in your own project, please consider
2761   reporting them to us.
2763 ** Bug fixes
2765   Warnings about uninitialized yylval and/or yylloc for push parsers with a
2766   pure interface have been fixed for GCC 4.0 up to 4.8, and Clang 2.9 to
2767   3.2.
2769   Other issues in the test suite have been addressed.
2771   Null characters are correctly displayed in error messages.
2773   When possible, yylloc is correctly initialized before calling yylex.  It
2774   is no longer necessary to initialize it in the %initial-action.
2777 * Noteworthy changes in release 2.6.4 (2012-10-23) [stable]
2779   Bison 2.6.3's --version was incorrect.  This release fixes this issue.
2782 * Noteworthy changes in release 2.6.3 (2012-10-22) [stable]
2784 ** Bug fixes
2786   Bugs and portability issues in the test suite have been fixed.
2788   Some errors in translations have been addressed, and --help now directs
2789   users to the appropriate place to report them.
2791   Stray Info files shipped by accident are removed.
2793   Incorrect definitions of YY_, issued by yacc.c when no parser header is
2794   generated, are removed.
2796   All the generated headers are self-contained.
2798 ** Header guards (yacc.c, glr.c, glr.cc)
2800   In order to avoid collisions, the header guards are now
2801   YY_<PREFIX>_<FILE>_INCLUDED, instead of merely <PREFIX>_<FILE>.
2802   For instance the header generated from
2804     %define api.prefix "calc"
2805     %defines "lib/parse.h"
2807   will use YY_CALC_LIB_PARSE_H_INCLUDED as guard.
2809 ** Fix compiler warnings in the generated parser (yacc.c, glr.c)
2811   The compilation of pure parsers (%define api.pure) can trigger GCC
2812   warnings such as:
2814     input.c: In function 'yyparse':
2815     input.c:1503:12: warning: 'yylval' may be used uninitialized in this
2816                               function [-Wmaybe-uninitialized]
2817        *++yyvsp = yylval;
2818                 ^
2820   This is now fixed; pragmas to avoid these warnings are no longer needed.
2822   Warnings from clang ("equality comparison with extraneous parentheses" and
2823   "function declared 'noreturn' should not return") have also been
2824   addressed.
2827 * Noteworthy changes in release 2.6.2 (2012-08-03) [stable]
2829 ** Bug fixes
2831   Buffer overruns, complaints from Flex, and portability issues in the test
2832   suite have been fixed.
2834 ** Spaces in %lex- and %parse-param (lalr1.cc, glr.cc)
2836   Trailing end-of-lines in %parse-param or %lex-param would result in
2837   invalid C++.  This is fixed.
2839 ** Spurious spaces and end-of-lines
2841   The generated files no longer end (nor start) with empty lines.
2844 * Noteworthy changes in release 2.6.1 (2012-07-30) [stable]
2846  Bison no longer executes user-specified M4 code when processing a grammar.
2848 ** Future Changes
2850   In addition to the removal of the features announced in Bison 2.6, the
2851   next major release will remove the "Temporary hack for adding a semicolon
2852   to the user action", as announced in the release 2.5.  Instead of:
2854     exp: exp "+" exp { $$ = $1 + $3 };
2856   write:
2858     exp: exp "+" exp { $$ = $1 + $3; };
2860 ** Bug fixes
2862 *** Type names are now properly escaped.
2864 *** glr.cc: set_debug_level and debug_level work as expected.
2866 *** Stray @ or $ in actions
2868   While Bison used to warn about stray $ or @ in action rules, it did not
2869   for other actions such as printers, destructors, or initial actions.  It
2870   now does.
2872 ** Type names in actions
2874   For consistency with rule actions, it is now possible to qualify $$ by a
2875   type-name in destructors, printers, and initial actions.  For instance:
2877     %printer { fprintf (yyo, "(%d, %f)", $<ival>$, $<fval>$); } <*> <>;
2879   will display two values for each typed and untyped symbol (provided
2880   that YYSTYPE has both "ival" and "fval" fields).
2883 * Noteworthy changes in release 2.6 (2012-07-19) [stable]
2885 ** Future changes
2887   The next major release of Bison will drop support for the following
2888   deprecated features.  Please report disagreements to bug-bison@gnu.org.
2890 *** K&R C parsers
2892   Support for generating parsers in K&R C will be removed.  Parsers
2893   generated for C support ISO C90, and are tested with ISO C99 and ISO C11
2894   compilers.
2896 *** Features deprecated since Bison 1.875
2898   The definitions of yystype and yyltype will be removed; use YYSTYPE and
2899   YYLTYPE.
2901   YYPARSE_PARAM and YYLEX_PARAM, deprecated in favor of %parse-param and
2902   %lex-param, will no longer be supported.
2904   Support for the preprocessor symbol YYERROR_VERBOSE will be removed, use
2905   %error-verbose.
2907 *** The generated header will be included (yacc.c)
2909   Instead of duplicating the content of the generated header (definition of
2910   YYSTYPE, yyparse declaration etc.), the generated parser will include it,
2911   as is already the case for GLR or C++ parsers.  This change is deferred
2912   because existing versions of ylwrap (e.g., Automake 1.12.1) do not support
2913   it.
2915 ** Generated Parser Headers
2917 *** Guards (yacc.c, glr.c, glr.cc)
2919   The generated headers are now guarded, as is already the case for C++
2920   parsers (lalr1.cc).  For instance, with --defines=foo.h:
2922     #ifndef YY_FOO_H
2923     # define YY_FOO_H
2924     ...
2925     #endif /* !YY_FOO_H  */
2927 *** New declarations (yacc.c, glr.c)
2929   The generated header now declares yydebug and yyparse.  Both honor
2930   --name-prefix=bar_, and yield
2932     int bar_parse (void);
2934   rather than
2936     #define yyparse bar_parse
2937     int yyparse (void);
2939   in order to facilitate the inclusion of several parser headers inside a
2940   single compilation unit.
2942 *** Exported symbols in C++
2944   The symbols YYTOKEN_TABLE and YYERROR_VERBOSE, which were defined in the
2945   header, are removed, as they prevent the possibility of including several
2946   generated headers from a single compilation unit.
2948 *** YYLSP_NEEDED
2950   For the same reasons, the undocumented and unused macro YYLSP_NEEDED is no
2951   longer defined.
2953 ** New %define variable: api.prefix
2955   Now that the generated headers are more complete and properly protected
2956   against multiple inclusions, constant names, such as YYSTYPE are a
2957   problem.  While yyparse and others are properly renamed by %name-prefix,
2958   YYSTYPE, YYDEBUG and others have never been affected by it.  Because it
2959   would introduce backward compatibility issues in projects not expecting
2960   YYSTYPE to be renamed, instead of changing the behavior of %name-prefix,
2961   it is deprecated in favor of a new %define variable: api.prefix.
2963   The following examples compares both:
2965     %name-prefix "bar_"               | %define api.prefix "bar_"
2966     %token <ival> FOO                   %token <ival> FOO
2967     %union { int ival; }                %union { int ival; }
2968     %%                                  %%
2969     exp: 'a';                           exp: 'a';
2971   bison generates:
2973     #ifndef BAR_FOO_H                   #ifndef BAR_FOO_H
2974     # define BAR_FOO_H                  # define BAR_FOO_H
2976     /* Enabling traces.  */             /* Enabling traces.  */
2977     # ifndef YYDEBUG                  | # ifndef BAR_DEBUG
2978                                       > #  if defined YYDEBUG
2979                                       > #   if YYDEBUG
2980                                       > #    define BAR_DEBUG 1
2981                                       > #   else
2982                                       > #    define BAR_DEBUG 0
2983                                       > #   endif
2984                                       > #  else
2985     #  define YYDEBUG 0               | #   define BAR_DEBUG 0
2986                                       > #  endif
2987     # endif                           | # endif
2989     # if YYDEBUG                      | # if BAR_DEBUG
2990     extern int bar_debug;               extern int bar_debug;
2991     # endif                             # endif
2993     /* Tokens.  */                      /* Tokens.  */
2994     # ifndef YYTOKENTYPE              | # ifndef BAR_TOKENTYPE
2995     #  define YYTOKENTYPE             | #  define BAR_TOKENTYPE
2996        enum yytokentype {             |    enum bar_tokentype {
2997          FOO = 258                           FOO = 258
2998        };                                  };
2999     # endif                             # endif
3001     #if ! defined YYSTYPE \           | #if ! defined BAR_STYPE \
3002      && ! defined YYSTYPE_IS_DECLARED |  && ! defined BAR_STYPE_IS_DECLARED
3003     typedef union YYSTYPE             | typedef union BAR_STYPE
3004     {                                   {
3005      int ival;                           int ival;
3006     } YYSTYPE;                        | } BAR_STYPE;
3007     # define YYSTYPE_IS_DECLARED 1    | # define BAR_STYPE_IS_DECLARED 1
3008     #endif                              #endif
3010     extern YYSTYPE bar_lval;          | extern BAR_STYPE bar_lval;
3012     int bar_parse (void);               int bar_parse (void);
3014     #endif /* !BAR_FOO_H  */            #endif /* !BAR_FOO_H  */
3017 * Noteworthy changes in release 2.5.1 (2012-06-05) [stable]
3019 ** Future changes:
3021   The next major release will drop support for generating parsers in K&R C.
3023 ** yacc.c: YYBACKUP works as expected.
3025 ** glr.c improvements:
3027 *** Location support is eliminated when not requested:
3029   GLR parsers used to include location-related code even when locations were
3030   not requested, and therefore not even usable.
3032 *** __attribute__ is preserved:
3034   __attribute__ is no longer disabled when __STRICT_ANSI__ is defined (i.e.,
3035   when -std is passed to GCC).
3037 ** lalr1.java: several fixes:
3039   The Java parser no longer throws ArrayIndexOutOfBoundsException if the
3040   first token leads to a syntax error.  Some minor clean ups.
3042 ** Changes for C++:
3044 *** C++11 compatibility:
3046   C and C++ parsers use "nullptr" instead of "0" when __cplusplus is 201103L
3047   or higher.
3049 *** Header guards
3051   The header files such as "parser.hh", "location.hh", etc. used a constant
3052   name for preprocessor guards, for instance:
3054     #ifndef BISON_LOCATION_HH
3055     # define BISON_LOCATION_HH
3056     ...
3057     #endif // !BISON_LOCATION_HH
3059   The inclusion guard is now computed from "PREFIX/FILE-NAME", where lower
3060   case characters are converted to upper case, and series of
3061   non-alphanumerical characters are converted to an underscore.
3063   With "bison -o lang++/parser.cc", "location.hh" would now include:
3065     #ifndef YY_LANG_LOCATION_HH
3066     # define YY_LANG_LOCATION_HH
3067     ...
3068     #endif // !YY_LANG_LOCATION_HH
3070 *** C++ locations:
3072   The position and location constructors (and their initialize methods)
3073   accept new arguments for line and column.  Several issues in the
3074   documentation were fixed.
3076 ** liby is no longer asking for "rpl_fprintf" on some platforms.
3078 ** Changes in the manual:
3080 *** %printer is documented
3082   The "%printer" directive, supported since at least Bison 1.50, is finally
3083   documented.  The "mfcalc" example is extended to demonstrate it.
3085   For consistency with the C skeletons, the C++ parsers now also support
3086   "yyoutput" (as an alias to "debug_stream ()").
3088 *** Several improvements have been made:
3090   The layout for grammar excerpts was changed to a more compact scheme.
3091   Named references are motivated.  The description of the automaton
3092   description file (*.output) is updated to the current format.  Incorrect
3093   index entries were fixed.  Some other errors were fixed.
3095 ** Building bison:
3097 *** Conflicting prototypes with recent/modified Flex.
3099   Fixed build problems with the current, unreleased, version of Flex, and
3100   some modified versions of 2.5.35, which have modified function prototypes.
3102 *** Warnings during the build procedure have been eliminated.
3104 *** Several portability problems in the test suite have been fixed:
3106   This includes warnings with some compilers, unexpected behavior of tools
3107   such as diff, warning messages from the test suite itself, etc.
3109 *** The install-pdf target works properly:
3111   Running "make install-pdf" (or -dvi, -html, -info, and -ps) no longer
3112   halts in the middle of its course.
3115 * Noteworthy changes in release 2.5 (2011-05-14)
3117 ** Grammar symbol names can now contain non-initial dashes:
3119   Consistently with directives (such as %error-verbose) and with
3120   %define variables (e.g. push-pull), grammar symbol names may contain
3121   dashes in any position except the beginning.  This is a GNU
3122   extension over POSIX Yacc.  Thus, use of this extension is reported
3123   by -Wyacc and rejected in Yacc mode (--yacc).
3125 ** Named references:
3127   Historically, Yacc and Bison have supported positional references
3128   ($n, $$) to allow access to symbol values from inside of semantic
3129   actions code.
3131   Starting from this version, Bison can also accept named references.
3132   When no ambiguity is possible, original symbol names may be used
3133   as named references:
3135     if_stmt : "if" cond_expr "then" then_stmt ';'
3136     { $if_stmt = mk_if_stmt($cond_expr, $then_stmt); }
3138   In the more common case, explicit names may be declared:
3140     stmt[res] : "if" expr[cond] "then" stmt[then] "else" stmt[else] ';'
3141     { $res = mk_if_stmt($cond, $then, $else); }
3143   Location information is also accessible using @name syntax.  When
3144   accessing symbol names containing dots or dashes, explicit bracketing
3145   ($[sym.1]) must be used.
3147   These features are experimental in this version.  More user feedback
3148   will help to stabilize them.
3149   Contributed by Alex Rozenman.
3151 ** IELR(1) and canonical LR(1):
3153   IELR(1) is a minimal LR(1) parser table generation algorithm.  That
3154   is, given any context-free grammar, IELR(1) generates parser tables
3155   with the full language-recognition power of canonical LR(1) but with
3156   nearly the same number of parser states as LALR(1).  This reduction
3157   in parser states is often an order of magnitude.  More importantly,
3158   because canonical LR(1)'s extra parser states may contain duplicate
3159   conflicts in the case of non-LR(1) grammars, the number of conflicts
3160   for IELR(1) is often an order of magnitude less as well.  This can
3161   significantly reduce the complexity of developing of a grammar.
3163   Bison can now generate IELR(1) and canonical LR(1) parser tables in
3164   place of its traditional LALR(1) parser tables, which remain the
3165   default.  You can specify the type of parser tables in the grammar
3166   file with these directives:
3168     %define lr.type lalr
3169     %define lr.type ielr
3170     %define lr.type canonical-lr
3172   The default-reduction optimization in the parser tables can also be
3173   adjusted using "%define lr.default-reductions".  For details on both
3174   of these features, see the new section "Tuning LR" in the Bison
3175   manual.
3177   These features are experimental.  More user feedback will help to
3178   stabilize them.
3180 ** LAC (Lookahead Correction) for syntax error handling
3182   Contributed by Joel E. Denny.
3184   Canonical LR, IELR, and LALR can suffer from a couple of problems
3185   upon encountering a syntax error.  First, the parser might perform
3186   additional parser stack reductions before discovering the syntax
3187   error.  Such reductions can perform user semantic actions that are
3188   unexpected because they are based on an invalid token, and they
3189   cause error recovery to begin in a different syntactic context than
3190   the one in which the invalid token was encountered.  Second, when
3191   verbose error messages are enabled (with %error-verbose or the
3192   obsolete "#define YYERROR_VERBOSE"), the expected token list in the
3193   syntax error message can both contain invalid tokens and omit valid
3194   tokens.
3196   The culprits for the above problems are %nonassoc, default
3197   reductions in inconsistent states, and parser state merging.  Thus,
3198   IELR and LALR suffer the most.  Canonical LR can suffer only if
3199   %nonassoc is used or if default reductions are enabled for
3200   inconsistent states.
3202   LAC is a new mechanism within the parsing algorithm that solves
3203   these problems for canonical LR, IELR, and LALR without sacrificing
3204   %nonassoc, default reductions, or state merging.  When LAC is in
3205   use, canonical LR and IELR behave almost exactly the same for both
3206   syntactically acceptable and syntactically unacceptable input.
3207   While LALR still does not support the full language-recognition
3208   power of canonical LR and IELR, LAC at least enables LALR's syntax
3209   error handling to correctly reflect LALR's language-recognition
3210   power.
3212   Currently, LAC is only supported for deterministic parsers in C.
3213   You can enable LAC with the following directive:
3215     %define parse.lac full
3217   See the new section "LAC" in the Bison manual for additional
3218   details including a few caveats.
3220   LAC is an experimental feature.  More user feedback will help to
3221   stabilize it.
3223 ** %define improvements:
3225 *** Can now be invoked via the command line:
3227   Each of these command-line options
3229     -D NAME[=VALUE]
3230     --define=NAME[=VALUE]
3232     -F NAME[=VALUE]
3233     --force-define=NAME[=VALUE]
3235   is equivalent to this grammar file declaration
3237     %define NAME ["VALUE"]
3239   except that the manner in which Bison processes multiple definitions
3240   for the same NAME differs.  Most importantly, -F and --force-define
3241   quietly override %define, but -D and --define do not.  For further
3242   details, see the section "Bison Options" in the Bison manual.
3244 *** Variables renamed:
3246   The following %define variables
3248     api.push_pull
3249     lr.keep_unreachable_states
3251   have been renamed to
3253     api.push-pull
3254     lr.keep-unreachable-states
3256   The old names are now deprecated but will be maintained indefinitely
3257   for backward compatibility.
3259 *** Values no longer need to be quoted in the grammar file:
3261   If a %define value is an identifier, it no longer needs to be placed
3262   within quotations marks.  For example,
3264     %define api.push-pull "push"
3266   can be rewritten as
3268     %define api.push-pull push
3270 *** Unrecognized variables are now errors not warnings.
3272 *** Multiple invocations for any variable is now an error not a warning.
3274 ** Unrecognized %code qualifiers are now errors not warnings.
3276 ** Character literals not of length one:
3278   Previously, Bison quietly converted all character literals to length
3279   one.  For example, without warning, Bison interpreted the operators in
3280   the following grammar to be the same token:
3282     exp: exp '++'
3283        | exp '+' exp
3284        ;
3286   Bison now warns when a character literal is not of length one.  In
3287   some future release, Bison will start reporting an error instead.
3289 ** Destructor calls fixed for lookaheads altered in semantic actions:
3291   Previously for deterministic parsers in C, if a user semantic action
3292   altered yychar, the parser in some cases used the old yychar value to
3293   determine which destructor to call for the lookahead upon a syntax
3294   error or upon parser return.  This bug has been fixed.
3296 ** C++ parsers use YYRHSLOC:
3298   Similarly to the C parsers, the C++ parsers now define the YYRHSLOC
3299   macro and use it in the default YYLLOC_DEFAULT.  You are encouraged
3300   to use it.  If, for instance, your location structure has "first"
3301   and "last" members, instead of
3303     # define YYLLOC_DEFAULT(Current, Rhs, N)                             \
3304       do                                                                 \
3305         if (N)                                                           \
3306           {                                                              \
3307             (Current).first = (Rhs)[1].location.first;                   \
3308             (Current).last  = (Rhs)[N].location.last;                    \
3309           }                                                              \
3310         else                                                             \
3311           {                                                              \
3312             (Current).first = (Current).last = (Rhs)[0].location.last;   \
3313           }                                                              \
3314       while (false)
3316   use:
3318     # define YYLLOC_DEFAULT(Current, Rhs, N)                             \
3319       do                                                                 \
3320         if (N)                                                           \
3321           {                                                              \
3322             (Current).first = YYRHSLOC (Rhs, 1).first;                   \
3323             (Current).last  = YYRHSLOC (Rhs, N).last;                    \
3324           }                                                              \
3325         else                                                             \
3326           {                                                              \
3327             (Current).first = (Current).last = YYRHSLOC (Rhs, 0).last;   \
3328           }                                                              \
3329       while (false)
3331 ** YYLLOC_DEFAULT in C++:
3333   The default implementation of YYLLOC_DEFAULT used to be issued in
3334   the header file.  It is now output in the implementation file, after
3335   the user %code sections so that its #ifndef guard does not try to
3336   override the user's YYLLOC_DEFAULT if provided.
3338 ** YYFAIL now produces warnings and Java parsers no longer implement it:
3340   YYFAIL has existed for many years as an undocumented feature of
3341   deterministic parsers in C generated by Bison.  More recently, it was
3342   a documented feature of Bison's experimental Java parsers.  As
3343   promised in Bison 2.4.2's NEWS entry, any appearance of YYFAIL in a
3344   semantic action now produces a deprecation warning, and Java parsers
3345   no longer implement YYFAIL at all.  For further details, including a
3346   discussion of how to suppress C preprocessor warnings about YYFAIL
3347   being unused, see the Bison 2.4.2 NEWS entry.
3349 ** Temporary hack for adding a semicolon to the user action:
3351   Previously, Bison appended a semicolon to every user action for
3352   reductions when the output language defaulted to C (specifically, when
3353   neither %yacc, %language, %skeleton, or equivalent command-line
3354   options were specified).  This allowed actions such as
3356     exp: exp "+" exp { $$ = $1 + $3 };
3358   instead of
3360     exp: exp "+" exp { $$ = $1 + $3; };
3362   As a first step in removing this misfeature, Bison now issues a
3363   warning when it appends a semicolon.  Moreover, in cases where Bison
3364   cannot easily determine whether a semicolon is needed (for example, an
3365   action ending with a cpp directive or a braced compound initializer),
3366   it no longer appends one.  Thus, the C compiler might now complain
3367   about a missing semicolon where it did not before.  Future releases of
3368   Bison will cease to append semicolons entirely.
3370 ** Verbose syntax error message fixes:
3372   When %error-verbose or the obsolete "#define YYERROR_VERBOSE" is
3373   specified, syntax error messages produced by the generated parser
3374   include the unexpected token as well as a list of expected tokens.
3375   The effect of %nonassoc on these verbose messages has been corrected
3376   in two ways, but a more complete fix requires LAC, described above:
3378 *** When %nonassoc is used, there can exist parser states that accept no
3379     tokens, and so the parser does not always require a lookahead token
3380     in order to detect a syntax error.  Because no unexpected token or
3381     expected tokens can then be reported, the verbose syntax error
3382     message described above is suppressed, and the parser instead
3383     reports the simpler message, "syntax error".  Previously, this
3384     suppression was sometimes erroneously triggered by %nonassoc when a
3385     lookahead was actually required.  Now verbose messages are
3386     suppressed only when all previous lookaheads have already been
3387     shifted or discarded.
3389 *** Previously, the list of expected tokens erroneously included tokens
3390     that would actually induce a syntax error because conflicts for them
3391     were resolved with %nonassoc in the current parser state.  Such
3392     tokens are now properly omitted from the list.
3394 *** Expected token lists are still often wrong due to state merging
3395     (from LALR or IELR) and default reductions, which can both add
3396     invalid tokens and subtract valid tokens.  Canonical LR almost
3397     completely fixes this problem by eliminating state merging and
3398     default reductions.  However, there is one minor problem left even
3399     when using canonical LR and even after the fixes above.  That is,
3400     if the resolution of a conflict with %nonassoc appears in a later
3401     parser state than the one at which some syntax error is
3402     discovered, the conflicted token is still erroneously included in
3403     the expected token list.  Bison's new LAC implementation,
3404     described above, eliminates this problem and the need for
3405     canonical LR.  However, LAC is still experimental and is disabled
3406     by default.
3408 ** Java skeleton fixes:
3410 *** A location handling bug has been fixed.
3412 *** The top element of each of the value stack and location stack is now
3413     cleared when popped so that it can be garbage collected.
3415 *** Parser traces now print the top element of the stack.
3417 ** -W/--warnings fixes:
3419 *** Bison now properly recognizes the "no-" versions of categories:
3421   For example, given the following command line, Bison now enables all
3422   warnings except warnings for incompatibilities with POSIX Yacc:
3424     bison -Wall,no-yacc gram.y
3426 *** Bison now treats S/R and R/R conflicts like other warnings:
3428   Previously, conflict reports were independent of Bison's normal
3429   warning system.  Now, Bison recognizes the warning categories
3430   "conflicts-sr" and "conflicts-rr".  This change has important
3431   consequences for the -W and --warnings command-line options.  For
3432   example:
3434     bison -Wno-conflicts-sr gram.y  # S/R conflicts not reported
3435     bison -Wno-conflicts-rr gram.y  # R/R conflicts not reported
3436     bison -Wnone            gram.y  # no conflicts are reported
3437     bison -Werror           gram.y  # any conflict is an error
3439   However, as before, if the %expect or %expect-rr directive is
3440   specified, an unexpected number of conflicts is an error, and an
3441   expected number of conflicts is not reported, so -W and --warning
3442   then have no effect on the conflict report.
3444 *** The "none" category no longer disables a preceding "error":
3446   For example, for the following command line, Bison now reports
3447   errors instead of warnings for incompatibilities with POSIX Yacc:
3449     bison -Werror,none,yacc gram.y
3451 *** The "none" category now disables all Bison warnings:
3453   Previously, the "none" category disabled only Bison warnings for
3454   which there existed a specific -W/--warning category.  However,
3455   given the following command line, Bison is now guaranteed to
3456   suppress all warnings:
3458     bison -Wnone gram.y
3460 ** Precedence directives can now assign token number 0:
3462   Since Bison 2.3b, which restored the ability of precedence
3463   directives to assign token numbers, doing so for token number 0 has
3464   produced an assertion failure.  For example:
3466     %left END 0
3468   This bug has been fixed.
3471 * Noteworthy changes in release 2.4.3 (2010-08-05)
3473 ** Bison now obeys -Werror and --warnings=error for warnings about
3474    grammar rules that are useless in the parser due to conflicts.
3476 ** Problems with spawning M4 on at least FreeBSD 8 and FreeBSD 9 have
3477    been fixed.
3479 ** Failures in the test suite for GCC 4.5 have been fixed.
3481 ** Failures in the test suite for some versions of Sun Studio C++ have
3482    been fixed.
3484 ** Contrary to Bison 2.4.2's NEWS entry, it has been decided that
3485    warnings about undefined %prec identifiers will not be converted to
3486    errors in Bison 2.5.  They will remain warnings, which should be
3487    sufficient for POSIX while avoiding backward compatibility issues.
3489 ** Minor documentation fixes.
3492 * Noteworthy changes in release 2.4.2 (2010-03-20)
3494 ** Some portability problems that resulted in failures and livelocks
3495    in the test suite on some versions of at least Solaris, AIX, HP-UX,
3496    RHEL4, and Tru64 have been addressed.  As a result, fatal Bison
3497    errors should no longer cause M4 to report a broken pipe on the
3498    affected platforms.
3500 ** "%prec IDENTIFIER" requires IDENTIFIER to be defined separately.
3502   POSIX specifies that an error be reported for any identifier that does
3503   not appear on the LHS of a grammar rule and that is not defined by
3504   %token, %left, %right, or %nonassoc.  Bison 2.3b and later lost this
3505   error report for the case when an identifier appears only after a
3506   %prec directive.  It is now restored.  However, for backward
3507   compatibility with recent Bison releases, it is only a warning for
3508   now.  In Bison 2.5 and later, it will return to being an error.
3509   [Between the 2.4.2 and 2.4.3 releases, it was decided that this
3510   warning will not be converted to an error in Bison 2.5.]
3512 ** Detection of GNU M4 1.4.6 or newer during configure is improved.
3514 ** Warnings from gcc's -Wundef option about undefined YYENABLE_NLS,
3515    YYLTYPE_IS_TRIVIAL, and __STRICT_ANSI__ in C/C++ parsers are now
3516    avoided.
3518 ** %code is now a permanent feature.
3520   A traditional Yacc prologue directive is written in the form:
3522     %{CODE%}
3524   To provide a more flexible alternative, Bison 2.3b introduced the
3525   %code directive with the following forms for C/C++:
3527     %code          {CODE}
3528     %code requires {CODE}
3529     %code provides {CODE}
3530     %code top      {CODE}
3532   These forms are now considered permanent features of Bison.  See the
3533   %code entries in the section "Bison Declaration Summary" in the Bison
3534   manual for a summary of their functionality.  See the section
3535   "Prologue Alternatives" for a detailed discussion including the
3536   advantages of %code over the traditional Yacc prologue directive.
3538   Bison's Java feature as a whole including its current usage of %code
3539   is still considered experimental.
3541 ** YYFAIL is deprecated and will eventually be removed.
3543   YYFAIL has existed for many years as an undocumented feature of
3544   deterministic parsers in C generated by Bison.  Previously, it was
3545   documented for Bison's experimental Java parsers.  YYFAIL is no longer
3546   documented for Java parsers and is formally deprecated in both cases.
3547   Users are strongly encouraged to migrate to YYERROR, which is
3548   specified by POSIX.
3550   Like YYERROR, you can invoke YYFAIL from a semantic action in order to
3551   induce a syntax error.  The most obvious difference from YYERROR is
3552   that YYFAIL will automatically invoke yyerror to report the syntax
3553   error so that you don't have to.  However, there are several other
3554   subtle differences between YYERROR and YYFAIL, and YYFAIL suffers from
3555   inherent flaws when %error-verbose or "#define YYERROR_VERBOSE" is
3556   used.  For a more detailed discussion, see:
3558     https://lists.gnu.org/r/bison-patches/2009-12/msg00024.html
3560   The upcoming Bison 2.5 will remove YYFAIL from Java parsers, but
3561   deterministic parsers in C will continue to implement it.  However,
3562   because YYFAIL is already flawed, it seems futile to try to make new
3563   Bison features compatible with it.  Thus, during parser generation,
3564   Bison 2.5 will produce a warning whenever it discovers YYFAIL in a
3565   rule action.  In a later release, YYFAIL will be disabled for
3566   %error-verbose and "#define YYERROR_VERBOSE".  Eventually, YYFAIL will
3567   be removed altogether.
3569   There exists at least one case where Bison 2.5's YYFAIL warning will
3570   be a false positive.  Some projects add phony uses of YYFAIL and other
3571   Bison-defined macros for the sole purpose of suppressing C
3572   preprocessor warnings (from GCC cpp's -Wunused-macros, for example).
3573   To avoid Bison's future warning, such YYFAIL uses can be moved to the
3574   epilogue (that is, after the second "%%") in the Bison input file.  In
3575   this release (2.4.2), Bison already generates its own code to suppress
3576   C preprocessor warnings for YYFAIL, so projects can remove their own
3577   phony uses of YYFAIL if compatibility with Bison releases prior to
3578   2.4.2 is not necessary.
3580 ** Internationalization.
3582   Fix a regression introduced in Bison 2.4: Under some circumstances,
3583   message translations were not installed although supported by the
3584   host system.
3587 * Noteworthy changes in release 2.4.1 (2008-12-11)
3589 ** In the GLR defines file, unexpanded M4 macros in the yylval and yylloc
3590    declarations have been fixed.
3592 ** Temporary hack for adding a semicolon to the user action.
3594   Bison used to prepend a trailing semicolon at the end of the user
3595   action for reductions.  This allowed actions such as
3597     exp: exp "+" exp { $$ = $1 + $3 };
3599   instead of
3601     exp: exp "+" exp { $$ = $1 + $3; };
3603   Some grammars still depend on this "feature".  Bison 2.4.1 restores
3604   the previous behavior in the case of C output (specifically, when
3605   neither %language or %skeleton or equivalent command-line options
3606   are used) to leave more time for grammars depending on the old
3607   behavior to be adjusted.  Future releases of Bison will disable this
3608   feature.
3610 ** A few minor improvements to the Bison manual.
3613 * Noteworthy changes in release 2.4 (2008-11-02)
3615 ** %language is an experimental feature.
3617   We first introduced this feature in test release 2.3b as a cleaner
3618   alternative to %skeleton.  Since then, we have discussed the possibility of
3619   modifying its effect on Bison's output file names.  Thus, in this release,
3620   we consider %language to be an experimental feature that will likely evolve
3621   in future releases.
3623 ** Forward compatibility with GNU M4 has been improved.
3625 ** Several bugs in the C++ skeleton and the experimental Java skeleton have been
3626   fixed.
3629 * Noteworthy changes in release 2.3b (2008-05-27)
3631 ** The quotes around NAME that used to be required in the following directive
3632   are now deprecated:
3634     %define NAME "VALUE"
3636 ** The directive "%pure-parser" is now deprecated in favor of:
3638     %define api.pure
3640   which has the same effect except that Bison is more careful to warn about
3641   unreasonable usage in the latter case.
3643 ** Push Parsing
3645   Bison can now generate an LALR(1) parser in C with a push interface.  That
3646   is, instead of invoking "yyparse", which pulls tokens from "yylex", you can
3647   push one token at a time to the parser using "yypush_parse", which will
3648   return to the caller after processing each token.  By default, the push
3649   interface is disabled.  Either of the following directives will enable it:
3651     %define api.push_pull "push" // Just push; does not require yylex.
3652     %define api.push_pull "both" // Push and pull; requires yylex.
3654   See the new section "A Push Parser" in the Bison manual for details.
3656   The current push parsing interface is experimental and may evolve.  More user
3657   feedback will help to stabilize it.
3659 ** The -g and --graph options now output graphs in Graphviz DOT format,
3660   not VCG format.  Like --graph, -g now also takes an optional FILE argument
3661   and thus cannot be bundled with other short options.
3663 ** Java
3665   Bison can now generate an LALR(1) parser in Java.  The skeleton is
3666   "data/lalr1.java".  Consider using the new %language directive instead of
3667   %skeleton to select it.
3669   See the new section "Java Parsers" in the Bison manual for details.
3671   The current Java interface is experimental and may evolve.  More user
3672   feedback will help to stabilize it.
3673   Contributed by Paolo Bonzini.
3675 ** %language
3677   This new directive specifies the programming language of the generated
3678   parser, which can be C (the default), C++, or Java.  Besides the skeleton
3679   that Bison uses, the directive affects the names of the generated files if
3680   the grammar file's name ends in ".y".
3682 ** XML Automaton Report
3684   Bison can now generate an XML report of the LALR(1) automaton using the new
3685   "--xml" option.  The current XML schema is experimental and may evolve.  More
3686   user feedback will help to stabilize it.
3687   Contributed by Wojciech Polak.
3689 ** The grammar file may now specify the name of the parser header file using
3690   %defines.  For example:
3692     %defines "parser.h"
3694 ** When reporting useless rules, useless nonterminals, and unused terminals,
3695   Bison now employs the terms "useless in grammar" instead of "useless",
3696   "useless in parser" instead of "never reduced", and "unused in grammar"
3697   instead of "unused".
3699 ** Unreachable State Removal
3701   Previously, Bison sometimes generated parser tables containing unreachable
3702   states.  A state can become unreachable during conflict resolution if Bison
3703   disables a shift action leading to it from a predecessor state.  Bison now:
3705     1. Removes unreachable states.
3707     2. Does not report any conflicts that appeared in unreachable states.
3708        WARNING: As a result, you may need to update %expect and %expect-rr
3709        directives in existing grammar files.
3711     3. For any rule used only in such states, Bison now reports the rule as
3712        "useless in parser due to conflicts".
3714   This feature can be disabled with the following directive:
3716     %define lr.keep_unreachable_states
3718   See the %define entry in the "Bison Declaration Summary" in the Bison manual
3719   for further discussion.
3721 ** Lookahead Set Correction in the ".output" Report
3723   When instructed to generate a ".output" file including lookahead sets
3724   (using "--report=lookahead", for example), Bison now prints each reduction's
3725   lookahead set only next to the associated state's one item that (1) is
3726   associated with the same rule as the reduction and (2) has its dot at the end
3727   of its RHS.  Previously, Bison also erroneously printed the lookahead set
3728   next to all of the state's other items associated with the same rule.  This
3729   bug affected only the ".output" file and not the generated parser source
3730   code.
3732 ** --report-file=FILE is a new option to override the default ".output" file
3733   name.
3735 ** The "=" that used to be required in the following directives is now
3736   deprecated:
3738     %file-prefix "parser"
3739     %name-prefix "c_"
3740     %output "parser.c"
3742 ** An Alternative to "%{...%}" -- "%code QUALIFIER {CODE}"
3744   Bison 2.3a provided a new set of directives as a more flexible alternative to
3745   the traditional Yacc prologue blocks.  Those have now been consolidated into
3746   a single %code directive with an optional qualifier field, which identifies
3747   the purpose of the code and thus the location(s) where Bison should generate
3748   it:
3750     1. "%code          {CODE}" replaces "%after-header  {CODE}"
3751     2. "%code requires {CODE}" replaces "%start-header  {CODE}"
3752     3. "%code provides {CODE}" replaces "%end-header    {CODE}"
3753     4. "%code top      {CODE}" replaces "%before-header {CODE}"
3755   See the %code entries in section "Bison Declaration Summary" in the Bison
3756   manual for a summary of the new functionality.  See the new section "Prologue
3757   Alternatives" for a detailed discussion including the advantages of %code
3758   over the traditional Yacc prologues.
3760   The prologue alternatives are experimental.  More user feedback will help to
3761   determine whether they should become permanent features.
3763 ** Revised warning: unset or unused midrule values
3765   Since Bison 2.2, Bison has warned about midrule values that are set but not
3766   used within any of the actions of the parent rule.  For example, Bison warns
3767   about unused $2 in:
3769     exp: '1' { $$ = 1; } '+' exp { $$ = $1 + $4; };
3771   Now, Bison also warns about midrule values that are used but not set.  For
3772   example, Bison warns about unset $$ in the midrule action in:
3774     exp: '1' { $1 = 1; } '+' exp { $$ = $2 + $4; };
3776   However, Bison now disables both of these warnings by default since they
3777   sometimes prove to be false alarms in existing grammars employing the Yacc
3778   constructs $0 or $-N (where N is some positive integer).
3780   To enable these warnings, specify the option "--warnings=midrule-values" or
3781   "-W", which is a synonym for "--warnings=all".
3783 ** Default %destructor or %printer with "<*>" or "<>"
3785   Bison now recognizes two separate kinds of default %destructor's and
3786   %printer's:
3788     1. Place "<*>" in a %destructor/%printer symbol list to define a default
3789        %destructor/%printer for all grammar symbols for which you have formally
3790        declared semantic type tags.
3792     2. Place "<>" in a %destructor/%printer symbol list to define a default
3793        %destructor/%printer for all grammar symbols without declared semantic
3794        type tags.
3796   Bison no longer supports the "%symbol-default" notation from Bison 2.3a.
3797   "<*>" and "<>" combined achieve the same effect with one exception: Bison no
3798   longer applies any %destructor to a midrule value if that midrule value is
3799   not actually ever referenced using either $$ or $n in a semantic action.
3801   The default %destructor's and %printer's are experimental.  More user
3802   feedback will help to determine whether they should become permanent
3803   features.
3805   See the section "Freeing Discarded Symbols" in the Bison manual for further
3806   details.
3808 ** %left, %right, and %nonassoc can now declare token numbers.  This is required
3809   by POSIX.  However, see the end of section "Operator Precedence" in the Bison
3810   manual for a caveat concerning the treatment of literal strings.
3812 ** The nonfunctional --no-parser, -n, and %no-parser options have been
3813   completely removed from Bison.
3816 * Noteworthy changes in release 2.3a (2006-09-13)
3818 ** Instead of %union, you can define and use your own union type
3819   YYSTYPE if your grammar contains at least one <type> tag.
3820   Your YYSTYPE need not be a macro; it can be a typedef.
3821   This change is for compatibility with other Yacc implementations,
3822   and is required by POSIX.
3824 ** Locations columns and lines start at 1.
3825   In accordance with the GNU Coding Standards and Emacs.
3827 ** You may now declare per-type and default %destructor's and %printer's:
3829   For example:
3831     %union { char *string; }
3832     %token <string> STRING1
3833     %token <string> STRING2
3834     %type  <string> string1
3835     %type  <string> string2
3836     %union { char character; }
3837     %token <character> CHR
3838     %type  <character> chr
3839     %destructor { free ($$); } %symbol-default
3840     %destructor { free ($$); printf ("%d", @$.first_line); } STRING1 string1
3841     %destructor { } <character>
3843   guarantees that, when the parser discards any user-defined symbol that has a
3844   semantic type tag other than "<character>", it passes its semantic value to
3845   "free".  However, when the parser discards a "STRING1" or a "string1", it
3846   also prints its line number to "stdout".  It performs only the second
3847   "%destructor" in this case, so it invokes "free" only once.
3849   [Although we failed to mention this here in the 2.3a release, the default
3850   %destructor's and %printer's were experimental, and they were rewritten in
3851   future versions.]
3853 ** Except for LALR(1) parsers in C with POSIX Yacc emulation enabled (with "-y",
3854   "--yacc", or "%yacc"), Bison no longer generates #define statements for
3855   associating token numbers with token names.  Removing the #define statements
3856   helps to sanitize the global namespace during preprocessing, but POSIX Yacc
3857   requires them.  Bison still generates an enum for token names in all cases.
3859 ** Handling of traditional Yacc prologue blocks is now more consistent but
3860   potentially incompatible with previous releases of Bison.
3862   As before, you declare prologue blocks in your grammar file with the
3863   "%{ ... %}" syntax.  To generate the pre-prologue, Bison concatenates all
3864   prologue blocks that you've declared before the first %union.  To generate
3865   the post-prologue, Bison concatenates all prologue blocks that you've
3866   declared after the first %union.
3868   Previous releases of Bison inserted the pre-prologue into both the header
3869   file and the code file in all cases except for LALR(1) parsers in C.  In the
3870   latter case, Bison inserted it only into the code file.  For parsers in C++,
3871   the point of insertion was before any token definitions (which associate
3872   token numbers with names).  For parsers in C, the point of insertion was
3873   after the token definitions.
3875   Now, Bison never inserts the pre-prologue into the header file.  In the code
3876   file, it always inserts it before the token definitions.
3878 ** Bison now provides a more flexible alternative to the traditional Yacc
3879   prologue blocks: %before-header, %start-header, %end-header, and
3880   %after-header.
3882   For example, the following declaration order in the grammar file reflects the
3883   order in which Bison will output these code blocks.  However, you are free to
3884   declare these code blocks in your grammar file in whatever order is most
3885   convenient for you:
3887     %before-header {
3888       /* Bison treats this block like a pre-prologue block: it inserts it into
3889        * the code file before the contents of the header file.  It does *not*
3890        * insert it into the header file.  This is a good place to put
3891        * #include's that you want at the top of your code file.  A common
3892        * example is '#include "system.h"'.  */
3893     }
3894     %start-header {
3895       /* Bison inserts this block into both the header file and the code file.
3896        * In both files, the point of insertion is before any Bison-generated
3897        * token, semantic type, location type, and class definitions.  This is a
3898        * good place to define %union dependencies, for example.  */
3899     }
3900     %union {
3901       /* Unlike the traditional Yacc prologue blocks, the output order for the
3902        * new %*-header blocks is not affected by their declaration position
3903        * relative to any %union in the grammar file.  */
3904     }
3905     %end-header {
3906       /* Bison inserts this block into both the header file and the code file.
3907        * In both files, the point of insertion is after the Bison-generated
3908        * definitions.  This is a good place to declare or define public
3909        * functions or data structures that depend on the Bison-generated
3910        * definitions.  */
3911     }
3912     %after-header {
3913       /* Bison treats this block like a post-prologue block: it inserts it into
3914        * the code file after the contents of the header file.  It does *not*
3915        * insert it into the header file.  This is a good place to declare or
3916        * define internal functions or data structures that depend on the
3917        * Bison-generated definitions.  */
3918     }
3920   If you have multiple occurrences of any one of the above declarations, Bison
3921   will concatenate the contents in declaration order.
3923   [Although we failed to mention this here in the 2.3a release, the prologue
3924   alternatives were experimental, and they were rewritten in future versions.]
3926 ** The option "--report=look-ahead" has been changed to "--report=lookahead".
3927   The old spelling still works, but is not documented and may be removed
3928   in a future release.
3931 * Noteworthy changes in release 2.3 (2006-06-05)
3933 ** GLR grammars should now use "YYRECOVERING ()" instead of "YYRECOVERING",
3934   for compatibility with LALR(1) grammars.
3936 ** It is now documented that any definition of YYSTYPE or YYLTYPE should
3937   be to a type name that does not contain parentheses or brackets.
3940 * Noteworthy changes in release 2.2 (2006-05-19)
3942 ** The distribution terms for all Bison-generated parsers now permit
3943   using the parsers in nonfree programs.  Previously, this permission
3944   was granted only for Bison-generated LALR(1) parsers in C.
3946 ** %name-prefix changes the namespace name in C++ outputs.
3948 ** The C++ parsers export their token_type.
3950 ** Bison now allows multiple %union declarations, and concatenates
3951   their contents together.
3953 ** New warning: unused values
3954   Right-hand side symbols whose values are not used are reported,
3955   if the symbols have destructors.  For instance:
3957      exp: exp "?" exp ":" exp { $1 ? $1 : $3; }
3958         | exp "+" exp
3959         ;
3961   will trigger a warning about $$ and $5 in the first rule, and $3 in
3962   the second ($1 is copied to $$ by the default rule).  This example
3963   most likely contains three errors, and could be rewritten as:
3965      exp: exp "?" exp ":" exp
3966             { $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); }
3967         | exp "+" exp
3968             { $$ = $1 ? $1 : $3; if ($1) free ($3); }
3969         ;
3971   However, if the original actions were really intended, memory leaks
3972   and all, the warnings can be suppressed by letting Bison believe the
3973   values are used, e.g.:
3975      exp: exp "?" exp ":" exp { $1 ? $1 : $3; (void) ($$, $5); }
3976         | exp "+" exp         { $$ = $1; (void) $3; }
3977         ;
3979   If there are midrule actions, the warning is issued if no action
3980   uses it.  The following triggers no warning: $1 and $3 are used.
3982      exp: exp { push ($1); } '+' exp { push ($3); sum (); };
3984   The warning is intended to help catching lost values and memory leaks.
3985   If a value is ignored, its associated memory typically is not reclaimed.
3987 ** %destructor vs. YYABORT, YYACCEPT, and YYERROR.
3988   Destructors are now called when user code invokes YYABORT, YYACCEPT,
3989   and YYERROR, for all objects on the stack, other than objects
3990   corresponding to the right-hand side of the current rule.
3992 ** %expect, %expect-rr
3993   Incorrect numbers of expected conflicts are now actual errors,
3994   instead of warnings.
3996 ** GLR, YACC parsers.
3997   The %parse-params are available in the destructors (and the
3998   experimental printers) as per the documentation.
4000 ** Bison now warns if it finds a stray "$" or "@" in an action.
4002 ** %require "VERSION"
4003   This specifies that the grammar file depends on features implemented
4004   in Bison version VERSION or higher.
4006 ** lalr1.cc: The token and value types are now class members.
4007   The tokens were defined as free form enums and cpp macros.  YYSTYPE
4008   was defined as a free form union.  They are now class members:
4009   tokens are enumerations of the "yy::parser::token" struct, and the
4010   semantic values have the "yy::parser::semantic_type" type.
4012   If you do not want or can update to this scheme, the directive
4013   '%define "global_tokens_and_yystype" "1"' triggers the global
4014   definition of tokens and YYSTYPE.  This change is suitable both
4015   for previous releases of Bison, and this one.
4017   If you wish to update, then make sure older version of Bison will
4018   fail using '%require "2.2"'.
4020 ** DJGPP support added.
4023 * Noteworthy changes in release 2.1 (2005-09-16)
4025 ** The C++ lalr1.cc skeleton supports %lex-param.
4027 ** Bison-generated parsers now support the translation of diagnostics like
4028   "syntax error" into languages other than English.  The default
4029   language is still English.  For details, please see the new
4030   Internationalization section of the Bison manual.  Software
4031   distributors should also see the new PACKAGING file.  Thanks to
4032   Bruno Haible for this new feature.
4034 ** Wording in the Bison-generated parsers has been changed slightly to
4035   simplify translation.  In particular, the message "memory exhausted"
4036   has replaced "parser stack overflow", as the old message was not
4037   always accurate for modern Bison-generated parsers.
4039 ** Destructors are now called when the parser aborts, for all symbols left
4040   behind on the stack.  Also, the start symbol is now destroyed after a
4041   successful parse.  In both cases, the behavior was formerly inconsistent.
4043 ** When generating verbose diagnostics, Bison-generated parsers no longer
4044   quote the literal strings associated with tokens.  For example, for
4045   a syntax error associated with '%token NUM "number"' they might
4046   print 'syntax error, unexpected number' instead of 'syntax error,
4047   unexpected "number"'.
4050 * Noteworthy changes in release 2.0 (2004-12-25)
4052 ** Possibly-incompatible changes
4054   - Bison-generated parsers no longer default to using the alloca function
4055     (when available) to extend the parser stack, due to widespread
4056     problems in unchecked stack-overflow detection.  You can "#define
4057     YYSTACK_USE_ALLOCA 1" to require the use of alloca, but please read
4058     the manual to determine safe values for YYMAXDEPTH in that case.
4060   - Error token location.
4061     During error recovery, the location of the syntax error is updated
4062     to cover the whole sequence covered by the error token: it includes
4063     the shifted symbols thrown away during the first part of the error
4064     recovery, and the lookahead rejected during the second part.
4066   - Semicolon changes:
4067     . Stray semicolons are no longer allowed at the start of a grammar.
4068     . Semicolons are now required after in-grammar declarations.
4070   - Unescaped newlines are no longer allowed in character constants or
4071     string literals.  They were never portable, and GCC 3.4.0 has
4072     dropped support for them.  Better diagnostics are now generated if
4073     forget a closing quote.
4075   - NUL bytes are no longer allowed in Bison string literals, unfortunately.
4077 ** New features
4079   - GLR grammars now support locations.
4081   - New directive: %initial-action.
4082     This directive allows the user to run arbitrary code (including
4083     initializing @$) from yyparse before parsing starts.
4085   - A new directive "%expect-rr N" specifies the expected number of
4086     reduce/reduce conflicts in GLR parsers.
4088   - %token numbers can now be hexadecimal integers, e.g., "%token FOO 0x12d".
4089     This is a GNU extension.
4091   - The option "--report=lookahead" was changed to "--report=look-ahead".
4092     [However, this was changed back after 2.3.]
4094   - Experimental %destructor support has been added to lalr1.cc.
4096   - New configure option --disable-yacc, to disable installation of the
4097     yacc command and -ly library introduced in 1.875 for POSIX conformance.
4099 ** Bug fixes
4101   - For now, %expect-count violations are now just warnings, not errors.
4102     This is for compatibility with Bison 1.75 and earlier (when there are
4103     reduce/reduce conflicts) and with Bison 1.30 and earlier (when there
4104     are too many or too few shift/reduce conflicts).  However, in future
4105     versions of Bison we plan to improve the %expect machinery so that
4106     these violations will become errors again.
4108   - Within Bison itself, numbers (e.g., goto numbers) are no longer
4109     arbitrarily limited to 16-bit counts.
4111   - Semicolons are now allowed before "|" in grammar rules, as POSIX requires.
4114 * Noteworthy changes in release 1.875 (2003-01-01)
4116 ** The documentation license has been upgraded to version 1.2
4117   of the GNU Free Documentation License.
4119 ** syntax error processing
4121   - In Yacc-style parsers YYLLOC_DEFAULT is now used to compute error
4122     locations too.  This fixes bugs in error-location computation.
4124   - %destructor
4125     It is now possible to reclaim the memory associated to symbols
4126     discarded during error recovery.  This feature is still experimental.
4128   - %error-verbose
4129     This new directive is preferred over YYERROR_VERBOSE.
4131   - #defining yyerror to steal internal variables is discouraged.
4132     It is not guaranteed to work forever.
4134 ** POSIX conformance
4136   - Semicolons are once again optional at the end of grammar rules.
4137     This reverts to the behavior of Bison 1.33 and earlier, and improves
4138     compatibility with Yacc.
4140   - "parse error" -> "syntax error"
4141     Bison now uniformly uses the term "syntax error"; formerly, the code
4142     and manual sometimes used the term "parse error" instead.  POSIX
4143     requires "syntax error" in diagnostics, and it was thought better to
4144     be consistent.
4146   - The documentation now emphasizes that yylex and yyerror must be
4147     declared before use.  C99 requires this.
4149   - Bison now parses C99 lexical constructs like UCNs and
4150     backslash-newline within C escape sequences, as POSIX 1003.1-2001 requires.
4152   - File names are properly escaped in C output.  E.g., foo\bar.y is
4153     output as "foo\\bar.y".
4155   - Yacc command and library now available
4156     The Bison distribution now installs a "yacc" command, as POSIX requires.
4157     Also, Bison now installs a small library liby.a containing
4158     implementations of Yacc-compatible yyerror and main functions.
4159     This library is normally not useful, but POSIX requires it.
4161   - Type clashes now generate warnings, not errors.
4163   - If the user does not define YYSTYPE as a macro, Bison now declares it
4164     using typedef instead of defining it as a macro.
4165     For consistency, YYLTYPE is also declared instead of defined.
4167 ** Other compatibility issues
4169   - %union directives can now have a tag before the "{", e.g., the
4170     directive "%union foo {...}" now generates the C code
4171     "typedef union foo { ... } YYSTYPE;"; this is for Yacc compatibility.
4172     The default union tag is "YYSTYPE", for compatibility with Solaris 9 Yacc.
4173     For consistency, YYLTYPE's struct tag is now "YYLTYPE" not "yyltype".
4174     This is for compatibility with both Yacc and Bison 1.35.
4176   - ";" is output before the terminating "}" of an action, for
4177     compatibility with Bison 1.35.
4179   - Bison now uses a Yacc-style format for conflict reports, e.g.,
4180     "conflicts: 2 shift/reduce, 1 reduce/reduce".
4182   - "yystype" and "yyltype" are now obsolescent macros instead of being
4183     typedefs or tags; they are no longer documented and are planned to be
4184     withdrawn in a future release.
4186 ** GLR parser notes
4188   - GLR and inline
4189     Users of Bison have to decide how they handle the portability of the
4190     C keyword "inline".
4192   - "parsing stack overflow..." -> "parser stack overflow"
4193     GLR parsers now report "parser stack overflow" as per the Bison manual.
4195 ** %parse-param and %lex-param
4196   The macros YYPARSE_PARAM and YYLEX_PARAM provide a means to pass
4197   additional context to yyparse and yylex.  They suffer from several
4198   shortcomings:
4200   - a single argument only can be added,
4201   - their types are weak (void *),
4202   - this context is not passed to ancillary functions such as yyerror,
4203   - only yacc.c parsers support them.
4205   The new %parse-param/%lex-param directives provide a more precise control.
4206   For instance:
4208     %parse-param {int *nastiness}
4209     %lex-param   {int *nastiness}
4210     %parse-param {int *randomness}
4212   results in the following signatures:
4214     int yylex   (int *nastiness);
4215     int yyparse (int *nastiness, int *randomness);
4217   or, if both %pure-parser and %locations are used:
4219     int yylex   (YYSTYPE *lvalp, YYLTYPE *llocp, int *nastiness);
4220     int yyparse (int *nastiness, int *randomness);
4222 ** Bison now warns if it detects conflicting outputs to the same file,
4223   e.g., it generates a warning for "bison -d -o foo.h foo.y" since
4224   that command outputs both code and header to foo.h.
4226 ** #line in output files
4227   - --no-line works properly.
4229 ** Bison can no longer be built by a K&R C compiler; it requires C89 or
4230   later to be built.  This change originally took place a few versions
4231   ago, but nobody noticed until we recently asked someone to try
4232   building Bison with a K&R C compiler.
4235 * Noteworthy changes in release 1.75 (2002-10-14)
4237 ** Bison should now work on 64-bit hosts.
4239 ** Indonesian translation thanks to Tedi Heriyanto.
4241 ** GLR parsers
4242   Fix spurious parse errors.
4244 ** Pure parsers
4245   Some people redefine yyerror to steal yyparse' private variables.
4246   Reenable this trick until an official feature replaces it.
4248 ** Type Clashes
4249   In agreement with POSIX and with other Yaccs, leaving a default
4250   action is valid when $$ is untyped, and $1 typed:
4252         untyped: ... typed;
4254   but the converse remains an error:
4256         typed: ... untyped;
4258 ** Values of midrule actions
4259   The following code:
4261         foo: { ... } { $$ = $1; } ...
4263   was incorrectly rejected: $1 is defined in the second midrule
4264   action, and is equal to the $$ of the first midrule action.
4267 * Noteworthy changes in release 1.50 (2002-10-04)
4269 ** GLR parsing
4270   The declaration
4271      %glr-parser
4272   causes Bison to produce a Generalized LR (GLR) parser, capable of handling
4273   almost any context-free grammar, ambiguous or not.  The new declarations
4274   %dprec and %merge on grammar rules allow parse-time resolution of
4275   ambiguities.  Contributed by Paul Hilfinger.
4277   Unfortunately Bison 1.50 does not work properly on 64-bit hosts
4278   like the Alpha, so please stick to 32-bit hosts for now.
4280 ** Output Directory
4281   When not in Yacc compatibility mode, when the output file was not
4282   specified, running "bison foo/bar.y" created "foo/bar.c".  It
4283   now creates "bar.c".
4285 ** Undefined token
4286   The undefined token was systematically mapped to 2 which prevented
4287   the use of 2 by the user.  This is no longer the case.
4289 ** Unknown token numbers
4290   If yylex returned an out of range value, yyparse could die.  This is
4291   no longer the case.
4293 ** Error token
4294   According to POSIX, the error token must be 256.
4295   Bison extends this requirement by making it a preference: *if* the
4296   user specified that one of her tokens is numbered 256, then error
4297   will be mapped onto another number.
4299 ** Verbose error messages
4300   They no longer report "..., expecting error or..." for states where
4301   error recovery is possible.
4303 ** End token
4304   Defaults to "$end" instead of "$".
4306 ** Error recovery now conforms to documentation and to POSIX
4307   When a Bison-generated parser encounters a syntax error, it now pops
4308   the stack until it finds a state that allows shifting the error
4309   token.  Formerly, it popped the stack until it found a state that
4310   allowed some non-error action other than a default reduction on the
4311   error token.  The new behavior has long been the documented behavior,
4312   and has long been required by POSIX.  For more details, please see
4313   Paul Eggert, "Reductions during Bison error handling" (2002-05-20)
4314   <https://lists.gnu.org/r/bug-bison/2002-05/msg00038.html>.
4316 ** Traces
4317   Popped tokens and nonterminals are now reported.
4319 ** Larger grammars
4320   Larger grammars are now supported (larger token numbers, larger grammar
4321   size (= sum of the LHS and RHS lengths), larger LALR tables).
4322   Formerly, many of these numbers ran afoul of 16-bit limits;
4323   now these limits are 32 bits on most hosts.
4325 ** Explicit initial rule
4326   Bison used to play hacks with the initial rule, which the user does
4327   not write.  It is now explicit, and visible in the reports and
4328   graphs as rule 0.
4330 ** Useless rules
4331   Before, Bison reported the useless rules, but, although not used,
4332   included them in the parsers.  They are now actually removed.
4334 ** Useless rules, useless nonterminals
4335   They are now reported, as a warning, with their locations.
4337 ** Rules never reduced
4338   Rules that can never be reduced because of conflicts are now
4339   reported.
4341 ** Incorrect "Token not used"
4342   On a grammar such as
4344     %token useless useful
4345     %%
4346     exp: '0' %prec useful;
4348   where a token was used to set the precedence of the last rule,
4349   bison reported both "useful" and "useless" as useless tokens.
4351 ** Revert the C++ namespace changes introduced in 1.31
4352   as they caused too many portability hassles.
4354 ** Default locations
4355   By an accident of design, the default computation of @$ was
4356   performed after another default computation was performed: @$ = @1.
4357   The latter is now removed: YYLLOC_DEFAULT is fully responsible of
4358   the computation of @$.
4360 ** Token end-of-file
4361   The token end of file may be specified by the user, in which case,
4362   the user symbol is used in the reports, the graphs, and the verbose
4363   error messages instead of "$end", which remains being the default.
4364   For instance
4365     %token MYEOF 0
4366   or
4367     %token MYEOF 0 "end of file"
4369 ** Semantic parser
4370   This old option, which has been broken for ages, is removed.
4372 ** New translations
4373   Brazilian Portuguese, thanks to Alexandre Folle de Menezes.
4374   Croatian, thanks to Denis Lackovic.
4376 ** Incorrect token definitions
4377   When given
4378     %token 'a' "A"
4379   bison used to output
4380     #define 'a' 65
4382 ** Token definitions as enums
4383   Tokens are output both as the traditional #define's, and, provided
4384   the compiler supports ANSI C or is a C++ compiler, as enums.
4385   This lets debuggers display names instead of integers.
4387 ** Reports
4388   In addition to --verbose, bison supports --report=THINGS, which
4389   produces additional information:
4390   - itemset
4391     complete the core item sets with their closure
4392   - lookahead [changed to "look-ahead" in 1.875e through 2.3, but changed back]
4393     explicitly associate lookahead tokens to items
4394   - solved
4395     describe shift/reduce conflicts solving.
4396     Bison used to systematically output this information on top of
4397     the report.  Solved conflicts are now attached to their states.
4399 ** Type clashes
4400   Previous versions don't complain when there is a type clash on
4401   the default action if the rule has a midrule action, such as in:
4403     %type <foo> bar
4404     %%
4405     bar: '0' {} '0';
4407   This is fixed.
4409 ** GNU M4 is now required when using Bison.
4412 * Noteworthy changes in release 1.35 (2002-03-25)
4414 ** C Skeleton
4415   Some projects use Bison's C parser with C++ compilers, and define
4416   YYSTYPE as a class.  The recent adjustment of C parsers for data
4417   alignment and 64 bit architectures made this impossible.
4419   Because for the time being no real solution for C++ parser
4420   generation exists, kludges were implemented in the parser to
4421   maintain this use.  In the future, when Bison has C++ parsers, this
4422   kludge will be disabled.
4424   This kludge also addresses some C++ problems when the stack was
4425   extended.
4428 * Noteworthy changes in release 1.34 (2002-03-12)
4430 ** File name clashes are detected
4431   $ bison foo.y -d -o foo.x
4432   fatal error: header and parser would both be named "foo.x"
4434 ** A missing ";" at the end of a rule triggers a warning
4435   In accordance with POSIX, and in agreement with other
4436   Yacc implementations, Bison will mandate this semicolon in the near
4437   future.  This eases the implementation of a Bison parser of Bison
4438   grammars by making this grammar LALR(1) instead of LR(2).  To
4439   facilitate the transition, this release introduces a warning.
4441 ** Revert the C++ namespace changes introduced in 1.31, as they caused too
4442   many portability hassles.
4444 ** DJGPP support added.
4446 ** Fix test suite portability problems.
4449 * Noteworthy changes in release 1.33 (2002-02-07)
4451 ** Fix C++ issues
4452   Groff could not be compiled for the definition of size_t was lacking
4453   under some conditions.
4455 ** Catch invalid @n
4456   As is done with $n.
4459 * Noteworthy changes in release 1.32 (2002-01-23)
4461 ** Fix Yacc output file names
4463 ** Portability fixes
4465 ** Italian, Dutch translations
4468 * Noteworthy changes in release 1.31 (2002-01-14)
4470 ** Many Bug Fixes
4472 ** GNU Gettext and %expect
4473   GNU Gettext asserts 10 s/r conflicts, but there are 7.  Now that
4474   Bison dies on incorrect %expectations, we fear there will be
4475   too many bug reports for Gettext, so _for the time being_, %expect
4476   does not trigger an error when the input file is named "plural.y".
4478 ** Use of alloca in parsers
4479   If YYSTACK_USE_ALLOCA is defined to 0, then the parsers will use
4480   malloc exclusively.  Since 1.29, but was not NEWS'ed.
4482   alloca is used only when compiled with GCC, to avoid portability
4483   problems as on AIX.
4485 ** yyparse now returns 2 if memory is exhausted; formerly it dumped core.
4487 ** When the generated parser lacks debugging code, YYDEBUG is now 0
4488   (as POSIX requires) instead of being undefined.
4490 ** User Actions
4491   Bison has always permitted actions such as { $$ = $1 }: it adds the
4492   ending semicolon.  Now if in Yacc compatibility mode, the semicolon
4493   is no longer output: one has to write { $$ = $1; }.
4495 ** Better C++ compliance
4496   The output parsers try to respect C++ namespaces.
4497   [This turned out to be a failed experiment, and it was reverted later.]
4499 ** Reduced Grammars
4500   Fixed bugs when reporting useless nonterminals.
4502 ** 64 bit hosts
4503   The parsers work properly on 64 bit hosts.
4505 ** Error messages
4506   Some calls to strerror resulted in scrambled or missing error messages.
4508 ** %expect
4509   When the number of shift/reduce conflicts is correct, don't issue
4510   any warning.
4512 ** The verbose report includes the rule line numbers.
4514 ** Rule line numbers are fixed in traces.
4516 ** Swedish translation
4518 ** Parse errors
4519   Verbose parse error messages from the parsers are better looking.
4520   Before: parse error: unexpected `'/'', expecting `"number"' or `'-'' or `'(''
4521      Now: parse error: unexpected '/', expecting "number" or '-' or '('
4523 ** Fixed parser memory leaks.
4524   When the generated parser was using malloc to extend its stacks, the
4525   previous allocations were not freed.
4527 ** Fixed verbose output file.
4528   Some newlines were missing.
4529   Some conflicts in state descriptions were missing.
4531 ** Fixed conflict report.
4532   Option -v was needed to get the result.
4534 ** %expect
4535   Was not used.
4536   Mismatches are errors, not warnings.
4538 ** Fixed incorrect processing of some invalid input.
4540 ** Fixed CPP guards: 9foo.h uses BISON_9FOO_H instead of 9FOO_H.
4542 ** Fixed some typos in the documentation.
4544 ** %token MY_EOF 0 is supported.
4545   Before, MY_EOF was silently renumbered as 257.
4547 ** doc/refcard.tex is updated.
4549 ** %output, %file-prefix, %name-prefix.
4550   New.
4552 ** --output
4553   New, aliasing "--output-file".
4556 * Noteworthy changes in release 1.30 (2001-10-26)
4558 ** "--defines" and "--graph" have now an optional argument which is the
4559   output file name. "-d" and "-g" do not change; they do not take any
4560   argument.
4562 ** "%source_extension" and "%header_extension" are removed, failed
4563   experiment.
4565 ** Portability fixes.
4568 * Noteworthy changes in release 1.29 (2001-09-07)
4570 ** The output file does not define const, as this caused problems when used
4571   with common autoconfiguration schemes.  If you still use ancient compilers
4572   that lack const, compile with the equivalent of the C compiler option
4573   "-Dconst=".  Autoconf's AC_C_CONST macro provides one way to do this.
4575 ** Added "-g" and "--graph".
4577 ** The Bison manual is now distributed under the terms of the GNU FDL.
4579 ** The input and the output files has automatically a similar extension.
4581 ** Russian translation added.
4583 ** NLS support updated; should hopefully be less troublesome.
4585 ** Added the old Bison reference card.
4587 ** Added "--locations" and "%locations".
4589 ** Added "-S" and "--skeleton".
4591 ** "%raw", "-r", "--raw" is disabled.
4593 ** Special characters are escaped when output.  This solves the problems
4594   of the #line lines with path names including backslashes.
4596 ** New directives.
4597   "%yacc", "%fixed_output_files", "%defines", "%no_parser", "%verbose",
4598   "%debug", "%source_extension" and "%header_extension".
4600 ** @$
4601   Automatic location tracking.
4604 * Noteworthy changes in release 1.28 (1999-07-06)
4606 ** Should compile better now with K&R compilers.
4608 ** Added NLS.
4610 ** Fixed a problem with escaping the double quote character.
4612 ** There is now a FAQ.
4615 * Noteworthy changes in release 1.27
4617 ** The make rule which prevented bison.simple from being created on
4618   some systems has been fixed.
4621 * Noteworthy changes in release 1.26
4623 ** Bison now uses Automake.
4625 ** New mailing lists: <bug-bison@gnu.org> and <help-bison@gnu.org>.
4627 ** Token numbers now start at 257 as previously documented, not 258.
4629 ** Bison honors the TMPDIR environment variable.
4631 ** A couple of buffer overruns have been fixed.
4633 ** Problems when closing files should now be reported.
4635 ** Generated parsers should now work even on operating systems which do
4636   not provide alloca().
4639 * Noteworthy changes in release 1.25 (1995-10-16)
4641 ** Errors in the input grammar are not fatal; Bison keeps reading
4642 the grammar file, and reports all the errors found in it.
4644 ** Tokens can now be specified as multiple-character strings: for
4645 example, you could use "<=" for a token which looks like <=, instead
4646 of choosing a name like LESSEQ.
4648 ** The %token_table declaration says to write a table of tokens (names
4649 and numbers) into the parser file.  The yylex function can use this
4650 table to recognize multiple-character string tokens, or for other
4651 purposes.
4653 ** The %no_lines declaration says not to generate any #line preprocessor
4654 directives in the parser file.
4656 ** The %raw declaration says to use internal Bison token numbers, not
4657 Yacc-compatible token numbers, when token names are defined as macros.
4659 ** The --no-parser option produces the parser tables without including
4660 the parser engine; a project can now use its own parser engine.
4661 The actions go into a separate file called NAME.act, in the form of
4662 a switch statement body.
4665 * Noteworthy changes in release 1.23
4667 The user can define YYPARSE_PARAM as the name of an argument to be
4668 passed into yyparse.  The argument should have type void *.  It should
4669 actually point to an object.  Grammar actions can access the variable
4670 by casting it to the proper pointer type.
4672 Line numbers in output file corrected.
4675 * Noteworthy changes in release 1.22
4677 --help option added.
4680 * Noteworthy changes in release 1.20
4682 Output file does not redefine const for C++.
4684 -----
4686 LocalWords:  yacc YYBACKUP glr GCC lalr ArrayIndexOutOfBoundsException nullptr
4687 LocalWords:  cplusplus liby rpl fprintf mfcalc Wyacc stmt cond expr mk sym lr
4688 LocalWords:  IELR ielr Lookahead YYERROR nonassoc LALR's api lookaheads yychar
4689 LocalWords:  destructor lookahead YYRHSLOC YYLLOC Rhs ifndef YYFAIL cpp sr rr
4690 LocalWords:  preprocessor initializer Wno Wnone Werror FreeBSD prec livelocks
4691 LocalWords:  Solaris AIX UX RHEL Tru LHS gcc's Wundef YYENABLE NLS YYLTYPE VCG
4692 LocalWords:  yyerror cpp's Wunused yylval yylloc prepend yyparse yylex yypush
4693 LocalWords:  Graphviz xml nonterminals midrule destructor's YYSTYPE typedef ly
4694 LocalWords:  CHR chr printf stdout namespace preprocessing enum pre include's
4695 LocalWords:  YYRECOVERING nonfree destructors YYABORT YYACCEPT params enums de
4696 LocalWords:  struct yystype DJGPP lex param Haible NUM alloca YYSTACK NUL goto
4697 LocalWords:  YYMAXDEPTH Unescaped UCNs YYLTYPE's yyltype typedefs inline Yaccs
4698 LocalWords:  Heriyanto Reenable dprec Hilfinger Eggert MYEOF Folle Menezes EOF
4699 LocalWords:  Lackovic define's itemset Groff Gettext malloc NEWS'ed YYDEBUG YY
4700 LocalWords:  namespaces strerror const autoconfiguration Dconst Autoconf's FDL
4701 LocalWords:  Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
4702 LocalWords:  extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
4703 LocalWords:  lang yyoutput dvi html ps POSIX lvalp llocp Wother nterm arg init
4704 LocalWords:  TOK calc yyo fval Wconflicts parsers yystackp yyval yynerrs
4705 LocalWords:  Théophile Ranquet Santet fno fnone stype associativity Tolmer
4706 LocalWords:  Wprecedence Rassoul Wempty Paolo Bonzini parser's Michiel loc
4707 LocalWords:  redeclaration sval fcaret reentrant XSLT xsl Wmaybe yyvsp Tedi
4708 LocalWords:  pragmas noreturn untyped Rozenman unexpanded Wojciech Polak
4709 LocalWords:  Alexandre MERCHANTABILITY yytype emplace ptr automove lvalues
4710 LocalWords:  nonterminal yy args Pragma dereference yyformat rhs docdir bw
4711 LocalWords:  Redeclarations rpcalc Autoconf YFLAGS Makefiles PROG DECL num
4712 LocalWords:  Heimbigner AST src ast Makefile srcdir MinGW xxlex XXSTYPE CVE
4713 LocalWords:  XXLTYPE strictfp IDEs ffixit fdiagnostics parseable fixits
4714 LocalWords:  Wdeprecated yytext Variadic variadic yyrhs yyphrs RCS README
4715 LocalWords:  noexcept constexpr ispell american deprecations backend Teoh
4716 LocalWords:  YYPRINT Mangold Bonzini's Wdangling exVal baz checkable gcc
4717 LocalWords:  fsanitize Vogelsgesang lis redeclared stdint automata yytname
4718 LocalWords:  yysymbol yytnamerr yyreport ctx ARGMAX yysyntax stderr LPAREN
4719 LocalWords:  symrec yypcontext TOKENMAX yyexpected YYEMPTY yypstate YYEOF
4720 LocalWords:  autocompletion bistromathic submessages Cayuela lexcalc hoc
4721 LocalWords:  yytoken YYUNDEF YYerror basename Automake's UTF ifdef ffile
4722 LocalWords:  gotos readline Imbimbo Wcounterexamples Wcex Nonunifying rcex
4723 LocalWords:  Vais xsltproc YYNOMEM YYLOCATION signedness YYBISON MITRE's
4724 LocalWords:  libreadline YYMALLOC YYFREE MSVC redefinitions POSIXLY
4726 Local Variables:
4727 ispell-dictionary: "american"
4728 mode: outline
4729 fill-column: 76
4730 End:
4732 Copyright (C) 1995-2015, 2018-2021 Free Software Foundation, Inc.
4734 This file is part of Bison, the GNU Parser Generator.
4736 Permission is granted to copy, distribute and/or modify this document
4737 under the terms of the GNU Free Documentation License, Version 1.3 or
4738 any later version published by the Free Software Foundation; with no
4739 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
4740 Texts.  A copy of the license is included in the "GNU Free
4741 Documentation License" file as part of this distribution.