version 3.7.90
[bison.git] / NEWS
blobf03bbbc0a1879dcb8593e241bf9f5e3481c4224f
1 GNU Bison NEWS
3 * Noteworthy changes in release 3.7.90 (2021-08-13) [beta]
5 ** Backward incompatible changes
7   In conformance with the recommendations of the Graphviz team
8   (https://marc.info/?l=graphviz-devel&m=129418103126092), `-g`/`--graph`
9   now generates a *.gv file by default, instead of *.dot.  A transition
10   started in Bison 3.4.
12   To comply with the latest POSIX standard, in Yacc compatibility mode
13   (options `-y`/`--yacc`) Bison now generates prototypes for yyerror and
14   yylex.  In some situations, this is breaking compatibility: if the user
15   has already declared these functions but with some differences (e.g., to
16   declare them as static, or to use specific attributes), the generated
17   parser will fail to compile.  To disable these prototypes, #define yyerror
18   (to `yyerror`), and likewise for yylex.
20 ** Deprecated features
22   Support for the YYPRINT macro is removed. It worked only with yacc.c and
23   only for tokens.  It was obsoleted by %printer, introduced in Bison 1.50
24   (November 2002).
26   It has always been recommended to prefer `%define api.value.type foo` to
27   `#define YYSTYPE foo`.  The latter is supported in C for compatibility
28   with Yacc, but not in C++.  Warnings are now issued if `#define YYSTYPE`
29   is used in C++, and eventually support will be removed.
31   In C++ code, prefer value_type to semantic_type to denote the semantic
32   value type, which is specified by the `api.value.type` %define variable.
34 ** New features
36 *** A skeleton for the D programming language
38   The "lalr1.d" skeleton is now officially part of Bison.
40   It was originally contributed by Oliver Mangold, based on Paolo Bonzini's
41   lalr1.java, and was improved by H. S. Teoh.  Adela Vais then took over
42   maintenance and invested a lot of efforts to complete, test and document
43   it.
45   It now supports all the bells and whistles of the other deterministic
46   parsers, which include: pull/push interfaces, verbose and custom error
47   messages, lookahead correction, token constructors, internationalization,
48   locations, printers, token and symbol prefixes, etc.
50   Two examples demonstrate the D parsers: a basic one (examples/d/simple),
51   and an advanced one (examples/d/calc).
53 *** Option -H, --header and directive %header
55   The option `-H`/`--header` supersedes the option `--defines`, and the
56   directive %header supersedes %defines.  Both `--defines` and `%defines`
57   are, of course, maintained for backward compatibility.
59 *** Option --html
61   Since version 2.4 Bison can be used to generate HTML reports.  However it
62   was a two-step process: first bison must be invoked with option `--xml`,
63   and then xsltproc must be run to the convert the XML reports into HTML.
65   The new option `--html` combines these steps.  The xsltproc program must
66   be available.
68 *** A C++ native GLR parser
70   A new version of the C++ GLR parser was added: "glr2.cc".  It generates
71   "true C++11", instead of a C++ wrapper around a C parser as does the
72   existing "glr.cc" parser.  As a first significant consequence, it supports
73   `%define api.value.type variant`, contrary to glr.cc.
75   It should be upward compatible in terms of interface, feature and
76   performance to "glr.cc". To try it out, simply use
78   %skeleton "glr2.cc"
80   It will eventually replace "glr.cc".  However we need user feedback on
81   this skeleton.  _Please_ report your results and comments about it.
83 *** Counterexamples
85   Counterexamples now show the rule numbers, and always show ε for rules
86   with an empty right-hand side.  For instance
88     exp
89     ↳ 1: e1       e2     "a"
90          ↳ 3: ε • ↳ 1: ε
92   instead of
94     exp
95     ↳ e1  e2  "a"
96       ↳ • ↳ ε
98 *** Lookahead correction in Java
100   The Java skeleton (lalr1.java) now supports LAC, via the `parse.lac`
101   %define variable.
103 *** Abort parsing for memory exhaustion (C)
105   User actions may now use `YYNOMEM` (similar to `YYACCEPT` and `YYABORT`)
106   to abort the current parse with memory exhaustion.
108 *** Printing locations in debug traces (C)
110   The `YYLOCATION_PRINT(File, Loc)` macro prints a location.  It is defined
111   when (i) locations are enabled, (ii) the default type for locations is
112   used, (iii) debug traces are enabled, and (iv) `YYLOCATION_PRINT` is not
113   already defined.
115   Users may define `YYLOCATION_PRINT` to cover other cases.
117 *** GLR traces
119   There were no debug traces for deferred calls to user actions.  They are
120   logged now.
123 * Noteworthy changes in release 3.7.6 (2021-03-08) [stable]
125 ** Bug fixes
127 *** Reused Push Parsers
129   When a push-parser state structure is used for multiple parses, it was
130   possible for some state to leak from one run into the following one.
132 *** Fix Table Generation
134   In some very rare conditions, when there are many useless tokens, it was
135   possible to generate incorrect parsers.
138 * Noteworthy changes in release 3.7.5 (2021-01-24) [stable]
140 ** Bug fixes
142 *** Counterexample Generation
144   In some cases counterexample generation could crash.  This is fixed.
146 *** Fix Table Generation
148   In some very rare conditions, when there are many useless tokens, it was
149   possible to generate incorrect parsers.
151 *** GLR parsers now support %merge together with api.value.type=union.
153 *** C++ parsers use noexcept in more places.
155 *** Generated parsers avoid some warnings about signedness issues.
157 *** C-language parsers now avoid warnings from pedantic clang.
159 *** C-language parsers now work around quirks of HP-UX 11.23 (2003).
162 * Noteworthy changes in release 3.7.4 (2020-11-14) [stable]
164 ** Bug fixes
166 *** Bug fixes in yacc.c
168   In Yacc mode, all the tokens are defined twice: once as an enum, and then
169   as a macro.  YYEMPTY was missing its macro.
171 *** Bug fixes in lalr1.cc
173   The lalr1.cc skeleton used to emit internal assertions (using YY_ASSERT)
174   even when the `parse.assert` %define variable is not enabled.  It no
175   longer does.
177   The private internal macro YY_ASSERT now obeys the `api.prefix` %define
178   variable.
180   When there is a very large number of tokens, some assertions could be long
181   enough to hit arbitrary limits in Visual C++.  They have been rewritten to
182   work around this limitation.
184 ** Changes
186   The YYBISON macro in generated "regular C parsers" (from the "yacc.c"
187   skeleton) used to be defined to 1.  It is now defined to the version of
188   Bison as an integer (e.g., 30704 for version 3.7.4).
191 * Noteworthy changes in release 3.7.3 (2020-10-13) [stable]
193 ** Bug fixes
195   Fix concurrent build issues.
197   The bison executable is no longer linked uselessly against libreadline.
199   Fix incorrect use of yytname in glr.cc.
202 * Noteworthy changes in release 3.7.2 (2020-09-05) [stable]
204   This release of Bison fixes all known bugs reported for Bison in MITRE's
205   Common Vulnerabilities and Exposures (CVE) system.  These vulnerabilities
206   are only about bison-the-program itself, not the generated code.
208   Although these bugs are typically irrelevant to how Bison is used, they
209   are worth fixing if only to give users peace of mind.
211   There is no known vulnerability in the generated parsers.
213 ** Bug fixes
215   Fix concurrent build issues (introduced in Bison 3.5).
217   Push parsers always use YYMALLOC/YYFREE (no direct calls to malloc/free).
219   Fix portability issues of the test suite, and of bison itself.
221   Some unlikely crashes found by fuzzing have been fixed.  This is only
222   about bison itself, not the generated parsers.
225 * Noteworthy changes in release 3.7.1 (2020-08-02) [stable]
227 ** Bug fixes
229   Crash when a token alias contains a NUL byte.
231   Portability issues with libtextstyle.
233   Portability issues of Bison itself with MSVC.
235 ** Changes
237   Improvements and fixes in the documentation.
239   More precise location about symbol type redefinitions.
242 * Noteworthy changes in release 3.7 (2020-07-23) [stable]
244 ** Deprecated features
246   The YYPRINT macro, which works only with yacc.c and only for tokens, was
247   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
248   It is deprecated and its support will be removed eventually.
250   In conformance with the recommendations of the Graphviz team, in the next
251   version Bison the option `--graph` will generate a *.gv file by default,
252   instead of *.dot.  A transition started in Bison 3.4.
254 ** New features
256 *** Counterexample Generation
258   Contributed by Vincent Imbimbo.
260   When given `-Wcounterexamples`/`-Wcex`, bison will now output
261   counterexamples for conflicts.
263 **** Unifying Counterexamples
265   Unifying counterexamples are strings which can be parsed in two ways due
266   to the conflict.  For example on a grammar that contains the usual
267   "dangling else" ambiguity:
269     $ bison else.y
270     else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
271     else.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
273     $ bison else.y -Wcex
274     else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
275     else.y: warning: shift/reduce conflict on token "else" [-Wcounterexamples]
276       Example: "if" exp "then" "if" exp "then" exp • "else" exp
277       Shift derivation
278         exp
279         ↳ "if" exp "then" exp
280                           ↳ "if" exp "then" exp • "else" exp
281       Example: "if" exp "then" "if" exp "then" exp • "else" exp
282       Reduce derivation
283         exp
284         ↳ "if" exp "then" exp                     "else" exp
285                           ↳ "if" exp "then" exp •
287   When text styling is enabled, colors are used in the examples and the
288   derivations to highlight the structure of both analyses.  In this case,
290     "if" exp "then" [ "if" exp "then" exp • ] "else" exp
292   vs.
294     "if" exp "then" [ "if" exp "then" exp • "else" exp ]
297   The counterexamples are "focused", in two different ways.  First, they do
298   not clutter the output with all the derivations from the start symbol,
299   rather they start on the "conflicted nonterminal". They go straight to the
300   point.  Second, they don't "expand" nonterminal symbols uselessly.
302 **** Nonunifying Counterexamples
304   In the case of the dangling else, Bison found an example that can be
305   parsed in two ways (therefore proving that the grammar is ambiguous).
306   When it cannot find such an example, it instead generates two examples
307   that are the same up until the dot:
309     $ bison foo.y
310     foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
311     foo.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
312     foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
313         4 | a: expr
314           |    ^~~~
316     $ bison -Wcex foo.y
317     foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
318     foo.y: warning: shift/reduce conflict on token ID [-Wcounterexamples]
319       First example: expr • ID ',' ID $end
320       Shift derivation
321         $accept
322         ↳ s                      $end
323           ↳ a                 ID
324             ↳ expr
325               ↳ expr • ID ','
326       Second example: expr • ID $end
327       Reduce derivation
328         $accept
329         ↳ s             $end
330           ↳ a        ID
331             ↳ expr •
332     foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
333         4 | a: expr
334           |    ^~~~
336   In these cases, the parser usually doesn't have enough lookahead to
337   differentiate the two given examples.
339 **** Reports
341   Counterexamples are also included in the report when given
342   `--report=counterexamples`/`-rcex` (or `--report=all`), with more
343   technical details:
345     State 7
347       1 exp: "if" exp "then" exp •  [$end, "then", "else"]
348       2    | "if" exp "then" exp • "else" exp
350       "else"  shift, and go to state 8
352       "else"    [reduce using rule 1 (exp)]
353       $default  reduce using rule 1 (exp)
355       shift/reduce conflict on token "else":
356           1 exp: "if" exp "then" exp •
357           2 exp: "if" exp "then" exp • "else" exp
358         Example: "if" exp "then" "if" exp "then" exp • "else" exp
359         Shift derivation
360           exp
361           ↳ "if" exp "then" exp
362                             ↳ "if" exp "then" exp • "else" exp
363         Example: "if" exp "then" "if" exp "then" exp • "else" exp
364         Reduce derivation
365           exp
366           ↳ "if" exp "then" exp                     "else" exp
367                             ↳ "if" exp "then" exp •
369 *** File prefix mapping
371   Contributed by Joshua Watt.
373   Bison learned a new argument, `--file-prefix-map OLD=NEW`.  Any file path
374   in the output (specifically `#line` directives and `#ifdef` header guards)
375   that begins with the prefix OLD will have it replaced with the prefix NEW,
376   similar to the `-ffile-prefix-map` in GCC.  This option can be used to
377   make bison output reproducible.
379 ** Changes
381 *** Diagnostics
383   When text styling is enabled and the terminal supports it, the warnings
384   now include hyperlinks to the documentation.
386 *** Relocatable installation
388   When installed to be relocatable (via `configure --enable-relocatable`),
389   bison will now also look for a relocated m4.
391 *** C++ file names
393   The `filename_type` %define variable was renamed `api.filename.type`.
394   Instead of
396     %define filename_type "symbol"
398   write
400     %define api.filename.type {symbol}
402   (Or let `bison --update` do it for you).
404   It now defaults to `const std::string` instead of `std::string`.
406 *** Deprecated %define variable names
408   The following variables have been renamed for consistency.  Backward
409   compatibility is ensured, but upgrading is recommended.
411     filename_type       -> api.filename.type
412     package             -> api.package
414 *** Push parsers no longer clear their state when parsing is finished
416   Previously push-parsers cleared their state when parsing was finished (on
417   success and on failure).  This made it impossible to check if there were
418   parse errors, since `yynerrs` was also reset.  This can be especially
419   troublesome when used in autocompletion, since a parser with error
420   recovery would suggest (irrelevant) expected tokens even if there were
421   failures.
423   Now the parser state can be examined when parsing is finished.  The parser
424   state is reset when starting a new parse.
426 ** Documentation
428 *** Examples
430   The bistromathic demonstrates %param and how to quote sources in the error
431   messages:
433     > 123 456
434     1.5-7: syntax error: expected end of file or + or - or * or / or ^ before number
435         1 | 123 456
436           |     ^~~
438 ** Bug fixes
440 *** Include the generated header (yacc.c)
442   Historically, when --defines was used, bison generated a header and pasted
443   an exact copy of it into the generated parser implementation file.  Since
444   Bison 3.4 it is possible to specify that the header should be `#include`d,
445   and how.  For instance
447     %define api.header.include {"parse.h"}
449   or
451     %define api.header.include {<parser/parse.h>}
453   Now api.header.include defaults to `"header-basename"`, as was intended in
454   Bison 3.4, where `header-basename` is the basename of the generated
455   header.  This is disabled when the generated header is `y.tab.h`, to
456   comply with Automake's ylwrap.
458 *** String aliases are faithfully propagated
460   Bison used to interpret user strings (i.e., decoding backslash escapes)
461   when reading them, and to escape them (i.e., issue non-printable
462   characters as backslash escapes, taking the locale into account) when
463   outputting them.  As a consequence non-ASCII strings (say in UTF-8) ended
464   up "ciphered" as sequences of backslash escapes.  This happened not only
465   in the generated sources (where the compiler will reinterpret them), but
466   also in all the generated reports (text, xml, html, dot, etc.).  Reports
467   were therefore not readable when string aliases were not pure ASCII.
468   Worse yet: the output depended on the user's locale.
470   Now Bison faithfully treats the string aliases exactly the way the user
471   spelled them.  This fixes all the aforementioned problems.  However, now,
472   string aliases semantically equivalent but syntactically different (e.g.,
473   "A", "\x41", "\101") are considered to be different.
475 *** Crash when generating IELR
477   An old, well hidden, bug in the generation of IELR parsers was fixed.
480 * Noteworthy changes in release 3.6.4 (2020-06-15) [stable]
482 ** Bug fixes
484   In glr.cc some internal macros leaked in the user's code, and could damage
485   access to the token kinds.
488 * Noteworthy changes in release 3.6.3 (2020-06-03) [stable]
490 ** Bug fixes
492   Incorrect comments in the generated parsers.
494   Warnings in push parsers (yacc.c).
496   Incorrect display of gotos in LAC traces (lalr1.cc).
499 * Noteworthy changes in release 3.6.2 (2020-05-17) [stable]
501 ** Bug fixes
503   Some tests were fixed.
505   When token aliases contain comment delimiters:
507     %token FOO "/* foo */"
509   bison used to emit "nested" comments, which is invalid C.
512 * Noteworthy changes in release 3.6.1 (2020-05-10) [stable]
514 ** Bug fixes
516   Restored ANSI-C compliance in yacc.c.
518   GNU readline portability issues.
520   In C++, yy::parser::symbol_name is now a public member, as was intended.
522 ** New features
524   In C++, yy::parser::symbol_type now has a public name() member function.
527 * Noteworthy changes in release 3.6 (2020-05-08) [stable]
529 ** Backward incompatible changes
531   TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose".
533   The YYERROR_VERBOSE macro is no longer supported; the parsers that still
534   depend on it will now produce Yacc-like error messages (just "syntax
535   error").  It was superseded by the "%error-verbose" directive in Bison
536   1.875 (2003-01-01).  Bison 2.6 (2012-07-19) clearly announced that support
537   for YYERROR_VERBOSE would be removed.  Note that since Bison 3.0
538   (2013-07-25), "%error-verbose" is deprecated in favor of "%define
539   parse.error verbose".
541 ** Deprecated features
543   The YYPRINT macro, which works only with yacc.c and only for tokens, was
544   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
545   It is deprecated and its support will be removed eventually.
547 ** New features
549 *** Improved syntax error messages
551   Two new values for the %define parse.error variable offer more control to
552   the user.  Available in all the skeletons (C, C++, Java).
554 **** %define parse.error detailed
556   The behavior of "%define parse.error detailed" is closely resembling that
557   of "%define parse.error verbose" with a few exceptions.  First, it is safe
558   to use non-ASCII characters in token aliases (with 'verbose', the result
559   depends on the locale with which bison was run).  Second, a yysymbol_name
560   function is exposed to the user, instead of the yytnamerr function and the
561   yytname table.  Third, token internationalization is supported (see
562   below).
564 **** %define parse.error custom
566   With this directive, the user forges and emits the syntax error message
567   herself by defining the yyreport_syntax_error function.  A new type,
568   yypcontext_t, captures the circumstances of the error, and provides the
569   user with functions to get details, such as yypcontext_expected_tokens to
570   get the list of expected token kinds.
572   A possible implementation of yyreport_syntax_error is:
574     int
575     yyreport_syntax_error (const yypcontext_t *ctx)
576     {
577       int res = 0;
578       YY_LOCATION_PRINT (stderr, *yypcontext_location (ctx));
579       fprintf (stderr, ": syntax error");
580       // Report the tokens expected at this point.
581       {
582         enum { TOKENMAX = 10 };
583         yysymbol_kind_t expected[TOKENMAX];
584         int n = yypcontext_expected_tokens (ctx, expected, TOKENMAX);
585         if (n < 0)
586           // Forward errors to yyparse.
587           res = n;
588         else
589           for (int i = 0; i < n; ++i)
590             fprintf (stderr, "%s %s",
591                      i == 0 ? ": expected" : " or", yysymbol_name (expected[i]));
592       }
593       // Report the unexpected token.
594       {
595         yysymbol_kind_t lookahead = yypcontext_token (ctx);
596         if (lookahead != YYSYMBOL_YYEMPTY)
597           fprintf (stderr, " before %s", yysymbol_name (lookahead));
598       }
599       fprintf (stderr, "\n");
600       return res;
601     }
603 **** Token aliases internationalization
605   When the %define variable parse.error is set to `custom` or `detailed`,
606   one may specify which token aliases are to be translated using _().  For
607   instance
609     %token
610         PLUS   "+"
611         MINUS  "-"
612       <double>
613         NUM _("number")
614       <symrec*>
615         FUN _("function")
616         VAR _("variable")
618   In that case the user must define _() and N_(), and yysymbol_name returns
619   the translated symbol (i.e., it returns '_("variable")' rather that
620   '"variable"').  In Java, the user must provide an i18n() function.
622 *** List of expected tokens (yacc.c)
624   Push parsers may invoke yypstate_expected_tokens at any point during
625   parsing (including even before submitting the first token) to get the list
626   of possible tokens.  This feature can be used to propose autocompletion
627   (see below the "bistromathic" example).
629   It makes little sense to use this feature without enabling LAC (lookahead
630   correction).
632 *** Returning the error token
634   When the scanner returns an invalid token or the undefined token
635   (YYUNDEF), the parser generates an error message and enters error
636   recovery.  Because of that error message, most scanners that find lexical
637   errors generate an error message, and then ignore the invalid input
638   without entering the error-recovery.
640   The scanners may now return YYerror, the error token, to enter the
641   error-recovery mode without triggering an additional error message.  See
642   the bistromathic for an example.
644 *** Deep overhaul of the symbol and token kinds
646   To avoid the confusion with types in programming languages, we now refer
647   to token and symbol "kinds" instead of token and symbol "types".  The
648   documentation and error messages have been revised.
650   All the skeletons have been updated to use dedicated enum types rather
651   than integral types.  Special symbols are now regular citizens, instead of
652   being declared in ad hoc ways.
654 **** Token kinds
656   The "token kind" is what is returned by the scanner, e.g., PLUS, NUMBER,
657   LPAREN, etc.  While backward compatibility is of course ensured, users are
658   nonetheless invited to replace their uses of "enum yytokentype" by
659   "yytoken_kind_t".
661   This type now also includes tokens that were previously hidden: YYEOF (end
662   of input), YYUNDEF (undefined token), and YYerror (error token).  They
663   now have string aliases, internationalized when internationalization is
664   enabled.  Therefore, by default, error messages now refer to "end of file"
665   (internationalized) rather than the cryptic "$end", or to "invalid token"
666   rather than "$undefined".
668   Therefore in most cases it is now useless to define the end-of-line token
669   as follows:
671     %token T_EOF 0 "end of file"
673   Rather simply use "YYEOF" in your scanner.
675 **** Symbol kinds
677   The "symbol kinds" is what the parser actually uses.  (Unless the
678   api.token.raw %define variable is used, the symbol kind of a terminal
679   differs from the corresponding token kind.)
681   They are now exposed as a enum, "yysymbol_kind_t".
683   This allows users to tailor the error messages the way they want, or to
684   process some symbols in a specific way in autocompletion (see the
685   bistromathic example below).
687 *** Modernize display of explanatory statements in diagnostics
689   Since Bison 2.7, output was indented four spaces for explanatory
690   statements.  For example:
692     input.y:2.7-13: error: %type redeclaration for exp
693     input.y:1.7-11:     previous declaration
695   Since the introduction of caret-diagnostics, it became less clear.  This
696   indentation has been removed and submessages are displayed similarly as in
697   GCC:
699     input.y:2.7-13: error: %type redeclaration for exp
700         2 | %type <float> exp
701           |       ^~~~~~~
702     input.y:1.7-11: note: previous declaration
703         1 | %type <int> exp
704           |       ^~~~~
706   Contributed by Victor Morales Cayuela.
708 *** C++
710   The token and symbol kinds are yy::parser::token_kind_type and
711   yy::parser::symbol_kind_type.
713   The symbol_type::kind() member function allows to get the kind of a
714   symbol.  This can be used to write unit tests for scanners, e.g.,
716     yy::parser::symbol_type t = make_NUMBER ("123");
717     assert (t.kind () == yy::parser::symbol_kind::S_NUMBER);
718     assert (t.value.as<int> () == 123);
720 ** Documentation
722 *** User Manual
724   In order to avoid ambiguities with "type" as in "typing", we now refer to
725   the "token kind" (e.g., `PLUS`, `NUMBER`, etc.) rather than the "token
726   type".  We now also refer to the "symbol type" (e.g., `PLUS`, `expr`,
727   etc.).
729 *** Examples
731   There are now examples/java: a very simple calculator, and a more complete
732   one (push-parser, location tracking, and debug traces).
734   The lexcalc example (a simple example in C based on Flex and Bison) now
735   also demonstrates location tracking.
738   A new C example, bistromathic, is a fully featured interactive calculator
739   using many Bison features: pure interface, push parser, autocompletion
740   based on the current parser state (using yypstate_expected_tokens),
741   location tracking, internationalized custom error messages, lookahead
742   correction, rich debug traces, etc.
744   It shows how to depend on the symbol kinds to tailor autocompletion.  For
745   instance it recognizes the symbol kind "VARIABLE" to propose
746   autocompletion on the existing variables, rather than of the word
747   "variable".
750 * Noteworthy changes in release 3.5.4 (2020-04-05) [stable]
752 ** WARNING: Future backward-incompatibilities!
754   TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose".
756   Bison 3.6 will no longer support the YYERROR_VERBOSE macro; the parsers
757   that still depend on it will produce Yacc-like error messages (just
758   "syntax error").  It was superseded by the "%error-verbose" directive in
759   Bison 1.875 (2003-01-01).  Bison 2.6 (2012-07-19) clearly announced that
760   support for YYERROR_VERBOSE would be removed.  Note that since Bison 3.0
761   (2013-07-25), "%error-verbose" is deprecated in favor of "%define
762   parse.error verbose".
764 ** Bug fixes
766   Fix portability issues of the package itself on old compilers.
768   Fix api.token.raw support in Java.
771 * Noteworthy changes in release 3.5.3 (2020-03-08) [stable]
773 ** Bug fixes
775   Error messages could quote lines containing zero-width characters (such as
776   \005) with incorrect styling.  Fixes for similar issues with unexpectedly
777   short lines (e.g., the file was changed between parsing and diagnosing).
779   Some unlikely crashes found by fuzzing have been fixed.  This is only
780   about bison itself, not the generated parsers.
783 * Noteworthy changes in release 3.5.2 (2020-02-13) [stable]
785 ** Bug fixes
787   Portability issues and minor cosmetic issues.
789   The lalr1.cc skeleton properly rejects unsupported values for parse.lac
790   (as yacc.c does).
793 * Noteworthy changes in release 3.5.1 (2020-01-19) [stable]
795 ** Bug fixes
797   Portability fixes.
799   Fix compiler warnings.
802 * Noteworthy changes in release 3.5 (2019-12-11) [stable]
804 ** Backward incompatible changes
806   Lone carriage-return characters (aka \r or ^M) in the grammar files are no
807   longer treated as end-of-lines.  This changes the diagnostics, and in
808   particular their locations.
810   In C++, line numbers and columns are now represented as 'int' not
811   'unsigned', so that integer overflow on positions is easily checkable via
812   'gcc -fsanitize=undefined' and the like.  This affects the API for
813   positions.  The default position and location classes now expose
814   'counter_type' (int), used to define line and column numbers.
816 ** Deprecated features
818   The YYPRINT macro, which works only with yacc.c and only for tokens, was
819   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
820   It is deprecated and its support will be removed eventually.
822 ** New features
824 *** Lookahead correction in C++
826   Contributed by Adrian Vogelsgesang.
828   The C++ deterministic skeleton (lalr1.cc) now supports LAC, via the
829   %define variable parse.lac.
831 *** Variable api.token.raw: Optimized token numbers (all skeletons)
833   In the generated parsers, tokens have two numbers: the "external" token
834   number as returned by yylex (which starts at 257), and the "internal"
835   symbol number (which starts at 3).  Each time yylex is called, a table
836   lookup maps the external token number to the internal symbol number.
838   When the %define variable api.token.raw is set, tokens are assigned their
839   internal number, which saves one table lookup per token, and also saves
840   the generation of the mapping table.
842   The gain is typically moderate, but in extreme cases (very simple user
843   actions), a 10% improvement can be observed.
845 *** Generated parsers use better types for states
847   Stacks now use the best integral type for state numbers, instead of always
848   using 15 bits.  As a result "small" parsers now have a smaller memory
849   footprint (they use 8 bits), and there is support for large automata (16
850   bits), and extra large (using int, i.e., typically 31 bits).
852 *** Generated parsers prefer signed integer types
854   Bison skeletons now prefer signed to unsigned integer types when either
855   will do, as the signed types are less error-prone and allow for better
856   checking with 'gcc -fsanitize=undefined'.  Also, the types chosen are now
857   portable to unusual machines where char, short and int are all the same
858   width.  On non-GNU platforms this may entail including <limits.h> and (if
859   available) <stdint.h> to define integer types and constants.
861 *** A skeleton for the D programming language
863   For the last few releases, Bison has shipped a stealth experimental
864   skeleton: lalr1.d.  It was first contributed by Oliver Mangold, based on
865   Paolo Bonzini's lalr1.java, and was cleaned and improved thanks to
866   H. S. Teoh.
868   However, because nobody has committed to improving, testing, and
869   documenting this skeleton, it is not clear that it will be supported in
870   the future.
872   The lalr1.d skeleton *is functional*, and works well, as demonstrated in
873   examples/d/calc.d.  Please try it, enjoy it, and... commit to support it.
875 *** Debug traces in Java
877   The Java backend no longer emits code and data for parser tracing if the
878   %define variable parse.trace is not defined.
880 ** Diagnostics
882 *** New diagnostic: -Wdangling-alias
884   String literals, which allow for better error messages, are (too)
885   liberally accepted by Bison, which might result in silent errors.  For
886   instance
888     %type <exVal> cond "condition"
890   does not define "condition" as a string alias to 'cond' (nonterminal
891   symbols do not have string aliases).  It is rather equivalent to
893     %nterm <exVal> cond
894     %token <exVal> "condition"
896   i.e., it gives the type 'exVal' to the "condition" token, which was
897   clearly not the intention.
899   Also, because string aliases need not be defined, typos such as "baz"
900   instead of "bar" will be not reported.
902   The option `-Wdangling-alias` catches these situations.  On
904     %token BAR "bar"
905     %type <ival> foo "foo"
906     %%
907     foo: "baz" {}
909   bison -Wdangling-alias reports
911     warning: string literal not attached to a symbol
912           | %type <ival> foo "foo"
913           |                  ^~~~~
914     warning: string literal not attached to a symbol
915           | foo: "baz" {}
916           |      ^~~~~
918    The `-Wall` option does not (yet?) include `-Wdangling-alias`.
920 *** Better POSIX Yacc compatibility diagnostics
922   POSIX Yacc restricts %type to nonterminals.  This is now diagnosed by
923   -Wyacc.
925     %token TOKEN1
926     %type  <ival> TOKEN1 TOKEN2 't'
927     %token TOKEN2
928     %%
929     expr:
931   gives with -Wyacc
933     input.y:2.15-20: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
934         2 | %type  <ival> TOKEN1 TOKEN2 't'
935           |               ^~~~~~
936     input.y:2.29-31: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
937         2 | %type  <ival> TOKEN1 TOKEN2 't'
938           |                             ^~~
939     input.y:2.22-27: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
940         2 | %type  <ival> TOKEN1 TOKEN2 't'
941           |                      ^~~~~~
943 *** Diagnostics with insertion
945   The diagnostics now display the suggestion below the underlined source.
946   Replacement for undeclared symbols are now also suggested.
948     $ cat /tmp/foo.y
949     %%
950     list: lis '.' |
952     $ bison -Wall foo.y
953     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'?
954         2 | list: lis '.' |
955           |       ^~~
956           |       list
957     foo.y:2.16: warning: empty rule without %empty [-Wempty-rule]
958         2 | list: lis '.' |
959           |                ^
960           |                %empty
961     foo.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
963 *** Diagnostics about long lines
965   Quoted sources may now be truncated to fit the screen.  For instance, on a
966   30-column wide terminal:
968     $ cat foo.y
969     %token FOO                       FOO                         FOO
970     %%
971     exp: FOO
972     $ bison foo.y
973     foo.y:1.34-36: warning: symbol FOO redeclared [-Wother]
974         1 | …         FOO                  …
975           |           ^~~
976     foo.y:1.8-10:      previous declaration
977         1 | %token FOO                     …
978           |        ^~~
979     foo.y:1.62-64: warning: symbol FOO redeclared [-Wother]
980         1 | …         FOO
981           |           ^~~
982     foo.y:1.8-10:      previous declaration
983         1 | %token FOO                     …
984           |        ^~~
986 ** Changes
988 *** Debugging glr.c and glr.cc
990   The glr.c skeleton always had asserts to check its own behavior (not the
991   user's).  These assertions are now under the control of the parse.assert
992   %define variable (disabled by default).
994 *** Clean up
996   Several new compiler warnings in the generated output have been avoided.
997   Some unused features are no longer emitted.  Cleaner generated code in
998   general.
1000 ** Bug Fixes
1002   Portability issues in the test suite.
1004   In theory, parsers using %nonassoc could crash when reporting verbose
1005   error messages. This unlikely bug has been fixed.
1007   In Java, %define api.prefix was ignored.  It now behaves as expected.
1010 * Noteworthy changes in release 3.4.2 (2019-09-12) [stable]
1012 ** Bug fixes
1014   In some cases, when warnings are disabled, bison could emit tons of white
1015   spaces as diagnostics.
1017   When running out of memory, bison could crash (found by fuzzing).
1019   When defining twice the EOF token, bison would crash.
1021   New warnings from recent compilers have been addressed in the generated
1022   parsers (yacc.c, glr.c, glr.cc).
1024   When lone carriage-return characters appeared in the input file,
1025   diagnostics could hang forever.
1028 * Noteworthy changes in release 3.4.1 (2019-05-22) [stable]
1030 ** Bug fixes
1032   Portability fixes.
1035 * Noteworthy changes in release 3.4 (2019-05-19) [stable]
1037 ** Deprecated features
1039   The %pure-parser directive is deprecated in favor of '%define api.pure'
1040   since Bison 2.3b (2008-05-27), but no warning was issued; there is one
1041   now.  Note that since Bison 2.7 you are strongly encouraged to use
1042   '%define api.pure full' instead of '%define api.pure'.
1044 ** New features
1046 *** Colored diagnostics
1048   As an experimental feature, diagnostics are now colored, controlled by the
1049   new options --color and --style.
1051   To use them, install the libtextstyle library before configuring Bison.
1052   It is available from
1054     https://alpha.gnu.org/gnu/gettext/
1056   for instance
1058     https://alpha.gnu.org/gnu/gettext/libtextstyle-0.8.tar.gz
1060   The option --color supports the following arguments:
1061     - always, yes: Enable colors.
1062     - never, no: Disable colors.
1063     - auto, tty (default): Enable colors if the output device is a tty.
1065   To customize the styles, create a CSS file similar to
1067     /* bison-bw.css */
1068     .warning   { }
1069     .error     { font-weight: 800; text-decoration: underline; }
1070     .note      { }
1072   then invoke bison with --style=bison-bw.css, or set the BISON_STYLE
1073   environment variable to "bison-bw.css".
1075 *** Disabling output
1077   When given -fsyntax-only, the diagnostics are reported, but no output is
1078   generated.
1080   The name of this option is somewhat misleading as bison does more than
1081   just checking the syntax: every stage is run (including checking for
1082   conflicts for instance), except the generation of the output files.
1084 *** Include the generated header (yacc.c)
1086   Before, when --defines is used, bison generated a header, and pasted an
1087   exact copy of it into the generated parser implementation file.  If the
1088   header name is not "y.tab.h", it is now #included instead of being
1089   duplicated.
1091   To use an '#include' even if the header name is "y.tab.h" (which is what
1092   happens with --yacc, or when using the Autotools' ylwrap), define
1093   api.header.include to the exact argument to pass to #include.  For
1094   instance:
1096     %define api.header.include {"parse.h"}
1098   or
1100     %define api.header.include {<parser/parse.h>}
1102 *** api.location.type is now supported in C (yacc.c, glr.c)
1104   The %define variable api.location.type defines the name of the type to use
1105   for locations.  When defined, Bison no longer defines YYLTYPE.
1107   This can be used in programs with several parsers to factor their
1108   definition of locations: let one of them generate them, and the others
1109   just use them.
1111 ** Changes
1113 *** Graphviz output
1115   In conformance with the recommendations of the Graphviz team, if %require
1116   "3.4" (or better) is specified, the option --graph generates a *.gv file
1117   by default, instead of *.dot.
1119 *** Diagnostics overhaul
1121   Column numbers were wrong with multibyte characters, which would also
1122   result in skewed diagnostics with carets.  Beside, because we were
1123   indenting the quoted source with a single space, lines with tab characters
1124   were incorrectly underlined.
1126   To address these issues, and to be clearer, Bison now issues diagnostics
1127   as GCC9 does.  For instance it used to display (there's a tab before the
1128   opening brace):
1130     foo.y:3.37-38: error: $2 of ‘expr’ has no declared type
1131      expr: expr '+' "number"        { $$ = $1 + $2; }
1132                                          ^~
1133   It now reports
1135     foo.y:3.37-38: error: $2 of ‘expr’ has no declared type
1136         3 | expr: expr '+' "number" { $$ = $1 + $2; }
1137           |                                     ^~
1139   Other constructs now also have better locations, resulting in more precise
1140   diagnostics.
1142 *** Fix-it hints for %empty
1144   Running Bison with -Wempty-rules and --update will remove incorrect %empty
1145   annotations, and add the missing ones.
1147 *** Generated reports
1149   The format of the reports (parse.output) was improved for readability.
1151 *** Better support for --no-line.
1153   When --no-line is used, the generated files are now cleaner: no lines are
1154   generated instead of empty lines.  Together with using api.header.include,
1155   that should help people saving the generated files into version control
1156   systems get smaller diffs.
1158 ** Documentation
1160   A new example in C shows an simple infix calculator with a hand-written
1161   scanner (examples/c/calc).
1163   A new example in C shows a reentrant parser (capable of recursive calls)
1164   built with Flex and Bison (examples/c/reccalc).
1166   There is a new section about the history of Yaccs and Bison.
1168 ** Bug fixes
1170   A few obscure bugs were fixed, including the second oldest (known) bug in
1171   Bison: it was there when Bison was entered in the RCS version control
1172   system, in December 1987.  See the NEWS of Bison 3.3 for the previous
1173   oldest bug.
1176 * Noteworthy changes in release 3.3.2 (2019-02-03) [stable]
1178 ** Bug fixes
1180   Bison 3.3 failed to generate parsers for grammars with unused nonterminal
1181   symbols.
1184 * Noteworthy changes in release 3.3.1 (2019-01-27) [stable]
1186 ** Changes
1188   The option -y/--yacc used to imply -Werror=yacc, which turns uses of Bison
1189   extensions into errors.  It now makes them simple warnings (-Wyacc).
1192 * Noteworthy changes in release 3.3 (2019-01-26) [stable]
1194   A new mailing list was created, Bison Announce.  It is low traffic, and is
1195   only about announcing new releases and important messages (e.g., polls
1196   about major decisions to make).
1198   https://lists.gnu.org/mailman/listinfo/bison-announce
1200 ** Backward incompatible changes
1202   Support for DJGPP, which has been unmaintained and untested for years, is
1203   removed.
1205 ** Deprecated features
1207   A new feature, --update (see below) helps adjusting existing grammars to
1208   deprecations.
1210 *** Deprecated directives
1212   The %error-verbose directive is deprecated in favor of '%define
1213   parse.error verbose' since Bison 3.0, but no warning was issued.
1215   The '%name-prefix "xx"' directive is deprecated in favor of '%define
1216   api.prefix {xx}' since Bison 3.0, but no warning was issued.  These
1217   directives are slightly different, you might need to adjust your code.
1218   %name-prefix renames only symbols with external linkage, while api.prefix
1219   also renames types and macros, including YYDEBUG, YYTOKENTYPE,
1220   yytokentype, YYSTYPE, YYLTYPE, etc.
1222   Users of Flex that move from '%name-prefix "xx"' to '%define api.prefix
1223   {xx}' will typically have to update YY_DECL from
1225     #define YY_DECL int xxlex (YYSTYPE *yylval, YYLTYPE *yylloc)
1227   to
1229     #define YY_DECL int xxlex (XXSTYPE *yylval, XXLTYPE *yylloc)
1231 *** Deprecated %define variable names
1233   The following variables, mostly related to parsers in Java, have been
1234   renamed for consistency.  Backward compatibility is ensured, but upgrading
1235   is recommended.
1237     abstract           -> api.parser.abstract
1238     annotations        -> api.parser.annotations
1239     extends            -> api.parser.extends
1240     final              -> api.parser.final
1241     implements         -> api.parser.implements
1242     parser_class_name  -> api.parser.class
1243     public             -> api.parser.public
1244     strictfp           -> api.parser.strictfp
1246 ** New features
1248 *** Generation of fix-its for IDEs/Editors
1250   When given the new option -ffixit (aka -fdiagnostics-parseable-fixits),
1251   bison now generates machine readable editing instructions to fix some
1252   issues.  Currently, this is mostly limited to updating deprecated
1253   directives and removing duplicates.  For instance:
1255     $ cat foo.y
1256     %error-verbose
1257     %define parser_class_name "Parser"
1258     %define api.parser.class "Parser"
1259     %%
1260     exp:;
1262   See the "fix-it:" lines below:
1264     $ bison -ffixit foo.y
1265     foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated]
1266      %error-verbose
1267      ^~~~~~~~~~~~~~
1268     fix-it:"foo.y":{1:1-1:15}:"%define parse.error verbose"
1269     foo.y:2.1-34: warning: deprecated directive, use '%define api.parser.class {Parser}' [-Wdeprecated]
1270      %define parser_class_name "Parser"
1271      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1272     fix-it:"foo.y":{2:1-2:35}:"%define api.parser.class {Parser}"
1273     foo.y:3.1-33: error: %define variable 'api.parser.class' redefined
1274      %define api.parser.class "Parser"
1275      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1276     foo.y:2.1-34:     previous definition
1277      %define parser_class_name "Parser"
1278      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1279     fix-it:"foo.y":{3:1-3:34}:""
1280     foo.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
1282   This uses the same output format as GCC and Clang.
1284 *** Updating grammar files
1286   Fixes can be applied on the fly.  The previous example ends with the
1287   suggestion to re-run bison with the option -u/--update, which results in a
1288   cleaner grammar file.
1290     $ bison --update foo.y
1291     [...]
1292     bison: file 'foo.y' was updated (backup: 'foo.y~')
1294     $ cat foo.y
1295     %define parse.error verbose
1296     %define api.parser.class {Parser}
1297     %%
1298     exp:;
1300 *** Bison is now relocatable
1302   If you pass '--enable-relocatable' to 'configure', Bison is relocatable.
1304   A relocatable program can be moved or copied to a different location on
1305   the file system.  It can also be used through mount points for network
1306   sharing.  It is possible to make symbolic links to the installed and moved
1307   programs, and invoke them through the symbolic link.
1309 *** %expect and %expect-rr modifiers on individual rules
1311   One can now document (and check) which rules participate in shift/reduce
1312   and reduce/reduce conflicts.  This is particularly important GLR parsers,
1313   where conflicts are a normal occurrence.  For example,
1315       %glr-parser
1316       %expect 1
1317       %%
1319       ...
1321       argument_list:
1322         arguments %expect 1
1323       | arguments ','
1324       | %empty
1325       ;
1327       arguments:
1328         expression
1329       | argument_list ',' expression
1330       ;
1332       ...
1334   Looking at the output from -v, one can see that the shift/reduce conflict
1335   here is due to the fact that the parser does not know whether to reduce
1336   arguments to argument_list until it sees the token _after_ the following
1337   ','.  By marking the rule with %expect 1 (because there is a conflict in
1338   one state), we document the source of the 1 overall shift/reduce conflict.
1340   In GLR parsers, we can use %expect-rr in a rule for reduce/reduce
1341   conflicts.  In this case, we mark each of the conflicting rules.  For
1342   example,
1344       %glr-parser
1345       %expect-rr 1
1347       %%
1349       stmt:
1350         target_list '=' expr ';'
1351       | expr_list ';'
1352       ;
1354       target_list:
1355         target
1356       | target ',' target_list
1357       ;
1359       target:
1360         ID %expect-rr 1
1361       ;
1363       expr_list:
1364         expr
1365       | expr ',' expr_list
1366       ;
1368       expr:
1369         ID %expect-rr 1
1370       | ...
1371       ;
1373   In a statement such as
1375       x, y = 3, 4;
1377   the parser must reduce x to a target or an expr, but does not know which
1378   until it sees the '='.  So we notate the two possible reductions to
1379   indicate that each conflicts in one rule.
1381   This feature needs user feedback, and might evolve in the future.
1383 *** C++: Actual token constructors
1385   When variants and token constructors are enabled, in addition to the
1386   type-safe named token constructors (make_ID, make_INT, etc.), we now
1387   generate genuine constructors for symbol_type.
1389   For instance with these declarations
1391     %token           ':'
1392        <std::string> ID
1393        <int>         INT;
1395   you may use these constructors:
1397     symbol_type (int token, const std::string&);
1398     symbol_type (int token, const int&);
1399     symbol_type (int token);
1401   Correct matching between token types and value types is checked via
1402   'assert'; for instance, 'symbol_type (ID, 42)' would abort.  Named
1403   constructors are preferable, as they offer better type safety (for
1404   instance 'make_ID (42)' would not even compile), but symbol_type
1405   constructors may help when token types are discovered at run-time, e.g.,
1407      [a-z]+   {
1408                 if (auto i = lookup_keyword (yytext))
1409                   return yy::parser::symbol_type (i);
1410                 else
1411                   return yy::parser::make_ID (yytext);
1412               }
1414 *** C++: Variadic emplace
1416   If your application requires C++11 and you don't use symbol constructors,
1417   you may now use a variadic emplace for semantic values:
1419     %define api.value.type variant
1420     %token <std::pair<int, int>> PAIR
1422   in your scanner:
1424     int yylex (parser::semantic_type *lvalp)
1425     {
1426       lvalp->emplace <std::pair<int, int>> (1, 2);
1427       return parser::token::PAIR;
1428     }
1430 *** C++: Syntax error exceptions in GLR
1432   The glr.cc skeleton now supports syntax_error exceptions thrown from user
1433   actions, or from the scanner.
1435 *** More POSIX Yacc compatibility warnings
1437   More Bison specific directives are now reported with -y or -Wyacc.  This
1438   change was ready since the release of Bison 3.0 in September 2015.  It was
1439   delayed because Autoconf used to define YACC as `bison -y`, which resulted
1440   in numerous warnings for Bison users that use the GNU Build System.
1442   If you still experience that problem, either redefine YACC as `bison -o
1443   y.tab.c`, or pass -Wno-yacc to Bison.
1445 *** The tables yyrhs and yyphrs are back
1447   Because no Bison skeleton uses them, these tables were removed (no longer
1448   passed to the skeletons, not even computed) in 2008.  However, some users
1449   have expressed interest in being able to use them in their own skeletons.
1451 ** Bug fixes
1453 *** Incorrect number of reduce/reduce conflicts
1455   On a grammar such as
1457      exp: "num" | "num" | "num"
1459   bison used to report a single RR conflict, instead of two.  This is now
1460   fixed.  This was the oldest (known) bug in Bison: it was there when Bison
1461   was entered in the RCS version control system, in December 1987.
1463   Some grammar files might have to adjust their %expect-rr.
1465 *** Parser directives that were not careful enough
1467   Passing invalid arguments to %nterm, for instance character literals, used
1468   to result in unclear error messages.
1470 ** Documentation
1472   The examples/ directory (installed in .../share/doc/bison/examples) has
1473   been restructured per language for clarity.  The examples come with a
1474   README and a Makefile.  Not only can they be used to toy with Bison, they
1475   can also be starting points for your own grammars.
1477   There is now a Java example, and a simple example in C based on Flex and
1478   Bison (examples/c/lexcalc/).
1480 ** Changes
1482 *** Parsers in C++
1484   They now use noexcept and constexpr.  Please, report missing annotations.
1486 *** Symbol Declarations
1488   The syntax of the variation directives to declare symbols was overhauled
1489   for more consistency, and also better POSIX Yacc compliance (which, for
1490   instance, allows "%type" without actually providing a type).  The %nterm
1491   directive, supported by Bison since its inception, is now documented and
1492   officially supported.
1494   The syntax is now as follows:
1496     %token TAG? ( ID NUMBER? STRING? )+ ( TAG ( ID NUMBER? STRING? )+ )*
1497     %left  TAG? ( ID NUMBER? )+ ( TAG ( ID NUMBER? )+ )*
1498     %type  TAG? ( ID | CHAR | STRING )+ ( TAG ( ID | CHAR | STRING )+ )*
1499     %nterm TAG? ID+ ( TAG ID+ )*
1501   where TAG denotes a type tag such as ‘<ival>’, ID denotes an identifier
1502   such as ‘NUM’, NUMBER a decimal or hexadecimal integer such as ‘300’ or
1503   ‘0x12d’, CHAR a character literal such as ‘'+'’, and STRING a string
1504   literal such as ‘"number"’.  The post-fix quantifiers are ‘?’ (zero or
1505   one), ‘*’ (zero or more) and ‘+’ (one or more).
1508 * Noteworthy changes in release 3.2.4 (2018-12-24) [stable]
1510 ** Bug fixes
1512   Fix the move constructor of symbol_type.
1514   Always provide a copy constructor for symbol_type, even in modern C++.
1517 * Noteworthy changes in release 3.2.3 (2018-12-18) [stable]
1519 ** Bug fixes
1521   Properly support token constructors in C++ with types that include commas
1522   (e.g., std::pair<int, int>).  A regression introduced in Bison 3.2.
1525 * Noteworthy changes in release 3.2.2 (2018-11-21) [stable]
1527 ** Bug fixes
1529   C++ portability issues.
1532 * Noteworthy changes in release 3.2.1 (2018-11-09) [stable]
1534 ** Bug fixes
1536   Several portability issues have been fixed in the build system, in the
1537   test suite, and in the generated parsers in C++.
1540 * Noteworthy changes in release 3.2 (2018-10-29) [stable]
1542 ** Backward incompatible changes
1544   Support for DJGPP, which has been unmaintained and untested for years, is
1545   obsolete.  Unless there is activity to revive it, it will be removed.
1547 ** Changes
1549   %printers should use yyo rather than yyoutput to denote the output stream.
1551   Variant-based symbols in C++ should use emplace() rather than build().
1553   In C++ parsers, parser::operator() is now a synonym for the parser::parse.
1555 ** Documentation
1557   A new section, "A Simple C++ Example", is a tutorial for parsers in C++.
1559   A comment in the generated code now emphasizes that users should not
1560   depend upon non-documented implementation details, such as macros starting
1561   with YY_.
1563 ** New features
1565 *** C++: Support for move semantics (lalr1.cc)
1567   The lalr1.cc skeleton now fully supports C++ move semantics, while
1568   maintaining compatibility with C++98.  You may now store move-only types
1569   when using Bison's variants.  For instance:
1571     %code {
1572       #include <memory>
1573       #include <vector>
1574     }
1576     %skeleton "lalr1.cc"
1577     %define api.value.type variant
1579     %%
1581     %token <int> INT "int";
1582     %type <std::unique_ptr<int>> int;
1583     %type <std::vector<std::unique_ptr<int>>> list;
1585     list:
1586       %empty    {}
1587     | list int  { $$ = std::move($1); $$.emplace_back(std::move($2)); }
1589     int: "int"  { $$ = std::make_unique<int>($1); }
1591 *** C++: Implicit move of right-hand side values (lalr1.cc)
1593   In modern C++ (C++11 and later), you should always use 'std::move' with
1594   the values of the right-hand side symbols ($1, $2, etc.), as they will be
1595   popped from the stack anyway.  Using 'std::move' is mandatory for
1596   move-only types such as unique_ptr, and it provides a significant speedup
1597   for large types such as std::string, or std::vector, etc.
1599   If '%define api.value.automove' is set, every occurrence '$n' is replaced
1600   by 'std::move ($n)'.  The second rule in the previous grammar can be
1601   simplified to:
1603     list: list int  { $$ = $1; $$.emplace_back($2); }
1605   With automove enabled, the semantic values are no longer lvalues, so do
1606   not use the swap idiom:
1608     list: list int  { std::swap($$, $1); $$.emplace_back($2); }
1610   This idiom is anyway obsolete: it is preferable to move than to swap.
1612   A warning is issued when automove is enabled, and a value is used several
1613   times.
1615     input.yy:16.31-32: warning: multiple occurrences of $2 with api.value.automove enabled [-Wother]
1616     exp: "twice" exp   { $$ = $2 + $2; }
1617                                    ^^
1619   Enabling api.value.automove does not require support for modern C++.  The
1620   generated code is valid C++98/03, but will use copies instead of moves.
1622   The new examples/c++/variant-11.yy shows these features in action.
1624 *** C++: The implicit default semantic action is always run
1626   When variants are enabled, the default action was not run, so
1628     exp: "number"
1630   was equivalent to
1632     exp: "number"  {}
1634   It now behaves like in all the other cases, as
1636     exp: "number"  { $$ = $1; }
1638   possibly using std::move if automove is enabled.
1640   We do not expect backward compatibility issues.  However, beware of
1641   forward compatibility issues: if you rely on default actions with
1642   variants, be sure to '%require "3.2"' to avoid older versions of Bison to
1643   generate incorrect parsers.
1645 *** C++: Renaming location.hh
1647   When both %defines and %locations are enabled, Bison generates a
1648   location.hh file.  If you don't use locations outside of the parser, you
1649   may avoid its creation with:
1651     %define api.location.file none
1653   However this file is useful if, for instance, your parser builds an AST
1654   decorated with locations: you may use Bison's location independently of
1655   Bison's parser.  You can now give it another name, for instance:
1657     %define api.location.file "my-location.hh"
1659   This name can have directory components, and even be absolute.  The name
1660   under which the location file is included is controlled by
1661   api.location.include.
1663   This way it is possible to have several parsers share the same location
1664   file.
1666   For instance, in src/foo/parser.hh, generate the include/ast/loc.hh file:
1668     %locations
1669     %define api.namespace {foo}
1670     %define api.location.file "include/ast/loc.hh"
1671     %define api.location.include {<ast/loc.hh>}
1673   and use it in src/bar/parser.hh:
1675     %locations
1676     %define api.namespace {bar}
1677     %code requires {#include <ast/loc.hh>}
1678     %define api.location.type {bar::location}
1680   Absolute file names are supported, so in your Makefile, passing the flag
1681   -Dapi.location.file='"$(top_srcdir)/include/ast/location.hh"' to bison is
1682   safe.
1684 *** C++: stack.hh and position.hh are deprecated
1686   When asked to generate a header file (%defines), the lalr1.cc skeleton
1687   generates a stack.hh file.  This file had no interest for users; it is now
1688   made useless: its content is included in the parser definition.  It is
1689   still generated for backward compatibility.
1691   When in addition to %defines, location support is requested (%locations),
1692   the file position.hh is also generated.  It is now also useless: its
1693   content is now included in location.hh.
1695   These files are no longer generated when your grammar file requires at
1696   least Bison 3.2 (%require "3.2").
1698 ** Bug fixes
1700   Portability issues on MinGW and VS2015.
1702   Portability issues in the test suite.
1704   Portability/warning issues with Flex.
1707 * Noteworthy changes in release 3.1 (2018-08-27) [stable]
1709 ** Backward incompatible changes
1711   Compiling Bison now requires a C99 compiler---as announced during the
1712   release of Bison 3.0, five years ago.  Generated parsers do not require a
1713   C99 compiler.
1715   Support for DJGPP, which has been unmaintained and untested for years, is
1716   obsolete. Unless there is activity to revive it, the next release of Bison
1717   will have it removed.
1719 ** New features
1721 *** Typed midrule actions
1723   Because their type is unknown to Bison, the values of midrule actions are
1724   not treated like the others: they don't have %printer and %destructor
1725   support.  It also prevents C++ (Bison) variants to handle them properly.
1727   Typed midrule actions address these issues.  Instead of:
1729     exp: { $<ival>$ = 1; } { $<ival>$ = 2; }   { $$ = $<ival>1 + $<ival>2; }
1731   write:
1733     exp: <ival>{ $$ = 1; } <ival>{ $$ = 2; }   { $$ = $1 + $2; }
1735 *** Reports include the type of the symbols
1737   The sections about terminal and nonterminal symbols of the '*.output' file
1738   now specify their declared type.  For instance, for:
1740     %token <ival> NUM
1742   the report now shows '<ival>':
1744     Terminals, with rules where they appear
1746     NUM <ival> (258) 5
1748 *** Diagnostics about useless rules
1750   In the following grammar, the 'exp' nonterminal is trivially useless.  So,
1751   of course, its rules are useless too.
1753     %%
1754     input: '0' | exp
1755     exp: exp '+' exp | exp '-' exp | '(' exp ')'
1757   Previously all the useless rules were reported, including those whose
1758   left-hand side is the 'exp' nonterminal:
1760     warning: 1 nonterminal useless in grammar [-Wother]
1761     warning: 4 rules useless in grammar [-Wother]
1762     2.14-16: warning: nonterminal useless in grammar: exp [-Wother]
1763      input: '0' | exp
1764                   ^^^
1765     2.14-16: warning: rule useless in grammar [-Wother]
1766      input: '0' | exp
1767                   ^^^
1768     3.6-16: warning: rule useless in grammar [-Wother]
1769      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1770           ^^^^^^^^^^^
1771     3.20-30: warning: rule useless in grammar [-Wother]
1772      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1773                         ^^^^^^^^^^^
1774     3.34-44: warning: rule useless in grammar [-Wother]
1775      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1776                                       ^^^^^^^^^^^
1778   Now, rules whose left-hand side symbol is useless are no longer reported
1779   as useless.  The locations of the errors have also been adjusted to point
1780   to the first use of the nonterminal as a left-hand side of a rule:
1782     warning: 1 nonterminal useless in grammar [-Wother]
1783     warning: 4 rules useless in grammar [-Wother]
1784     3.1-3: warning: nonterminal useless in grammar: exp [-Wother]
1785      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1786      ^^^
1787     2.14-16: warning: rule useless in grammar [-Wother]
1788      input: '0' | exp
1789                   ^^^
1791 *** C++: Generated parsers can be compiled with -fno-exceptions (lalr1.cc)
1793   When compiled with exceptions disabled, the generated parsers no longer
1794   uses try/catch clauses.
1796   Currently only GCC and Clang are supported.
1798 ** Documentation
1800 *** A demonstration of variants
1802   A new example was added (installed in .../share/doc/bison/examples),
1803   'variant.yy', which shows how to use (Bison) variants in C++.
1805   The other examples were made nicer to read.
1807 *** Some features are no longer 'experimental'
1809   The following features, mature enough, are no longer flagged as
1810   experimental in the documentation: push parsers, default %printer and
1811   %destructor (typed: <*> and untyped: <>), %define api.value.type union and
1812   variant, Java parsers, XML output, LR family (lr, ielr, lalr), and
1813   semantic predicates (%?).
1815 ** Bug fixes
1817 *** GLR: Predicates support broken by #line directives
1819   Predicates (%?) in GLR such as
1821     widget:
1822       %? {new_syntax} 'w' id new_args
1823     | %?{!new_syntax} 'w' id old_args
1825   were issued with #lines in the middle of C code.
1827 *** Printer and destructor with broken #line directives
1829   The #line directives were not properly escaped when emitting the code for
1830   %printer/%destructor, which resulted in compiler errors if there are
1831   backslashes or double-quotes in the grammar file name.
1833 *** Portability on ICC
1835   The Intel compiler claims compatibility with GCC, yet rejects its _Pragma.
1836   Generated parsers now work around this.
1838 *** Various
1840   There were several small fixes in the test suite and in the build system,
1841   many warnings in bison and in the generated parsers were eliminated.  The
1842   documentation also received its share of minor improvements.
1844   Useless code was removed from C++ parsers, and some of the generated
1845   constructors are more 'natural'.
1848 * Noteworthy changes in release 3.0.5 (2018-05-27) [stable]
1850 ** Bug fixes
1852 *** C++: Fix support of 'syntax_error'
1854   One incorrect 'inline' resulted in linking errors about the constructor of
1855   the syntax_error exception.
1857 *** C++: Fix warnings
1859   GCC 7.3 (with -O1 or -O2 but not -O0 or -O3) issued null-dereference
1860   warnings about yyformat being possibly null.  It also warned about the
1861   deprecated implicit definition of copy constructors when there's a
1862   user-defined (copy) assignment operator.
1864 *** Location of errors
1866   In C++ parsers, out-of-bounds errors can happen when a rule with an empty
1867   ride-hand side raises a syntax error.  The behavior of the default parser
1868   (yacc.c) in such a condition was undefined.
1870   Now all the parsers match the behavior of glr.c: @$ is used as the
1871   location of the error.  This handles gracefully rules with and without
1872   rhs.
1874 *** Portability fixes in the test suite
1876   On some platforms, some Java and/or C++ tests were failing.
1879 * Noteworthy changes in release 3.0.4 (2015-01-23) [stable]
1881 ** Bug fixes
1883 *** C++ with Variants (lalr1.cc)
1885   Fix a compiler warning when no %destructor use $$.
1887 *** Test suites
1889   Several portability issues in tests were fixed.
1892 * Noteworthy changes in release 3.0.3 (2015-01-15) [stable]
1894 ** Bug fixes
1896 *** C++ with Variants (lalr1.cc)
1898   Problems with %destructor and '%define parse.assert' have been fixed.
1900 *** Named %union support (yacc.c, glr.c)
1902   Bison 3.0 introduced a regression on named %union such as
1904     %union foo { int ival; };
1906   The possibility to use a name was introduced "for Yacc compatibility".
1907   It is however not required by POSIX Yacc, and its usefulness is not clear.
1909 *** %define api.value.type union with %defines (yacc.c, glr.c)
1911   The C parsers were broken when %defines was used together with "%define
1912   api.value.type union".
1914 *** Redeclarations are reported in proper order
1916   On
1918     %token FOO "foo"
1919     %printer {} "foo"
1920     %printer {} FOO
1922   bison used to report:
1924     foo.yy:2.10-11: error: %printer redeclaration for FOO
1925      %printer {} "foo"
1926               ^^
1927     foo.yy:3.10-11:     previous declaration
1928      %printer {} FOO
1929               ^^
1931   Now, the "previous" declaration is always the first one.
1934 ** Documentation
1936   Bison now installs various files in its docdir (which defaults to
1937   '/usr/local/share/doc/bison'), including the three fully blown examples
1938   extracted from the documentation:
1940    - rpcalc
1941      Reverse Polish Calculator, a simple introductory example.
1942    - mfcalc
1943      Multi-function Calc, a calculator with memory and functions and located
1944      error messages.
1945    - calc++
1946      a calculator in C++ using variant support and token constructors.
1949 * Noteworthy changes in release 3.0.2 (2013-12-05) [stable]
1951 ** Bug fixes
1953 *** Generated source files when errors are reported
1955   When warnings are issued and -Werror is set, bison would still generate
1956   the source files (*.c, *.h...).  As a consequence, some runs of "make"
1957   could fail the first time, but not the second (as the files were generated
1958   anyway).
1960   This is fixed: bison no longer generates this source files, but, of
1961   course, still produces the various reports (*.output, *.xml, etc.).
1963 *** %empty is used in reports
1965   Empty right-hand sides are denoted by '%empty' in all the reports (text,
1966   dot, XML and formats derived from it).
1968 *** YYERROR and variants
1970   When C++ variant support is enabled, an error triggered via YYERROR, but
1971   not caught via error recovery, resulted in a double deletion.
1974 * Noteworthy changes in release 3.0.1 (2013-11-12) [stable]
1976 ** Bug fixes
1978 *** Errors in caret diagnostics
1980   On some platforms, some errors could result in endless diagnostics.
1982 *** Fixes of the -Werror option
1984   Options such as "-Werror -Wno-error=foo" were still turning "foo"
1985   diagnostics into errors instead of warnings.  This is fixed.
1987   Actually, for consistency with GCC, "-Wno-error=foo -Werror" now also
1988   leaves "foo" diagnostics as warnings.  Similarly, with "-Werror=foo
1989   -Wno-error", "foo" diagnostics are now errors.
1991 *** GLR Predicates
1993   As demonstrated in the documentation, one can now leave spaces between
1994   "%?" and its "{".
1996 *** Installation
1998   The yacc.1 man page is no longer installed if --disable-yacc was
1999   specified.
2001 *** Fixes in the test suite
2003   Bugs and portability issues.
2006 * Noteworthy changes in release 3.0 (2013-07-25) [stable]
2008 ** WARNING: Future backward-incompatibilities!
2010   Like other GNU packages, Bison will start using some of the C99 features
2011   for its own code, especially the definition of variables after statements.
2012   The generated C parsers still aim at C90.
2014 ** Backward incompatible changes
2016 *** Obsolete features
2018   Support for YYFAIL is removed (deprecated in Bison 2.4.2): use YYERROR.
2020   Support for yystype and yyltype is removed (deprecated in Bison 1.875):
2021   use YYSTYPE and YYLTYPE.
2023   Support for YYLEX_PARAM and YYPARSE_PARAM is removed (deprecated in Bison
2024   1.875): use %lex-param, %parse-param, or %param.
2026   Missing semicolons at the end of actions are no longer added (as announced
2027   in the release 2.5).
2029 *** Use of YACC='bison -y'
2031   TL;DR: With Autoconf <= 2.69, pass -Wno-yacc to (AM_)YFLAGS if you use
2032   Bison extensions.
2034   Traditional Yacc generates 'y.tab.c' whatever the name of the input file.
2035   Therefore Makefiles written for Yacc expect 'y.tab.c' (and possibly
2036   'y.tab.h' and 'y.output') to be generated from 'foo.y'.
2038   To this end, for ages, AC_PROG_YACC, Autoconf's macro to look for an
2039   implementation of Yacc, was using Bison as 'bison -y'.  While it does
2040   ensure compatible output file names, it also enables warnings for
2041   incompatibilities with POSIX Yacc.  In other words, 'bison -y' triggers
2042   warnings for Bison extensions.
2044   Autoconf 2.70+ fixes this incompatibility by using YACC='bison -o y.tab.c'
2045   (which also generates 'y.tab.h' and 'y.output' when needed).
2046   Alternatively, disable Yacc warnings by passing '-Wno-yacc' to your Yacc
2047   flags (YFLAGS, or AM_YFLAGS with Automake).
2049 ** Bug fixes
2051 *** The epilogue is no longer affected by internal #defines (glr.c)
2053   The glr.c skeleton uses defines such as #define yylval (yystackp->yyval) in
2054   generated code.  These weren't properly undefined before the inclusion of
2055   the user epilogue, so functions such as the following were butchered by the
2056   preprocessor expansion:
2058     int yylex (YYSTYPE *yylval);
2060   This is fixed: yylval, yynerrs, yychar, and yylloc are now valid
2061   identifiers for user-provided variables.
2063 *** stdio.h is no longer needed when locations are enabled (yacc.c)
2065   Changes in Bison 2.7 introduced a dependency on FILE and fprintf when
2066   locations are enabled.  This is fixed.
2068 *** Warnings about useless %pure-parser/%define api.pure are restored
2070 ** Diagnostics reported by Bison
2072   Most of these features were contributed by Théophile Ranquet and Victor
2073   Santet.
2075 *** Carets
2077   Version 2.7 introduced caret errors, for a prettier output.  These are now
2078   activated by default.  The old format can still be used by invoking Bison
2079   with -fno-caret (or -fnone).
2081   Some error messages that reproduced excerpts of the grammar are now using
2082   the caret information only.  For instance on:
2084     %%
2085     exp: 'a' | 'a';
2087   Bison 2.7 reports:
2089     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2090     in.y:2.12-14: warning: rule useless in parser due to conflicts: exp: 'a' [-Wother]
2092   Now bison reports:
2094     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2095     in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
2096      exp: 'a' | 'a';
2097                 ^^^
2099   and "bison -fno-caret" reports:
2101     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2102     in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
2104 *** Enhancements of the -Werror option
2106   The -Werror=CATEGORY option is now recognized, and will treat specified
2107   warnings as errors. The warnings need not have been explicitly activated
2108   using the -W option, this is similar to what GCC 4.7 does.
2110   For example, given the following command line, Bison will treat both
2111   warnings related to POSIX Yacc incompatibilities and S/R conflicts as
2112   errors (and only those):
2114     $ bison -Werror=yacc,error=conflicts-sr input.y
2116   If no categories are specified, -Werror will make all active warnings into
2117   errors. For example, the following line does the same the previous example:
2119     $ bison -Werror -Wnone -Wyacc -Wconflicts-sr input.y
2121   (By default -Wconflicts-sr,conflicts-rr,deprecated,other is enabled.)
2123   Note that the categories in this -Werror option may not be prefixed with
2124   "no-". However, -Wno-error[=CATEGORY] is valid.
2126   Note that -y enables -Werror=yacc. Therefore it is now possible to require
2127   Yacc-like behavior (e.g., always generate y.tab.c), but to report
2128   incompatibilities as warnings: "-y -Wno-error=yacc".
2130 *** The display of warnings is now richer
2132   The option that controls a given warning is now displayed:
2134     foo.y:4.6: warning: type clash on default action: <foo> != <bar> [-Wother]
2136   In the case of warnings treated as errors, the prefix is changed from
2137   "warning: " to "error: ", and the suffix is displayed, in a manner similar
2138   to GCC, as [-Werror=CATEGORY].
2140   For instance, where the previous version of Bison would report (and exit
2141   with failure):
2143     bison: warnings being treated as errors
2144     input.y:1.1: warning: stray ',' treated as white space
2146   it now reports:
2148     input.y:1.1: error: stray ',' treated as white space [-Werror=other]
2150 *** Deprecated constructs
2152   The new 'deprecated' warning category flags obsolete constructs whose
2153   support will be discontinued.  It is enabled by default.  These warnings
2154   used to be reported as 'other' warnings.
2156 *** Useless semantic types
2158   Bison now warns about useless (uninhabited) semantic types.  Since
2159   semantic types are not declared to Bison (they are defined in the opaque
2160   %union structure), it is %printer/%destructor directives about useless
2161   types that trigger the warning:
2163     %token <type1> term
2164     %type  <type2> nterm
2165     %printer    {} <type1> <type3>
2166     %destructor {} <type2> <type4>
2167     %%
2168     nterm: term { $$ = $1; };
2170     3.28-34: warning: type <type3> is used, but is not associated to any symbol
2171     4.28-34: warning: type <type4> is used, but is not associated to any symbol
2173 *** Undefined but unused symbols
2175   Bison used to raise an error for undefined symbols that are not used in
2176   the grammar.  This is now only a warning.
2178     %printer    {} symbol1
2179     %destructor {} symbol2
2180     %type <type>   symbol3
2181     %%
2182     exp: "a";
2184 *** Useless destructors or printers
2186   Bison now warns about useless destructors or printers.  In the following
2187   example, the printer for <type1>, and the destructor for <type2> are
2188   useless: all symbols of <type1> (token1) already have a printer, and all
2189   symbols of type <type2> (token2) already have a destructor.
2191     %token <type1> token1
2192            <type2> token2
2193            <type3> token3
2194            <type4> token4
2195     %printer    {} token1 <type1> <type3>
2196     %destructor {} token2 <type2> <type4>
2198 *** Conflicts
2200   The warnings and error messages about shift/reduce and reduce/reduce
2201   conflicts have been normalized.  For instance on the following foo.y file:
2203     %glr-parser
2204     %%
2205     exp: exp '+' exp | '0' | '0';
2207   compare the previous version of bison:
2209     $ bison foo.y
2210     foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2211     $ bison -Werror foo.y
2212     bison: warnings being treated as errors
2213     foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2215   with the new behavior:
2217     $ bison foo.y
2218     foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
2219     foo.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
2220     $ bison -Werror foo.y
2221     foo.y: error: 1 shift/reduce conflict [-Werror=conflicts-sr]
2222     foo.y: error: 2 reduce/reduce conflicts [-Werror=conflicts-rr]
2224   When %expect or %expect-rr is used, such as with bar.y:
2226     %expect 0
2227     %glr-parser
2228     %%
2229     exp: exp '+' exp | '0' | '0';
2231   Former behavior:
2233     $ bison bar.y
2234     bar.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2235     bar.y: expected 0 shift/reduce conflicts
2236     bar.y: expected 0 reduce/reduce conflicts
2238   New one:
2240     $ bison bar.y
2241     bar.y: error: shift/reduce conflicts: 1 found, 0 expected
2242     bar.y: error: reduce/reduce conflicts: 2 found, 0 expected
2244 ** Incompatibilities with POSIX Yacc
2246   The 'yacc' category is no longer part of '-Wall', enable it explicitly
2247   with '-Wyacc'.
2249 ** Additional yylex/yyparse arguments
2251   The new directive %param declares additional arguments to both yylex and
2252   yyparse.  The %lex-param, %parse-param, and %param directives support one
2253   or more arguments.  Instead of
2255     %lex-param   {arg1_type *arg1}
2256     %lex-param   {arg2_type *arg2}
2257     %parse-param {arg1_type *arg1}
2258     %parse-param {arg2_type *arg2}
2260   one may now declare
2262     %param {arg1_type *arg1} {arg2_type *arg2}
2264 ** Types of values for %define variables
2266   Bison used to make no difference between '%define foo bar' and '%define
2267   foo "bar"'.  The former is now called a 'keyword value', and the latter a
2268   'string value'.  A third kind was added: 'code values', such as '%define
2269   foo {bar}'.
2271   Keyword variables are used for fixed value sets, e.g.,
2273     %define lr.type lalr
2275   Code variables are used for value in the target language, e.g.,
2277     %define api.value.type {struct semantic_type}
2279   String variables are used remaining cases, e.g. file names.
2281 ** Variable api.token.prefix
2283   The variable api.token.prefix changes the way tokens are identified in
2284   the generated files.  This is especially useful to avoid collisions
2285   with identifiers in the target language.  For instance
2287     %token FILE for ERROR
2288     %define api.token.prefix {TOK_}
2289     %%
2290     start: FILE for ERROR;
2292   will generate the definition of the symbols TOK_FILE, TOK_for, and
2293   TOK_ERROR in the generated sources.  In particular, the scanner must
2294   use these prefixed token names, although the grammar itself still
2295   uses the short names (as in the sample rule given above).
2297 ** Variable api.value.type
2299   This new %define variable supersedes the #define macro YYSTYPE.  The use
2300   of YYSTYPE is discouraged.  In particular, #defining YYSTYPE *and* either
2301   using %union or %defining api.value.type results in undefined behavior.
2303   Either define api.value.type, or use "%union":
2305     %union
2306     {
2307       int ival;
2308       char *sval;
2309     }
2310     %token <ival> INT "integer"
2311     %token <sval> STRING "string"
2312     %printer { fprintf (yyo, "%d", $$); } <ival>
2313     %destructor { free ($$); } <sval>
2315     /* In yylex().  */
2316     yylval.ival = 42; return INT;
2317     yylval.sval = "42"; return STRING;
2319   The %define variable api.value.type supports both keyword and code values.
2321   The keyword value 'union' means that the user provides genuine types, not
2322   union member names such as "ival" and "sval" above (WARNING: will fail if
2323   -y/--yacc/%yacc is enabled).
2325     %define api.value.type union
2326     %token <int> INT "integer"
2327     %token <char *> STRING "string"
2328     %printer { fprintf (yyo, "%d", $$); } <int>
2329     %destructor { free ($$); } <char *>
2331     /* In yylex().  */
2332     yylval.INT = 42; return INT;
2333     yylval.STRING = "42"; return STRING;
2335   The keyword value variant is somewhat equivalent, but for C++ special
2336   provision is made to allow classes to be used (more about this below).
2338     %define api.value.type variant
2339     %token <int> INT "integer"
2340     %token <std::string> STRING "string"
2342   Code values (in braces) denote user defined types.  This is where YYSTYPE
2343   used to be used.
2345     %code requires
2346     {
2347       struct my_value
2348       {
2349         enum
2350         {
2351           is_int, is_string
2352         } kind;
2353         union
2354         {
2355           int ival;
2356           char *sval;
2357         } u;
2358       };
2359     }
2360     %define api.value.type {struct my_value}
2361     %token <u.ival> INT "integer"
2362     %token <u.sval> STRING "string"
2363     %printer { fprintf (yyo, "%d", $$); } <u.ival>
2364     %destructor { free ($$); } <u.sval>
2366     /* In yylex().  */
2367     yylval.u.ival = 42; return INT;
2368     yylval.u.sval = "42"; return STRING;
2370 ** Variable parse.error
2372   This variable controls the verbosity of error messages.  The use of the
2373   %error-verbose directive is deprecated in favor of "%define parse.error
2374   verbose".
2376 ** Deprecated %define variable names
2378   The following variables have been renamed for consistency.  Backward
2379   compatibility is ensured, but upgrading is recommended.
2381     lr.default-reductions      -> lr.default-reduction
2382     lr.keep-unreachable-states -> lr.keep-unreachable-state
2383     namespace                  -> api.namespace
2384     stype                      -> api.value.type
2386 ** Semantic predicates
2388   Contributed by Paul Hilfinger.
2390   The new, experimental, semantic-predicate feature allows actions of the
2391   form "%?{ BOOLEAN-EXPRESSION }", which cause syntax errors (as for
2392   YYERROR) if the expression evaluates to 0, and are evaluated immediately
2393   in GLR parsers, rather than being deferred.  The result is that they allow
2394   the programmer to prune possible parses based on the values of run-time
2395   expressions.
2397 ** The directive %expect-rr is now an error in non GLR mode
2399   It used to be an error only if used in non GLR mode, _and_ if there are
2400   reduce/reduce conflicts.
2402 ** Tokens are numbered in their order of appearance
2404   Contributed by Valentin Tolmer.
2406   With '%token A B', A had a number less than the one of B.  However,
2407   precedence declarations used to generate a reversed order.  This is now
2408   fixed, and introducing tokens with any of %token, %left, %right,
2409   %precedence, or %nonassoc yields the same result.
2411   When mixing declarations of tokens with a literal character (e.g., 'a') or
2412   with an identifier (e.g., B) in a precedence declaration, Bison numbered
2413   the literal characters first.  For example
2415     %right A B 'c' 'd'
2417   would lead to the tokens declared in this order: 'c' 'd' A B.  Again, the
2418   input order is now preserved.
2420   These changes were made so that one can remove useless precedence and
2421   associativity declarations (i.e., map %nonassoc, %left or %right to
2422   %precedence, or to %token) and get exactly the same output.
2424 ** Useless precedence and associativity
2426   Contributed by Valentin Tolmer.
2428   When developing and maintaining a grammar, useless associativity and
2429   precedence directives are common.  They can be a nuisance: new ambiguities
2430   arising are sometimes masked because their conflicts are resolved due to
2431   the extra precedence or associativity information.  Furthermore, it can
2432   hinder the comprehension of a new grammar: one will wonder about the role
2433   of a precedence, where in fact it is useless.  The following changes aim
2434   at detecting and reporting these extra directives.
2436 *** Precedence warning category
2438   A new category of warning, -Wprecedence, was introduced. It flags the
2439   useless precedence and associativity directives.
2441 *** Useless associativity
2443   Bison now warns about symbols with a declared associativity that is never
2444   used to resolve conflicts.  In that case, using %precedence is sufficient;
2445   the parsing tables will remain unchanged.  Solving these warnings may raise
2446   useless precedence warnings, as the symbols no longer have associativity.
2447   For example:
2449     %left '+'
2450     %left '*'
2451     %%
2452     exp:
2453       "number"
2454     | exp '+' "number"
2455     | exp '*' exp
2456     ;
2458   will produce a
2460     warning: useless associativity for '+', use %precedence [-Wprecedence]
2461      %left '+'
2462            ^^^
2464 *** Useless precedence
2466   Bison now warns about symbols with a declared precedence and no declared
2467   associativity (i.e., declared with %precedence), and whose precedence is
2468   never used.  In that case, the symbol can be safely declared with %token
2469   instead, without modifying the parsing tables.  For example:
2471     %precedence '='
2472     %%
2473     exp: "var" '=' "number";
2475   will produce a
2477     warning: useless precedence for '=' [-Wprecedence]
2478      %precedence '='
2479                  ^^^
2481 *** Useless precedence and associativity
2483   In case of both useless precedence and associativity, the issue is flagged
2484   as follows:
2486     %nonassoc '='
2487     %%
2488     exp: "var" '=' "number";
2490   The warning is:
2492     warning: useless precedence and associativity for '=' [-Wprecedence]
2493      %nonassoc '='
2494                ^^^
2496 ** Empty rules
2498   With help from Joel E. Denny and Gabriel Rassoul.
2500   Empty rules (i.e., with an empty right-hand side) can now be explicitly
2501   marked by the new %empty directive.  Using %empty on a non-empty rule is
2502   an error.  The new -Wempty-rule warning reports empty rules without
2503   %empty.  On the following grammar:
2505     %%
2506     s: a b c;
2507     a: ;
2508     b: %empty;
2509     c: 'a' %empty;
2511   bison reports:
2513     3.4-5: warning: empty rule without %empty [-Wempty-rule]
2514      a: {}
2515         ^^
2516     5.8-13: error: %empty on non-empty rule
2517      c: 'a' %empty {};
2518             ^^^^^^
2520 ** Java skeleton improvements
2522   The constants for token names were moved to the Lexer interface.  Also, it
2523   is possible to add code to the parser's constructors using "%code init"
2524   and "%define init_throws".
2525   Contributed by Paolo Bonzini.
2527   The Java skeleton now supports push parsing.
2528   Contributed by Dennis Heimbigner.
2530 ** C++ skeletons improvements
2532 *** The parser header is no longer mandatory (lalr1.cc, glr.cc)
2534   Using %defines is now optional.  Without it, the needed support classes
2535   are defined in the generated parser, instead of additional files (such as
2536   location.hh, position.hh and stack.hh).
2538 *** Locations are no longer mandatory (lalr1.cc, glr.cc)
2540   Both lalr1.cc and glr.cc no longer require %location.
2542 *** syntax_error exception (lalr1.cc)
2544   The C++ parser features a syntax_error exception, which can be
2545   thrown from the scanner or from user rules to raise syntax errors.
2546   This facilitates reporting errors caught in sub-functions (e.g.,
2547   rejecting too large integral literals from a conversion function
2548   used by the scanner, or rejecting invalid combinations from a
2549   factory invoked by the user actions).
2551 *** %define api.value.type variant
2553   This is based on a submission from Michiel De Wilde.  With help
2554   from Théophile Ranquet.
2556   In this mode, complex C++ objects can be used as semantic values.  For
2557   instance:
2559     %token <::std::string> TEXT;
2560     %token <int> NUMBER;
2561     %token SEMICOLON ";"
2562     %type <::std::string> item;
2563     %type <::std::list<std::string>> list;
2564     %%
2565     result:
2566       list  { std::cout << $1 << std::endl; }
2567     ;
2569     list:
2570       %empty        { /* Generates an empty string list. */ }
2571     | list item ";" { std::swap ($$, $1); $$.push_back ($2); }
2572     ;
2574     item:
2575       TEXT    { std::swap ($$, $1); }
2576     | NUMBER  { $$ = string_cast ($1); }
2577     ;
2579 *** %define api.token.constructor
2581   When variants are enabled, Bison can generate functions to build the
2582   tokens.  This guarantees that the token type (e.g., NUMBER) is consistent
2583   with the semantic value (e.g., int):
2585     parser::symbol_type yylex ()
2586     {
2587       parser::location_type loc = ...;
2588       ...
2589       return parser::make_TEXT ("Hello, world!", loc);
2590       ...
2591       return parser::make_NUMBER (42, loc);
2592       ...
2593       return parser::make_SEMICOLON (loc);
2594       ...
2595     }
2597 *** C++ locations
2599   There are operator- and operator-= for 'location'.  Negative line/column
2600   increments can no longer underflow the resulting value.
2603 * Noteworthy changes in release 2.7.1 (2013-04-15) [stable]
2605 ** Bug fixes
2607 *** Fix compiler attribute portability (yacc.c)
2609   With locations enabled, __attribute__ was used unprotected.
2611 *** Fix some compiler warnings (lalr1.cc)
2614 * Noteworthy changes in release 2.7 (2012-12-12) [stable]
2616 ** Bug fixes
2618   Warnings about uninitialized yylloc in yyparse have been fixed.
2620   Restored C90 compliance (yet no report was ever made).
2622 ** Diagnostics are improved
2624   Contributed by Théophile Ranquet.
2626 *** Changes in the format of error messages
2628   This used to be the format of many error reports:
2630     input.y:2.7-12: %type redeclaration for exp
2631     input.y:1.7-12: previous declaration
2633   It is now:
2635     input.y:2.7-12: error: %type redeclaration for exp
2636     input.y:1.7-12:     previous declaration
2638 *** New format for error reports: carets
2640   Caret errors have been added to Bison:
2642     input.y:2.7-12: error: %type redeclaration for exp
2643      %type <sval> exp
2644            ^^^^^^
2645     input.y:1.7-12:     previous declaration
2646      %type <ival> exp
2647            ^^^^^^
2649   or
2651     input.y:3.20-23: error: ambiguous reference: '$exp'
2652      exp: exp '+' exp { $exp = $1 + $3; };
2653                         ^^^^
2654     input.y:3.1-3:       refers to: $exp at $$
2655      exp: exp '+' exp { $exp = $1 + $3; };
2656      ^^^
2657     input.y:3.6-8:       refers to: $exp at $1
2658      exp: exp '+' exp { $exp = $1 + $3; };
2659           ^^^
2660     input.y:3.14-16:     refers to: $exp at $3
2661      exp: exp '+' exp { $exp = $1 + $3; };
2662                   ^^^
2664   The default behavior for now is still not to display these unless
2665   explicitly asked with -fcaret (or -fall). However, in a later release, it
2666   will be made the default behavior (but may still be deactivated with
2667   -fno-caret).
2669 ** New value for %define variable: api.pure full
2671   The %define variable api.pure requests a pure (reentrant) parser. However,
2672   for historical reasons, using it in a location-tracking Yacc parser
2673   resulted in a yyerror function that did not take a location as a
2674   parameter. With this new value, the user may request a better pure parser,
2675   where yyerror does take a location as a parameter (in location-tracking
2676   parsers).
2678   The use of "%define api.pure true" is deprecated in favor of this new
2679   "%define api.pure full".
2681 ** New %define variable: api.location.type (glr.cc, lalr1.cc, lalr1.java)
2683   The %define variable api.location.type defines the name of the type to use
2684   for locations.  When defined, Bison no longer generates the position.hh
2685   and location.hh files, nor does the parser will include them: the user is
2686   then responsible to define her type.
2688   This can be used in programs with several parsers to factor their location
2689   and position files: let one of them generate them, and the others just use
2690   them.
2692   This feature was actually introduced, but not documented, in Bison 2.5,
2693   under the name "location_type" (which is maintained for backward
2694   compatibility).
2696   For consistency, lalr1.java's %define variables location_type and
2697   position_type are deprecated in favor of api.location.type and
2698   api.position.type.
2700 ** Exception safety (lalr1.cc)
2702   The parse function now catches exceptions, uses the %destructors to
2703   release memory (the lookahead symbol and the symbols pushed on the stack)
2704   before re-throwing the exception.
2706   This feature is somewhat experimental.  User feedback would be
2707   appreciated.
2709 ** Graph improvements in DOT and XSLT
2711   Contributed by Théophile Ranquet.
2713   The graphical presentation of the states is more readable: their shape is
2714   now rectangular, the state number is clearly displayed, and the items are
2715   numbered and left-justified.
2717   The reductions are now explicitly represented as transitions to other
2718   diamond shaped nodes.
2720   These changes are present in both --graph output and xml2dot.xsl XSLT
2721   processing, with minor (documented) differences.
2723 ** %language is no longer an experimental feature.
2725   The introduction of this feature, in 2.4, was four years ago. The
2726   --language option and the %language directive are no longer experimental.
2728 ** Documentation
2730   The sections about shift/reduce and reduce/reduce conflicts resolution
2731   have been fixed and extended.
2733   Although introduced more than four years ago, XML and Graphviz reports
2734   were not properly documented.
2736   The translation of midrule actions is now described.
2739 * Noteworthy changes in release 2.6.5 (2012-11-07) [stable]
2741   We consider compiler warnings about Bison generated parsers to be bugs.
2742   Rather than working around them in your own project, please consider
2743   reporting them to us.
2745 ** Bug fixes
2747   Warnings about uninitialized yylval and/or yylloc for push parsers with a
2748   pure interface have been fixed for GCC 4.0 up to 4.8, and Clang 2.9 to
2749   3.2.
2751   Other issues in the test suite have been addressed.
2753   Null characters are correctly displayed in error messages.
2755   When possible, yylloc is correctly initialized before calling yylex.  It
2756   is no longer necessary to initialize it in the %initial-action.
2759 * Noteworthy changes in release 2.6.4 (2012-10-23) [stable]
2761   Bison 2.6.3's --version was incorrect.  This release fixes this issue.
2764 * Noteworthy changes in release 2.6.3 (2012-10-22) [stable]
2766 ** Bug fixes
2768   Bugs and portability issues in the test suite have been fixed.
2770   Some errors in translations have been addressed, and --help now directs
2771   users to the appropriate place to report them.
2773   Stray Info files shipped by accident are removed.
2775   Incorrect definitions of YY_, issued by yacc.c when no parser header is
2776   generated, are removed.
2778   All the generated headers are self-contained.
2780 ** Header guards (yacc.c, glr.c, glr.cc)
2782   In order to avoid collisions, the header guards are now
2783   YY_<PREFIX>_<FILE>_INCLUDED, instead of merely <PREFIX>_<FILE>.
2784   For instance the header generated from
2786     %define api.prefix "calc"
2787     %defines "lib/parse.h"
2789   will use YY_CALC_LIB_PARSE_H_INCLUDED as guard.
2791 ** Fix compiler warnings in the generated parser (yacc.c, glr.c)
2793   The compilation of pure parsers (%define api.pure) can trigger GCC
2794   warnings such as:
2796     input.c: In function 'yyparse':
2797     input.c:1503:12: warning: 'yylval' may be used uninitialized in this
2798                               function [-Wmaybe-uninitialized]
2799        *++yyvsp = yylval;
2800                 ^
2802   This is now fixed; pragmas to avoid these warnings are no longer needed.
2804   Warnings from clang ("equality comparison with extraneous parentheses" and
2805   "function declared 'noreturn' should not return") have also been
2806   addressed.
2809 * Noteworthy changes in release 2.6.2 (2012-08-03) [stable]
2811 ** Bug fixes
2813   Buffer overruns, complaints from Flex, and portability issues in the test
2814   suite have been fixed.
2816 ** Spaces in %lex- and %parse-param (lalr1.cc, glr.cc)
2818   Trailing end-of-lines in %parse-param or %lex-param would result in
2819   invalid C++.  This is fixed.
2821 ** Spurious spaces and end-of-lines
2823   The generated files no longer end (nor start) with empty lines.
2826 * Noteworthy changes in release 2.6.1 (2012-07-30) [stable]
2828  Bison no longer executes user-specified M4 code when processing a grammar.
2830 ** Future Changes
2832   In addition to the removal of the features announced in Bison 2.6, the
2833   next major release will remove the "Temporary hack for adding a semicolon
2834   to the user action", as announced in the release 2.5.  Instead of:
2836     exp: exp "+" exp { $$ = $1 + $3 };
2838   write:
2840     exp: exp "+" exp { $$ = $1 + $3; };
2842 ** Bug fixes
2844 *** Type names are now properly escaped.
2846 *** glr.cc: set_debug_level and debug_level work as expected.
2848 *** Stray @ or $ in actions
2850   While Bison used to warn about stray $ or @ in action rules, it did not
2851   for other actions such as printers, destructors, or initial actions.  It
2852   now does.
2854 ** Type names in actions
2856   For consistency with rule actions, it is now possible to qualify $$ by a
2857   type-name in destructors, printers, and initial actions.  For instance:
2859     %printer { fprintf (yyo, "(%d, %f)", $<ival>$, $<fval>$); } <*> <>;
2861   will display two values for each typed and untyped symbol (provided
2862   that YYSTYPE has both "ival" and "fval" fields).
2865 * Noteworthy changes in release 2.6 (2012-07-19) [stable]
2867 ** Future changes
2869   The next major release of Bison will drop support for the following
2870   deprecated features.  Please report disagreements to bug-bison@gnu.org.
2872 *** K&R C parsers
2874   Support for generating parsers in K&R C will be removed.  Parsers
2875   generated for C support ISO C90, and are tested with ISO C99 and ISO C11
2876   compilers.
2878 *** Features deprecated since Bison 1.875
2880   The definitions of yystype and yyltype will be removed; use YYSTYPE and
2881   YYLTYPE.
2883   YYPARSE_PARAM and YYLEX_PARAM, deprecated in favor of %parse-param and
2884   %lex-param, will no longer be supported.
2886   Support for the preprocessor symbol YYERROR_VERBOSE will be removed, use
2887   %error-verbose.
2889 *** The generated header will be included (yacc.c)
2891   Instead of duplicating the content of the generated header (definition of
2892   YYSTYPE, yyparse declaration etc.), the generated parser will include it,
2893   as is already the case for GLR or C++ parsers.  This change is deferred
2894   because existing versions of ylwrap (e.g., Automake 1.12.1) do not support
2895   it.
2897 ** Generated Parser Headers
2899 *** Guards (yacc.c, glr.c, glr.cc)
2901   The generated headers are now guarded, as is already the case for C++
2902   parsers (lalr1.cc).  For instance, with --defines=foo.h:
2904     #ifndef YY_FOO_H
2905     # define YY_FOO_H
2906     ...
2907     #endif /* !YY_FOO_H  */
2909 *** New declarations (yacc.c, glr.c)
2911   The generated header now declares yydebug and yyparse.  Both honor
2912   --name-prefix=bar_, and yield
2914     int bar_parse (void);
2916   rather than
2918     #define yyparse bar_parse
2919     int yyparse (void);
2921   in order to facilitate the inclusion of several parser headers inside a
2922   single compilation unit.
2924 *** Exported symbols in C++
2926   The symbols YYTOKEN_TABLE and YYERROR_VERBOSE, which were defined in the
2927   header, are removed, as they prevent the possibility of including several
2928   generated headers from a single compilation unit.
2930 *** YYLSP_NEEDED
2932   For the same reasons, the undocumented and unused macro YYLSP_NEEDED is no
2933   longer defined.
2935 ** New %define variable: api.prefix
2937   Now that the generated headers are more complete and properly protected
2938   against multiple inclusions, constant names, such as YYSTYPE are a
2939   problem.  While yyparse and others are properly renamed by %name-prefix,
2940   YYSTYPE, YYDEBUG and others have never been affected by it.  Because it
2941   would introduce backward compatibility issues in projects not expecting
2942   YYSTYPE to be renamed, instead of changing the behavior of %name-prefix,
2943   it is deprecated in favor of a new %define variable: api.prefix.
2945   The following examples compares both:
2947     %name-prefix "bar_"               | %define api.prefix "bar_"
2948     %token <ival> FOO                   %token <ival> FOO
2949     %union { int ival; }                %union { int ival; }
2950     %%                                  %%
2951     exp: 'a';                           exp: 'a';
2953   bison generates:
2955     #ifndef BAR_FOO_H                   #ifndef BAR_FOO_H
2956     # define BAR_FOO_H                  # define BAR_FOO_H
2958     /* Enabling traces.  */             /* Enabling traces.  */
2959     # ifndef YYDEBUG                  | # ifndef BAR_DEBUG
2960                                       > #  if defined YYDEBUG
2961                                       > #   if YYDEBUG
2962                                       > #    define BAR_DEBUG 1
2963                                       > #   else
2964                                       > #    define BAR_DEBUG 0
2965                                       > #   endif
2966                                       > #  else
2967     #  define YYDEBUG 0               | #   define BAR_DEBUG 0
2968                                       > #  endif
2969     # endif                           | # endif
2971     # if YYDEBUG                      | # if BAR_DEBUG
2972     extern int bar_debug;               extern int bar_debug;
2973     # endif                             # endif
2975     /* Tokens.  */                      /* Tokens.  */
2976     # ifndef YYTOKENTYPE              | # ifndef BAR_TOKENTYPE
2977     #  define YYTOKENTYPE             | #  define BAR_TOKENTYPE
2978        enum yytokentype {             |    enum bar_tokentype {
2979          FOO = 258                           FOO = 258
2980        };                                  };
2981     # endif                             # endif
2983     #if ! defined YYSTYPE \           | #if ! defined BAR_STYPE \
2984      && ! defined YYSTYPE_IS_DECLARED |  && ! defined BAR_STYPE_IS_DECLARED
2985     typedef union YYSTYPE             | typedef union BAR_STYPE
2986     {                                   {
2987      int ival;                           int ival;
2988     } YYSTYPE;                        | } BAR_STYPE;
2989     # define YYSTYPE_IS_DECLARED 1    | # define BAR_STYPE_IS_DECLARED 1
2990     #endif                              #endif
2992     extern YYSTYPE bar_lval;          | extern BAR_STYPE bar_lval;
2994     int bar_parse (void);               int bar_parse (void);
2996     #endif /* !BAR_FOO_H  */            #endif /* !BAR_FOO_H  */
2999 * Noteworthy changes in release 2.5.1 (2012-06-05) [stable]
3001 ** Future changes:
3003   The next major release will drop support for generating parsers in K&R C.
3005 ** yacc.c: YYBACKUP works as expected.
3007 ** glr.c improvements:
3009 *** Location support is eliminated when not requested:
3011   GLR parsers used to include location-related code even when locations were
3012   not requested, and therefore not even usable.
3014 *** __attribute__ is preserved:
3016   __attribute__ is no longer disabled when __STRICT_ANSI__ is defined (i.e.,
3017   when -std is passed to GCC).
3019 ** lalr1.java: several fixes:
3021   The Java parser no longer throws ArrayIndexOutOfBoundsException if the
3022   first token leads to a syntax error.  Some minor clean ups.
3024 ** Changes for C++:
3026 *** C++11 compatibility:
3028   C and C++ parsers use "nullptr" instead of "0" when __cplusplus is 201103L
3029   or higher.
3031 *** Header guards
3033   The header files such as "parser.hh", "location.hh", etc. used a constant
3034   name for preprocessor guards, for instance:
3036     #ifndef BISON_LOCATION_HH
3037     # define BISON_LOCATION_HH
3038     ...
3039     #endif // !BISON_LOCATION_HH
3041   The inclusion guard is now computed from "PREFIX/FILE-NAME", where lower
3042   case characters are converted to upper case, and series of
3043   non-alphanumerical characters are converted to an underscore.
3045   With "bison -o lang++/parser.cc", "location.hh" would now include:
3047     #ifndef YY_LANG_LOCATION_HH
3048     # define YY_LANG_LOCATION_HH
3049     ...
3050     #endif // !YY_LANG_LOCATION_HH
3052 *** C++ locations:
3054   The position and location constructors (and their initialize methods)
3055   accept new arguments for line and column.  Several issues in the
3056   documentation were fixed.
3058 ** liby is no longer asking for "rpl_fprintf" on some platforms.
3060 ** Changes in the manual:
3062 *** %printer is documented
3064   The "%printer" directive, supported since at least Bison 1.50, is finally
3065   documented.  The "mfcalc" example is extended to demonstrate it.
3067   For consistency with the C skeletons, the C++ parsers now also support
3068   "yyoutput" (as an alias to "debug_stream ()").
3070 *** Several improvements have been made:
3072   The layout for grammar excerpts was changed to a more compact scheme.
3073   Named references are motivated.  The description of the automaton
3074   description file (*.output) is updated to the current format.  Incorrect
3075   index entries were fixed.  Some other errors were fixed.
3077 ** Building bison:
3079 *** Conflicting prototypes with recent/modified Flex.
3081   Fixed build problems with the current, unreleased, version of Flex, and
3082   some modified versions of 2.5.35, which have modified function prototypes.
3084 *** Warnings during the build procedure have been eliminated.
3086 *** Several portability problems in the test suite have been fixed:
3088   This includes warnings with some compilers, unexpected behavior of tools
3089   such as diff, warning messages from the test suite itself, etc.
3091 *** The install-pdf target works properly:
3093   Running "make install-pdf" (or -dvi, -html, -info, and -ps) no longer
3094   halts in the middle of its course.
3097 * Noteworthy changes in release 2.5 (2011-05-14)
3099 ** Grammar symbol names can now contain non-initial dashes:
3101   Consistently with directives (such as %error-verbose) and with
3102   %define variables (e.g. push-pull), grammar symbol names may contain
3103   dashes in any position except the beginning.  This is a GNU
3104   extension over POSIX Yacc.  Thus, use of this extension is reported
3105   by -Wyacc and rejected in Yacc mode (--yacc).
3107 ** Named references:
3109   Historically, Yacc and Bison have supported positional references
3110   ($n, $$) to allow access to symbol values from inside of semantic
3111   actions code.
3113   Starting from this version, Bison can also accept named references.
3114   When no ambiguity is possible, original symbol names may be used
3115   as named references:
3117     if_stmt : "if" cond_expr "then" then_stmt ';'
3118     { $if_stmt = mk_if_stmt($cond_expr, $then_stmt); }
3120   In the more common case, explicit names may be declared:
3122     stmt[res] : "if" expr[cond] "then" stmt[then] "else" stmt[else] ';'
3123     { $res = mk_if_stmt($cond, $then, $else); }
3125   Location information is also accessible using @name syntax.  When
3126   accessing symbol names containing dots or dashes, explicit bracketing
3127   ($[sym.1]) must be used.
3129   These features are experimental in this version.  More user feedback
3130   will help to stabilize them.
3131   Contributed by Alex Rozenman.
3133 ** IELR(1) and canonical LR(1):
3135   IELR(1) is a minimal LR(1) parser table generation algorithm.  That
3136   is, given any context-free grammar, IELR(1) generates parser tables
3137   with the full language-recognition power of canonical LR(1) but with
3138   nearly the same number of parser states as LALR(1).  This reduction
3139   in parser states is often an order of magnitude.  More importantly,
3140   because canonical LR(1)'s extra parser states may contain duplicate
3141   conflicts in the case of non-LR(1) grammars, the number of conflicts
3142   for IELR(1) is often an order of magnitude less as well.  This can
3143   significantly reduce the complexity of developing of a grammar.
3145   Bison can now generate IELR(1) and canonical LR(1) parser tables in
3146   place of its traditional LALR(1) parser tables, which remain the
3147   default.  You can specify the type of parser tables in the grammar
3148   file with these directives:
3150     %define lr.type lalr
3151     %define lr.type ielr
3152     %define lr.type canonical-lr
3154   The default-reduction optimization in the parser tables can also be
3155   adjusted using "%define lr.default-reductions".  For details on both
3156   of these features, see the new section "Tuning LR" in the Bison
3157   manual.
3159   These features are experimental.  More user feedback will help to
3160   stabilize them.
3162 ** LAC (Lookahead Correction) for syntax error handling
3164   Contributed by Joel E. Denny.
3166   Canonical LR, IELR, and LALR can suffer from a couple of problems
3167   upon encountering a syntax error.  First, the parser might perform
3168   additional parser stack reductions before discovering the syntax
3169   error.  Such reductions can perform user semantic actions that are
3170   unexpected because they are based on an invalid token, and they
3171   cause error recovery to begin in a different syntactic context than
3172   the one in which the invalid token was encountered.  Second, when
3173   verbose error messages are enabled (with %error-verbose or the
3174   obsolete "#define YYERROR_VERBOSE"), the expected token list in the
3175   syntax error message can both contain invalid tokens and omit valid
3176   tokens.
3178   The culprits for the above problems are %nonassoc, default
3179   reductions in inconsistent states, and parser state merging.  Thus,
3180   IELR and LALR suffer the most.  Canonical LR can suffer only if
3181   %nonassoc is used or if default reductions are enabled for
3182   inconsistent states.
3184   LAC is a new mechanism within the parsing algorithm that solves
3185   these problems for canonical LR, IELR, and LALR without sacrificing
3186   %nonassoc, default reductions, or state merging.  When LAC is in
3187   use, canonical LR and IELR behave almost exactly the same for both
3188   syntactically acceptable and syntactically unacceptable input.
3189   While LALR still does not support the full language-recognition
3190   power of canonical LR and IELR, LAC at least enables LALR's syntax
3191   error handling to correctly reflect LALR's language-recognition
3192   power.
3194   Currently, LAC is only supported for deterministic parsers in C.
3195   You can enable LAC with the following directive:
3197     %define parse.lac full
3199   See the new section "LAC" in the Bison manual for additional
3200   details including a few caveats.
3202   LAC is an experimental feature.  More user feedback will help to
3203   stabilize it.
3205 ** %define improvements:
3207 *** Can now be invoked via the command line:
3209   Each of these command-line options
3211     -D NAME[=VALUE]
3212     --define=NAME[=VALUE]
3214     -F NAME[=VALUE]
3215     --force-define=NAME[=VALUE]
3217   is equivalent to this grammar file declaration
3219     %define NAME ["VALUE"]
3221   except that the manner in which Bison processes multiple definitions
3222   for the same NAME differs.  Most importantly, -F and --force-define
3223   quietly override %define, but -D and --define do not.  For further
3224   details, see the section "Bison Options" in the Bison manual.
3226 *** Variables renamed:
3228   The following %define variables
3230     api.push_pull
3231     lr.keep_unreachable_states
3233   have been renamed to
3235     api.push-pull
3236     lr.keep-unreachable-states
3238   The old names are now deprecated but will be maintained indefinitely
3239   for backward compatibility.
3241 *** Values no longer need to be quoted in the grammar file:
3243   If a %define value is an identifier, it no longer needs to be placed
3244   within quotations marks.  For example,
3246     %define api.push-pull "push"
3248   can be rewritten as
3250     %define api.push-pull push
3252 *** Unrecognized variables are now errors not warnings.
3254 *** Multiple invocations for any variable is now an error not a warning.
3256 ** Unrecognized %code qualifiers are now errors not warnings.
3258 ** Character literals not of length one:
3260   Previously, Bison quietly converted all character literals to length
3261   one.  For example, without warning, Bison interpreted the operators in
3262   the following grammar to be the same token:
3264     exp: exp '++'
3265        | exp '+' exp
3266        ;
3268   Bison now warns when a character literal is not of length one.  In
3269   some future release, Bison will start reporting an error instead.
3271 ** Destructor calls fixed for lookaheads altered in semantic actions:
3273   Previously for deterministic parsers in C, if a user semantic action
3274   altered yychar, the parser in some cases used the old yychar value to
3275   determine which destructor to call for the lookahead upon a syntax
3276   error or upon parser return.  This bug has been fixed.
3278 ** C++ parsers use YYRHSLOC:
3280   Similarly to the C parsers, the C++ parsers now define the YYRHSLOC
3281   macro and use it in the default YYLLOC_DEFAULT.  You are encouraged
3282   to use it.  If, for instance, your location structure has "first"
3283   and "last" members, instead of
3285     # define YYLLOC_DEFAULT(Current, Rhs, N)                             \
3286       do                                                                 \
3287         if (N)                                                           \
3288           {                                                              \
3289             (Current).first = (Rhs)[1].location.first;                   \
3290             (Current).last  = (Rhs)[N].location.last;                    \
3291           }                                                              \
3292         else                                                             \
3293           {                                                              \
3294             (Current).first = (Current).last = (Rhs)[0].location.last;   \
3295           }                                                              \
3296       while (false)
3298   use:
3300     # define YYLLOC_DEFAULT(Current, Rhs, N)                             \
3301       do                                                                 \
3302         if (N)                                                           \
3303           {                                                              \
3304             (Current).first = YYRHSLOC (Rhs, 1).first;                   \
3305             (Current).last  = YYRHSLOC (Rhs, N).last;                    \
3306           }                                                              \
3307         else                                                             \
3308           {                                                              \
3309             (Current).first = (Current).last = YYRHSLOC (Rhs, 0).last;   \
3310           }                                                              \
3311       while (false)
3313 ** YYLLOC_DEFAULT in C++:
3315   The default implementation of YYLLOC_DEFAULT used to be issued in
3316   the header file.  It is now output in the implementation file, after
3317   the user %code sections so that its #ifndef guard does not try to
3318   override the user's YYLLOC_DEFAULT if provided.
3320 ** YYFAIL now produces warnings and Java parsers no longer implement it:
3322   YYFAIL has existed for many years as an undocumented feature of
3323   deterministic parsers in C generated by Bison.  More recently, it was
3324   a documented feature of Bison's experimental Java parsers.  As
3325   promised in Bison 2.4.2's NEWS entry, any appearance of YYFAIL in a
3326   semantic action now produces a deprecation warning, and Java parsers
3327   no longer implement YYFAIL at all.  For further details, including a
3328   discussion of how to suppress C preprocessor warnings about YYFAIL
3329   being unused, see the Bison 2.4.2 NEWS entry.
3331 ** Temporary hack for adding a semicolon to the user action:
3333   Previously, Bison appended a semicolon to every user action for
3334   reductions when the output language defaulted to C (specifically, when
3335   neither %yacc, %language, %skeleton, or equivalent command-line
3336   options were specified).  This allowed actions such as
3338     exp: exp "+" exp { $$ = $1 + $3 };
3340   instead of
3342     exp: exp "+" exp { $$ = $1 + $3; };
3344   As a first step in removing this misfeature, Bison now issues a
3345   warning when it appends a semicolon.  Moreover, in cases where Bison
3346   cannot easily determine whether a semicolon is needed (for example, an
3347   action ending with a cpp directive or a braced compound initializer),
3348   it no longer appends one.  Thus, the C compiler might now complain
3349   about a missing semicolon where it did not before.  Future releases of
3350   Bison will cease to append semicolons entirely.
3352 ** Verbose syntax error message fixes:
3354   When %error-verbose or the obsolete "#define YYERROR_VERBOSE" is
3355   specified, syntax error messages produced by the generated parser
3356   include the unexpected token as well as a list of expected tokens.
3357   The effect of %nonassoc on these verbose messages has been corrected
3358   in two ways, but a more complete fix requires LAC, described above:
3360 *** When %nonassoc is used, there can exist parser states that accept no
3361     tokens, and so the parser does not always require a lookahead token
3362     in order to detect a syntax error.  Because no unexpected token or
3363     expected tokens can then be reported, the verbose syntax error
3364     message described above is suppressed, and the parser instead
3365     reports the simpler message, "syntax error".  Previously, this
3366     suppression was sometimes erroneously triggered by %nonassoc when a
3367     lookahead was actually required.  Now verbose messages are
3368     suppressed only when all previous lookaheads have already been
3369     shifted or discarded.
3371 *** Previously, the list of expected tokens erroneously included tokens
3372     that would actually induce a syntax error because conflicts for them
3373     were resolved with %nonassoc in the current parser state.  Such
3374     tokens are now properly omitted from the list.
3376 *** Expected token lists are still often wrong due to state merging
3377     (from LALR or IELR) and default reductions, which can both add
3378     invalid tokens and subtract valid tokens.  Canonical LR almost
3379     completely fixes this problem by eliminating state merging and
3380     default reductions.  However, there is one minor problem left even
3381     when using canonical LR and even after the fixes above.  That is,
3382     if the resolution of a conflict with %nonassoc appears in a later
3383     parser state than the one at which some syntax error is
3384     discovered, the conflicted token is still erroneously included in
3385     the expected token list.  Bison's new LAC implementation,
3386     described above, eliminates this problem and the need for
3387     canonical LR.  However, LAC is still experimental and is disabled
3388     by default.
3390 ** Java skeleton fixes:
3392 *** A location handling bug has been fixed.
3394 *** The top element of each of the value stack and location stack is now
3395     cleared when popped so that it can be garbage collected.
3397 *** Parser traces now print the top element of the stack.
3399 ** -W/--warnings fixes:
3401 *** Bison now properly recognizes the "no-" versions of categories:
3403   For example, given the following command line, Bison now enables all
3404   warnings except warnings for incompatibilities with POSIX Yacc:
3406     bison -Wall,no-yacc gram.y
3408 *** Bison now treats S/R and R/R conflicts like other warnings:
3410   Previously, conflict reports were independent of Bison's normal
3411   warning system.  Now, Bison recognizes the warning categories
3412   "conflicts-sr" and "conflicts-rr".  This change has important
3413   consequences for the -W and --warnings command-line options.  For
3414   example:
3416     bison -Wno-conflicts-sr gram.y  # S/R conflicts not reported
3417     bison -Wno-conflicts-rr gram.y  # R/R conflicts not reported
3418     bison -Wnone            gram.y  # no conflicts are reported
3419     bison -Werror           gram.y  # any conflict is an error
3421   However, as before, if the %expect or %expect-rr directive is
3422   specified, an unexpected number of conflicts is an error, and an
3423   expected number of conflicts is not reported, so -W and --warning
3424   then have no effect on the conflict report.
3426 *** The "none" category no longer disables a preceding "error":
3428   For example, for the following command line, Bison now reports
3429   errors instead of warnings for incompatibilities with POSIX Yacc:
3431     bison -Werror,none,yacc gram.y
3433 *** The "none" category now disables all Bison warnings:
3435   Previously, the "none" category disabled only Bison warnings for
3436   which there existed a specific -W/--warning category.  However,
3437   given the following command line, Bison is now guaranteed to
3438   suppress all warnings:
3440     bison -Wnone gram.y
3442 ** Precedence directives can now assign token number 0:
3444   Since Bison 2.3b, which restored the ability of precedence
3445   directives to assign token numbers, doing so for token number 0 has
3446   produced an assertion failure.  For example:
3448     %left END 0
3450   This bug has been fixed.
3453 * Noteworthy changes in release 2.4.3 (2010-08-05)
3455 ** Bison now obeys -Werror and --warnings=error for warnings about
3456    grammar rules that are useless in the parser due to conflicts.
3458 ** Problems with spawning M4 on at least FreeBSD 8 and FreeBSD 9 have
3459    been fixed.
3461 ** Failures in the test suite for GCC 4.5 have been fixed.
3463 ** Failures in the test suite for some versions of Sun Studio C++ have
3464    been fixed.
3466 ** Contrary to Bison 2.4.2's NEWS entry, it has been decided that
3467    warnings about undefined %prec identifiers will not be converted to
3468    errors in Bison 2.5.  They will remain warnings, which should be
3469    sufficient for POSIX while avoiding backward compatibility issues.
3471 ** Minor documentation fixes.
3474 * Noteworthy changes in release 2.4.2 (2010-03-20)
3476 ** Some portability problems that resulted in failures and livelocks
3477    in the test suite on some versions of at least Solaris, AIX, HP-UX,
3478    RHEL4, and Tru64 have been addressed.  As a result, fatal Bison
3479    errors should no longer cause M4 to report a broken pipe on the
3480    affected platforms.
3482 ** "%prec IDENTIFIER" requires IDENTIFIER to be defined separately.
3484   POSIX specifies that an error be reported for any identifier that does
3485   not appear on the LHS of a grammar rule and that is not defined by
3486   %token, %left, %right, or %nonassoc.  Bison 2.3b and later lost this
3487   error report for the case when an identifier appears only after a
3488   %prec directive.  It is now restored.  However, for backward
3489   compatibility with recent Bison releases, it is only a warning for
3490   now.  In Bison 2.5 and later, it will return to being an error.
3491   [Between the 2.4.2 and 2.4.3 releases, it was decided that this
3492   warning will not be converted to an error in Bison 2.5.]
3494 ** Detection of GNU M4 1.4.6 or newer during configure is improved.
3496 ** Warnings from gcc's -Wundef option about undefined YYENABLE_NLS,
3497    YYLTYPE_IS_TRIVIAL, and __STRICT_ANSI__ in C/C++ parsers are now
3498    avoided.
3500 ** %code is now a permanent feature.
3502   A traditional Yacc prologue directive is written in the form:
3504     %{CODE%}
3506   To provide a more flexible alternative, Bison 2.3b introduced the
3507   %code directive with the following forms for C/C++:
3509     %code          {CODE}
3510     %code requires {CODE}
3511     %code provides {CODE}
3512     %code top      {CODE}
3514   These forms are now considered permanent features of Bison.  See the
3515   %code entries in the section "Bison Declaration Summary" in the Bison
3516   manual for a summary of their functionality.  See the section
3517   "Prologue Alternatives" for a detailed discussion including the
3518   advantages of %code over the traditional Yacc prologue directive.
3520   Bison's Java feature as a whole including its current usage of %code
3521   is still considered experimental.
3523 ** YYFAIL is deprecated and will eventually be removed.
3525   YYFAIL has existed for many years as an undocumented feature of
3526   deterministic parsers in C generated by Bison.  Previously, it was
3527   documented for Bison's experimental Java parsers.  YYFAIL is no longer
3528   documented for Java parsers and is formally deprecated in both cases.
3529   Users are strongly encouraged to migrate to YYERROR, which is
3530   specified by POSIX.
3532   Like YYERROR, you can invoke YYFAIL from a semantic action in order to
3533   induce a syntax error.  The most obvious difference from YYERROR is
3534   that YYFAIL will automatically invoke yyerror to report the syntax
3535   error so that you don't have to.  However, there are several other
3536   subtle differences between YYERROR and YYFAIL, and YYFAIL suffers from
3537   inherent flaws when %error-verbose or "#define YYERROR_VERBOSE" is
3538   used.  For a more detailed discussion, see:
3540     https://lists.gnu.org/r/bison-patches/2009-12/msg00024.html
3542   The upcoming Bison 2.5 will remove YYFAIL from Java parsers, but
3543   deterministic parsers in C will continue to implement it.  However,
3544   because YYFAIL is already flawed, it seems futile to try to make new
3545   Bison features compatible with it.  Thus, during parser generation,
3546   Bison 2.5 will produce a warning whenever it discovers YYFAIL in a
3547   rule action.  In a later release, YYFAIL will be disabled for
3548   %error-verbose and "#define YYERROR_VERBOSE".  Eventually, YYFAIL will
3549   be removed altogether.
3551   There exists at least one case where Bison 2.5's YYFAIL warning will
3552   be a false positive.  Some projects add phony uses of YYFAIL and other
3553   Bison-defined macros for the sole purpose of suppressing C
3554   preprocessor warnings (from GCC cpp's -Wunused-macros, for example).
3555   To avoid Bison's future warning, such YYFAIL uses can be moved to the
3556   epilogue (that is, after the second "%%") in the Bison input file.  In
3557   this release (2.4.2), Bison already generates its own code to suppress
3558   C preprocessor warnings for YYFAIL, so projects can remove their own
3559   phony uses of YYFAIL if compatibility with Bison releases prior to
3560   2.4.2 is not necessary.
3562 ** Internationalization.
3564   Fix a regression introduced in Bison 2.4: Under some circumstances,
3565   message translations were not installed although supported by the
3566   host system.
3569 * Noteworthy changes in release 2.4.1 (2008-12-11)
3571 ** In the GLR defines file, unexpanded M4 macros in the yylval and yylloc
3572    declarations have been fixed.
3574 ** Temporary hack for adding a semicolon to the user action.
3576   Bison used to prepend a trailing semicolon at the end of the user
3577   action for reductions.  This allowed actions such as
3579     exp: exp "+" exp { $$ = $1 + $3 };
3581   instead of
3583     exp: exp "+" exp { $$ = $1 + $3; };
3585   Some grammars still depend on this "feature".  Bison 2.4.1 restores
3586   the previous behavior in the case of C output (specifically, when
3587   neither %language or %skeleton or equivalent command-line options
3588   are used) to leave more time for grammars depending on the old
3589   behavior to be adjusted.  Future releases of Bison will disable this
3590   feature.
3592 ** A few minor improvements to the Bison manual.
3595 * Noteworthy changes in release 2.4 (2008-11-02)
3597 ** %language is an experimental feature.
3599   We first introduced this feature in test release 2.3b as a cleaner
3600   alternative to %skeleton.  Since then, we have discussed the possibility of
3601   modifying its effect on Bison's output file names.  Thus, in this release,
3602   we consider %language to be an experimental feature that will likely evolve
3603   in future releases.
3605 ** Forward compatibility with GNU M4 has been improved.
3607 ** Several bugs in the C++ skeleton and the experimental Java skeleton have been
3608   fixed.
3611 * Noteworthy changes in release 2.3b (2008-05-27)
3613 ** The quotes around NAME that used to be required in the following directive
3614   are now deprecated:
3616     %define NAME "VALUE"
3618 ** The directive "%pure-parser" is now deprecated in favor of:
3620     %define api.pure
3622   which has the same effect except that Bison is more careful to warn about
3623   unreasonable usage in the latter case.
3625 ** Push Parsing
3627   Bison can now generate an LALR(1) parser in C with a push interface.  That
3628   is, instead of invoking "yyparse", which pulls tokens from "yylex", you can
3629   push one token at a time to the parser using "yypush_parse", which will
3630   return to the caller after processing each token.  By default, the push
3631   interface is disabled.  Either of the following directives will enable it:
3633     %define api.push_pull "push" // Just push; does not require yylex.
3634     %define api.push_pull "both" // Push and pull; requires yylex.
3636   See the new section "A Push Parser" in the Bison manual for details.
3638   The current push parsing interface is experimental and may evolve.  More user
3639   feedback will help to stabilize it.
3641 ** The -g and --graph options now output graphs in Graphviz DOT format,
3642   not VCG format.  Like --graph, -g now also takes an optional FILE argument
3643   and thus cannot be bundled with other short options.
3645 ** Java
3647   Bison can now generate an LALR(1) parser in Java.  The skeleton is
3648   "data/lalr1.java".  Consider using the new %language directive instead of
3649   %skeleton to select it.
3651   See the new section "Java Parsers" in the Bison manual for details.
3653   The current Java interface is experimental and may evolve.  More user
3654   feedback will help to stabilize it.
3655   Contributed by Paolo Bonzini.
3657 ** %language
3659   This new directive specifies the programming language of the generated
3660   parser, which can be C (the default), C++, or Java.  Besides the skeleton
3661   that Bison uses, the directive affects the names of the generated files if
3662   the grammar file's name ends in ".y".
3664 ** XML Automaton Report
3666   Bison can now generate an XML report of the LALR(1) automaton using the new
3667   "--xml" option.  The current XML schema is experimental and may evolve.  More
3668   user feedback will help to stabilize it.
3669   Contributed by Wojciech Polak.
3671 ** The grammar file may now specify the name of the parser header file using
3672   %defines.  For example:
3674     %defines "parser.h"
3676 ** When reporting useless rules, useless nonterminals, and unused terminals,
3677   Bison now employs the terms "useless in grammar" instead of "useless",
3678   "useless in parser" instead of "never reduced", and "unused in grammar"
3679   instead of "unused".
3681 ** Unreachable State Removal
3683   Previously, Bison sometimes generated parser tables containing unreachable
3684   states.  A state can become unreachable during conflict resolution if Bison
3685   disables a shift action leading to it from a predecessor state.  Bison now:
3687     1. Removes unreachable states.
3689     2. Does not report any conflicts that appeared in unreachable states.
3690        WARNING: As a result, you may need to update %expect and %expect-rr
3691        directives in existing grammar files.
3693     3. For any rule used only in such states, Bison now reports the rule as
3694        "useless in parser due to conflicts".
3696   This feature can be disabled with the following directive:
3698     %define lr.keep_unreachable_states
3700   See the %define entry in the "Bison Declaration Summary" in the Bison manual
3701   for further discussion.
3703 ** Lookahead Set Correction in the ".output" Report
3705   When instructed to generate a ".output" file including lookahead sets
3706   (using "--report=lookahead", for example), Bison now prints each reduction's
3707   lookahead set only next to the associated state's one item that (1) is
3708   associated with the same rule as the reduction and (2) has its dot at the end
3709   of its RHS.  Previously, Bison also erroneously printed the lookahead set
3710   next to all of the state's other items associated with the same rule.  This
3711   bug affected only the ".output" file and not the generated parser source
3712   code.
3714 ** --report-file=FILE is a new option to override the default ".output" file
3715   name.
3717 ** The "=" that used to be required in the following directives is now
3718   deprecated:
3720     %file-prefix "parser"
3721     %name-prefix "c_"
3722     %output "parser.c"
3724 ** An Alternative to "%{...%}" -- "%code QUALIFIER {CODE}"
3726   Bison 2.3a provided a new set of directives as a more flexible alternative to
3727   the traditional Yacc prologue blocks.  Those have now been consolidated into
3728   a single %code directive with an optional qualifier field, which identifies
3729   the purpose of the code and thus the location(s) where Bison should generate
3730   it:
3732     1. "%code          {CODE}" replaces "%after-header  {CODE}"
3733     2. "%code requires {CODE}" replaces "%start-header  {CODE}"
3734     3. "%code provides {CODE}" replaces "%end-header    {CODE}"
3735     4. "%code top      {CODE}" replaces "%before-header {CODE}"
3737   See the %code entries in section "Bison Declaration Summary" in the Bison
3738   manual for a summary of the new functionality.  See the new section "Prologue
3739   Alternatives" for a detailed discussion including the advantages of %code
3740   over the traditional Yacc prologues.
3742   The prologue alternatives are experimental.  More user feedback will help to
3743   determine whether they should become permanent features.
3745 ** Revised warning: unset or unused midrule values
3747   Since Bison 2.2, Bison has warned about midrule values that are set but not
3748   used within any of the actions of the parent rule.  For example, Bison warns
3749   about unused $2 in:
3751     exp: '1' { $$ = 1; } '+' exp { $$ = $1 + $4; };
3753   Now, Bison also warns about midrule values that are used but not set.  For
3754   example, Bison warns about unset $$ in the midrule action in:
3756     exp: '1' { $1 = 1; } '+' exp { $$ = $2 + $4; };
3758   However, Bison now disables both of these warnings by default since they
3759   sometimes prove to be false alarms in existing grammars employing the Yacc
3760   constructs $0 or $-N (where N is some positive integer).
3762   To enable these warnings, specify the option "--warnings=midrule-values" or
3763   "-W", which is a synonym for "--warnings=all".
3765 ** Default %destructor or %printer with "<*>" or "<>"
3767   Bison now recognizes two separate kinds of default %destructor's and
3768   %printer's:
3770     1. Place "<*>" in a %destructor/%printer symbol list to define a default
3771        %destructor/%printer for all grammar symbols for which you have formally
3772        declared semantic type tags.
3774     2. Place "<>" in a %destructor/%printer symbol list to define a default
3775        %destructor/%printer for all grammar symbols without declared semantic
3776        type tags.
3778   Bison no longer supports the "%symbol-default" notation from Bison 2.3a.
3779   "<*>" and "<>" combined achieve the same effect with one exception: Bison no
3780   longer applies any %destructor to a midrule value if that midrule value is
3781   not actually ever referenced using either $$ or $n in a semantic action.
3783   The default %destructor's and %printer's are experimental.  More user
3784   feedback will help to determine whether they should become permanent
3785   features.
3787   See the section "Freeing Discarded Symbols" in the Bison manual for further
3788   details.
3790 ** %left, %right, and %nonassoc can now declare token numbers.  This is required
3791   by POSIX.  However, see the end of section "Operator Precedence" in the Bison
3792   manual for a caveat concerning the treatment of literal strings.
3794 ** The nonfunctional --no-parser, -n, and %no-parser options have been
3795   completely removed from Bison.
3798 * Noteworthy changes in release 2.3a (2006-09-13)
3800 ** Instead of %union, you can define and use your own union type
3801   YYSTYPE if your grammar contains at least one <type> tag.
3802   Your YYSTYPE need not be a macro; it can be a typedef.
3803   This change is for compatibility with other Yacc implementations,
3804   and is required by POSIX.
3806 ** Locations columns and lines start at 1.
3807   In accordance with the GNU Coding Standards and Emacs.
3809 ** You may now declare per-type and default %destructor's and %printer's:
3811   For example:
3813     %union { char *string; }
3814     %token <string> STRING1
3815     %token <string> STRING2
3816     %type  <string> string1
3817     %type  <string> string2
3818     %union { char character; }
3819     %token <character> CHR
3820     %type  <character> chr
3821     %destructor { free ($$); } %symbol-default
3822     %destructor { free ($$); printf ("%d", @$.first_line); } STRING1 string1
3823     %destructor { } <character>
3825   guarantees that, when the parser discards any user-defined symbol that has a
3826   semantic type tag other than "<character>", it passes its semantic value to
3827   "free".  However, when the parser discards a "STRING1" or a "string1", it
3828   also prints its line number to "stdout".  It performs only the second
3829   "%destructor" in this case, so it invokes "free" only once.
3831   [Although we failed to mention this here in the 2.3a release, the default
3832   %destructor's and %printer's were experimental, and they were rewritten in
3833   future versions.]
3835 ** Except for LALR(1) parsers in C with POSIX Yacc emulation enabled (with "-y",
3836   "--yacc", or "%yacc"), Bison no longer generates #define statements for
3837   associating token numbers with token names.  Removing the #define statements
3838   helps to sanitize the global namespace during preprocessing, but POSIX Yacc
3839   requires them.  Bison still generates an enum for token names in all cases.
3841 ** Handling of traditional Yacc prologue blocks is now more consistent but
3842   potentially incompatible with previous releases of Bison.
3844   As before, you declare prologue blocks in your grammar file with the
3845   "%{ ... %}" syntax.  To generate the pre-prologue, Bison concatenates all
3846   prologue blocks that you've declared before the first %union.  To generate
3847   the post-prologue, Bison concatenates all prologue blocks that you've
3848   declared after the first %union.
3850   Previous releases of Bison inserted the pre-prologue into both the header
3851   file and the code file in all cases except for LALR(1) parsers in C.  In the
3852   latter case, Bison inserted it only into the code file.  For parsers in C++,
3853   the point of insertion was before any token definitions (which associate
3854   token numbers with names).  For parsers in C, the point of insertion was
3855   after the token definitions.
3857   Now, Bison never inserts the pre-prologue into the header file.  In the code
3858   file, it always inserts it before the token definitions.
3860 ** Bison now provides a more flexible alternative to the traditional Yacc
3861   prologue blocks: %before-header, %start-header, %end-header, and
3862   %after-header.
3864   For example, the following declaration order in the grammar file reflects the
3865   order in which Bison will output these code blocks.  However, you are free to
3866   declare these code blocks in your grammar file in whatever order is most
3867   convenient for you:
3869     %before-header {
3870       /* Bison treats this block like a pre-prologue block: it inserts it into
3871        * the code file before the contents of the header file.  It does *not*
3872        * insert it into the header file.  This is a good place to put
3873        * #include's that you want at the top of your code file.  A common
3874        * example is '#include "system.h"'.  */
3875     }
3876     %start-header {
3877       /* Bison inserts this block into both the header file and the code file.
3878        * In both files, the point of insertion is before any Bison-generated
3879        * token, semantic type, location type, and class definitions.  This is a
3880        * good place to define %union dependencies, for example.  */
3881     }
3882     %union {
3883       /* Unlike the traditional Yacc prologue blocks, the output order for the
3884        * new %*-header blocks is not affected by their declaration position
3885        * relative to any %union in the grammar file.  */
3886     }
3887     %end-header {
3888       /* Bison inserts this block into both the header file and the code file.
3889        * In both files, the point of insertion is after the Bison-generated
3890        * definitions.  This is a good place to declare or define public
3891        * functions or data structures that depend on the Bison-generated
3892        * definitions.  */
3893     }
3894     %after-header {
3895       /* Bison treats this block like a post-prologue block: it inserts it into
3896        * the code file after the contents of the header file.  It does *not*
3897        * insert it into the header file.  This is a good place to declare or
3898        * define internal functions or data structures that depend on the
3899        * Bison-generated definitions.  */
3900     }
3902   If you have multiple occurrences of any one of the above declarations, Bison
3903   will concatenate the contents in declaration order.
3905   [Although we failed to mention this here in the 2.3a release, the prologue
3906   alternatives were experimental, and they were rewritten in future versions.]
3908 ** The option "--report=look-ahead" has been changed to "--report=lookahead".
3909   The old spelling still works, but is not documented and may be removed
3910   in a future release.
3913 * Noteworthy changes in release 2.3 (2006-06-05)
3915 ** GLR grammars should now use "YYRECOVERING ()" instead of "YYRECOVERING",
3916   for compatibility with LALR(1) grammars.
3918 ** It is now documented that any definition of YYSTYPE or YYLTYPE should
3919   be to a type name that does not contain parentheses or brackets.
3922 * Noteworthy changes in release 2.2 (2006-05-19)
3924 ** The distribution terms for all Bison-generated parsers now permit
3925   using the parsers in nonfree programs.  Previously, this permission
3926   was granted only for Bison-generated LALR(1) parsers in C.
3928 ** %name-prefix changes the namespace name in C++ outputs.
3930 ** The C++ parsers export their token_type.
3932 ** Bison now allows multiple %union declarations, and concatenates
3933   their contents together.
3935 ** New warning: unused values
3936   Right-hand side symbols whose values are not used are reported,
3937   if the symbols have destructors.  For instance:
3939      exp: exp "?" exp ":" exp { $1 ? $1 : $3; }
3940         | exp "+" exp
3941         ;
3943   will trigger a warning about $$ and $5 in the first rule, and $3 in
3944   the second ($1 is copied to $$ by the default rule).  This example
3945   most likely contains three errors, and could be rewritten as:
3947      exp: exp "?" exp ":" exp
3948             { $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); }
3949         | exp "+" exp
3950             { $$ = $1 ? $1 : $3; if ($1) free ($3); }
3951         ;
3953   However, if the original actions were really intended, memory leaks
3954   and all, the warnings can be suppressed by letting Bison believe the
3955   values are used, e.g.:
3957      exp: exp "?" exp ":" exp { $1 ? $1 : $3; (void) ($$, $5); }
3958         | exp "+" exp         { $$ = $1; (void) $3; }
3959         ;
3961   If there are midrule actions, the warning is issued if no action
3962   uses it.  The following triggers no warning: $1 and $3 are used.
3964      exp: exp { push ($1); } '+' exp { push ($3); sum (); };
3966   The warning is intended to help catching lost values and memory leaks.
3967   If a value is ignored, its associated memory typically is not reclaimed.
3969 ** %destructor vs. YYABORT, YYACCEPT, and YYERROR.
3970   Destructors are now called when user code invokes YYABORT, YYACCEPT,
3971   and YYERROR, for all objects on the stack, other than objects
3972   corresponding to the right-hand side of the current rule.
3974 ** %expect, %expect-rr
3975   Incorrect numbers of expected conflicts are now actual errors,
3976   instead of warnings.
3978 ** GLR, YACC parsers.
3979   The %parse-params are available in the destructors (and the
3980   experimental printers) as per the documentation.
3982 ** Bison now warns if it finds a stray "$" or "@" in an action.
3984 ** %require "VERSION"
3985   This specifies that the grammar file depends on features implemented
3986   in Bison version VERSION or higher.
3988 ** lalr1.cc: The token and value types are now class members.
3989   The tokens were defined as free form enums and cpp macros.  YYSTYPE
3990   was defined as a free form union.  They are now class members:
3991   tokens are enumerations of the "yy::parser::token" struct, and the
3992   semantic values have the "yy::parser::semantic_type" type.
3994   If you do not want or can update to this scheme, the directive
3995   '%define "global_tokens_and_yystype" "1"' triggers the global
3996   definition of tokens and YYSTYPE.  This change is suitable both
3997   for previous releases of Bison, and this one.
3999   If you wish to update, then make sure older version of Bison will
4000   fail using '%require "2.2"'.
4002 ** DJGPP support added.
4005 * Noteworthy changes in release 2.1 (2005-09-16)
4007 ** The C++ lalr1.cc skeleton supports %lex-param.
4009 ** Bison-generated parsers now support the translation of diagnostics like
4010   "syntax error" into languages other than English.  The default
4011   language is still English.  For details, please see the new
4012   Internationalization section of the Bison manual.  Software
4013   distributors should also see the new PACKAGING file.  Thanks to
4014   Bruno Haible for this new feature.
4016 ** Wording in the Bison-generated parsers has been changed slightly to
4017   simplify translation.  In particular, the message "memory exhausted"
4018   has replaced "parser stack overflow", as the old message was not
4019   always accurate for modern Bison-generated parsers.
4021 ** Destructors are now called when the parser aborts, for all symbols left
4022   behind on the stack.  Also, the start symbol is now destroyed after a
4023   successful parse.  In both cases, the behavior was formerly inconsistent.
4025 ** When generating verbose diagnostics, Bison-generated parsers no longer
4026   quote the literal strings associated with tokens.  For example, for
4027   a syntax error associated with '%token NUM "number"' they might
4028   print 'syntax error, unexpected number' instead of 'syntax error,
4029   unexpected "number"'.
4032 * Noteworthy changes in release 2.0 (2004-12-25)
4034 ** Possibly-incompatible changes
4036   - Bison-generated parsers no longer default to using the alloca function
4037     (when available) to extend the parser stack, due to widespread
4038     problems in unchecked stack-overflow detection.  You can "#define
4039     YYSTACK_USE_ALLOCA 1" to require the use of alloca, but please read
4040     the manual to determine safe values for YYMAXDEPTH in that case.
4042   - Error token location.
4043     During error recovery, the location of the syntax error is updated
4044     to cover the whole sequence covered by the error token: it includes
4045     the shifted symbols thrown away during the first part of the error
4046     recovery, and the lookahead rejected during the second part.
4048   - Semicolon changes:
4049     . Stray semicolons are no longer allowed at the start of a grammar.
4050     . Semicolons are now required after in-grammar declarations.
4052   - Unescaped newlines are no longer allowed in character constants or
4053     string literals.  They were never portable, and GCC 3.4.0 has
4054     dropped support for them.  Better diagnostics are now generated if
4055     forget a closing quote.
4057   - NUL bytes are no longer allowed in Bison string literals, unfortunately.
4059 ** New features
4061   - GLR grammars now support locations.
4063   - New directive: %initial-action.
4064     This directive allows the user to run arbitrary code (including
4065     initializing @$) from yyparse before parsing starts.
4067   - A new directive "%expect-rr N" specifies the expected number of
4068     reduce/reduce conflicts in GLR parsers.
4070   - %token numbers can now be hexadecimal integers, e.g., "%token FOO 0x12d".
4071     This is a GNU extension.
4073   - The option "--report=lookahead" was changed to "--report=look-ahead".
4074     [However, this was changed back after 2.3.]
4076   - Experimental %destructor support has been added to lalr1.cc.
4078   - New configure option --disable-yacc, to disable installation of the
4079     yacc command and -ly library introduced in 1.875 for POSIX conformance.
4081 ** Bug fixes
4083   - For now, %expect-count violations are now just warnings, not errors.
4084     This is for compatibility with Bison 1.75 and earlier (when there are
4085     reduce/reduce conflicts) and with Bison 1.30 and earlier (when there
4086     are too many or too few shift/reduce conflicts).  However, in future
4087     versions of Bison we plan to improve the %expect machinery so that
4088     these violations will become errors again.
4090   - Within Bison itself, numbers (e.g., goto numbers) are no longer
4091     arbitrarily limited to 16-bit counts.
4093   - Semicolons are now allowed before "|" in grammar rules, as POSIX requires.
4096 * Noteworthy changes in release 1.875 (2003-01-01)
4098 ** The documentation license has been upgraded to version 1.2
4099   of the GNU Free Documentation License.
4101 ** syntax error processing
4103   - In Yacc-style parsers YYLLOC_DEFAULT is now used to compute error
4104     locations too.  This fixes bugs in error-location computation.
4106   - %destructor
4107     It is now possible to reclaim the memory associated to symbols
4108     discarded during error recovery.  This feature is still experimental.
4110   - %error-verbose
4111     This new directive is preferred over YYERROR_VERBOSE.
4113   - #defining yyerror to steal internal variables is discouraged.
4114     It is not guaranteed to work forever.
4116 ** POSIX conformance
4118   - Semicolons are once again optional at the end of grammar rules.
4119     This reverts to the behavior of Bison 1.33 and earlier, and improves
4120     compatibility with Yacc.
4122   - "parse error" -> "syntax error"
4123     Bison now uniformly uses the term "syntax error"; formerly, the code
4124     and manual sometimes used the term "parse error" instead.  POSIX
4125     requires "syntax error" in diagnostics, and it was thought better to
4126     be consistent.
4128   - The documentation now emphasizes that yylex and yyerror must be
4129     declared before use.  C99 requires this.
4131   - Bison now parses C99 lexical constructs like UCNs and
4132     backslash-newline within C escape sequences, as POSIX 1003.1-2001 requires.
4134   - File names are properly escaped in C output.  E.g., foo\bar.y is
4135     output as "foo\\bar.y".
4137   - Yacc command and library now available
4138     The Bison distribution now installs a "yacc" command, as POSIX requires.
4139     Also, Bison now installs a small library liby.a containing
4140     implementations of Yacc-compatible yyerror and main functions.
4141     This library is normally not useful, but POSIX requires it.
4143   - Type clashes now generate warnings, not errors.
4145   - If the user does not define YYSTYPE as a macro, Bison now declares it
4146     using typedef instead of defining it as a macro.
4147     For consistency, YYLTYPE is also declared instead of defined.
4149 ** Other compatibility issues
4151   - %union directives can now have a tag before the "{", e.g., the
4152     directive "%union foo {...}" now generates the C code
4153     "typedef union foo { ... } YYSTYPE;"; this is for Yacc compatibility.
4154     The default union tag is "YYSTYPE", for compatibility with Solaris 9 Yacc.
4155     For consistency, YYLTYPE's struct tag is now "YYLTYPE" not "yyltype".
4156     This is for compatibility with both Yacc and Bison 1.35.
4158   - ";" is output before the terminating "}" of an action, for
4159     compatibility with Bison 1.35.
4161   - Bison now uses a Yacc-style format for conflict reports, e.g.,
4162     "conflicts: 2 shift/reduce, 1 reduce/reduce".
4164   - "yystype" and "yyltype" are now obsolescent macros instead of being
4165     typedefs or tags; they are no longer documented and are planned to be
4166     withdrawn in a future release.
4168 ** GLR parser notes
4170   - GLR and inline
4171     Users of Bison have to decide how they handle the portability of the
4172     C keyword "inline".
4174   - "parsing stack overflow..." -> "parser stack overflow"
4175     GLR parsers now report "parser stack overflow" as per the Bison manual.
4177 ** %parse-param and %lex-param
4178   The macros YYPARSE_PARAM and YYLEX_PARAM provide a means to pass
4179   additional context to yyparse and yylex.  They suffer from several
4180   shortcomings:
4182   - a single argument only can be added,
4183   - their types are weak (void *),
4184   - this context is not passed to ancillary functions such as yyerror,
4185   - only yacc.c parsers support them.
4187   The new %parse-param/%lex-param directives provide a more precise control.
4188   For instance:
4190     %parse-param {int *nastiness}
4191     %lex-param   {int *nastiness}
4192     %parse-param {int *randomness}
4194   results in the following signatures:
4196     int yylex   (int *nastiness);
4197     int yyparse (int *nastiness, int *randomness);
4199   or, if both %pure-parser and %locations are used:
4201     int yylex   (YYSTYPE *lvalp, YYLTYPE *llocp, int *nastiness);
4202     int yyparse (int *nastiness, int *randomness);
4204 ** Bison now warns if it detects conflicting outputs to the same file,
4205   e.g., it generates a warning for "bison -d -o foo.h foo.y" since
4206   that command outputs both code and header to foo.h.
4208 ** #line in output files
4209   - --no-line works properly.
4211 ** Bison can no longer be built by a K&R C compiler; it requires C89 or
4212   later to be built.  This change originally took place a few versions
4213   ago, but nobody noticed until we recently asked someone to try
4214   building Bison with a K&R C compiler.
4217 * Noteworthy changes in release 1.75 (2002-10-14)
4219 ** Bison should now work on 64-bit hosts.
4221 ** Indonesian translation thanks to Tedi Heriyanto.
4223 ** GLR parsers
4224   Fix spurious parse errors.
4226 ** Pure parsers
4227   Some people redefine yyerror to steal yyparse' private variables.
4228   Reenable this trick until an official feature replaces it.
4230 ** Type Clashes
4231   In agreement with POSIX and with other Yaccs, leaving a default
4232   action is valid when $$ is untyped, and $1 typed:
4234         untyped: ... typed;
4236   but the converse remains an error:
4238         typed: ... untyped;
4240 ** Values of midrule actions
4241   The following code:
4243         foo: { ... } { $$ = $1; } ...
4245   was incorrectly rejected: $1 is defined in the second midrule
4246   action, and is equal to the $$ of the first midrule action.
4249 * Noteworthy changes in release 1.50 (2002-10-04)
4251 ** GLR parsing
4252   The declaration
4253      %glr-parser
4254   causes Bison to produce a Generalized LR (GLR) parser, capable of handling
4255   almost any context-free grammar, ambiguous or not.  The new declarations
4256   %dprec and %merge on grammar rules allow parse-time resolution of
4257   ambiguities.  Contributed by Paul Hilfinger.
4259   Unfortunately Bison 1.50 does not work properly on 64-bit hosts
4260   like the Alpha, so please stick to 32-bit hosts for now.
4262 ** Output Directory
4263   When not in Yacc compatibility mode, when the output file was not
4264   specified, running "bison foo/bar.y" created "foo/bar.c".  It
4265   now creates "bar.c".
4267 ** Undefined token
4268   The undefined token was systematically mapped to 2 which prevented
4269   the use of 2 by the user.  This is no longer the case.
4271 ** Unknown token numbers
4272   If yylex returned an out of range value, yyparse could die.  This is
4273   no longer the case.
4275 ** Error token
4276   According to POSIX, the error token must be 256.
4277   Bison extends this requirement by making it a preference: *if* the
4278   user specified that one of her tokens is numbered 256, then error
4279   will be mapped onto another number.
4281 ** Verbose error messages
4282   They no longer report "..., expecting error or..." for states where
4283   error recovery is possible.
4285 ** End token
4286   Defaults to "$end" instead of "$".
4288 ** Error recovery now conforms to documentation and to POSIX
4289   When a Bison-generated parser encounters a syntax error, it now pops
4290   the stack until it finds a state that allows shifting the error
4291   token.  Formerly, it popped the stack until it found a state that
4292   allowed some non-error action other than a default reduction on the
4293   error token.  The new behavior has long been the documented behavior,
4294   and has long been required by POSIX.  For more details, please see
4295   Paul Eggert, "Reductions during Bison error handling" (2002-05-20)
4296   <https://lists.gnu.org/r/bug-bison/2002-05/msg00038.html>.
4298 ** Traces
4299   Popped tokens and nonterminals are now reported.
4301 ** Larger grammars
4302   Larger grammars are now supported (larger token numbers, larger grammar
4303   size (= sum of the LHS and RHS lengths), larger LALR tables).
4304   Formerly, many of these numbers ran afoul of 16-bit limits;
4305   now these limits are 32 bits on most hosts.
4307 ** Explicit initial rule
4308   Bison used to play hacks with the initial rule, which the user does
4309   not write.  It is now explicit, and visible in the reports and
4310   graphs as rule 0.
4312 ** Useless rules
4313   Before, Bison reported the useless rules, but, although not used,
4314   included them in the parsers.  They are now actually removed.
4316 ** Useless rules, useless nonterminals
4317   They are now reported, as a warning, with their locations.
4319 ** Rules never reduced
4320   Rules that can never be reduced because of conflicts are now
4321   reported.
4323 ** Incorrect "Token not used"
4324   On a grammar such as
4326     %token useless useful
4327     %%
4328     exp: '0' %prec useful;
4330   where a token was used to set the precedence of the last rule,
4331   bison reported both "useful" and "useless" as useless tokens.
4333 ** Revert the C++ namespace changes introduced in 1.31
4334   as they caused too many portability hassles.
4336 ** Default locations
4337   By an accident of design, the default computation of @$ was
4338   performed after another default computation was performed: @$ = @1.
4339   The latter is now removed: YYLLOC_DEFAULT is fully responsible of
4340   the computation of @$.
4342 ** Token end-of-file
4343   The token end of file may be specified by the user, in which case,
4344   the user symbol is used in the reports, the graphs, and the verbose
4345   error messages instead of "$end", which remains being the default.
4346   For instance
4347     %token MYEOF 0
4348   or
4349     %token MYEOF 0 "end of file"
4351 ** Semantic parser
4352   This old option, which has been broken for ages, is removed.
4354 ** New translations
4355   Brazilian Portuguese, thanks to Alexandre Folle de Menezes.
4356   Croatian, thanks to Denis Lackovic.
4358 ** Incorrect token definitions
4359   When given
4360     %token 'a' "A"
4361   bison used to output
4362     #define 'a' 65
4364 ** Token definitions as enums
4365   Tokens are output both as the traditional #define's, and, provided
4366   the compiler supports ANSI C or is a C++ compiler, as enums.
4367   This lets debuggers display names instead of integers.
4369 ** Reports
4370   In addition to --verbose, bison supports --report=THINGS, which
4371   produces additional information:
4372   - itemset
4373     complete the core item sets with their closure
4374   - lookahead [changed to "look-ahead" in 1.875e through 2.3, but changed back]
4375     explicitly associate lookahead tokens to items
4376   - solved
4377     describe shift/reduce conflicts solving.
4378     Bison used to systematically output this information on top of
4379     the report.  Solved conflicts are now attached to their states.
4381 ** Type clashes
4382   Previous versions don't complain when there is a type clash on
4383   the default action if the rule has a midrule action, such as in:
4385     %type <foo> bar
4386     %%
4387     bar: '0' {} '0';
4389   This is fixed.
4391 ** GNU M4 is now required when using Bison.
4394 * Noteworthy changes in release 1.35 (2002-03-25)
4396 ** C Skeleton
4397   Some projects use Bison's C parser with C++ compilers, and define
4398   YYSTYPE as a class.  The recent adjustment of C parsers for data
4399   alignment and 64 bit architectures made this impossible.
4401   Because for the time being no real solution for C++ parser
4402   generation exists, kludges were implemented in the parser to
4403   maintain this use.  In the future, when Bison has C++ parsers, this
4404   kludge will be disabled.
4406   This kludge also addresses some C++ problems when the stack was
4407   extended.
4410 * Noteworthy changes in release 1.34 (2002-03-12)
4412 ** File name clashes are detected
4413   $ bison foo.y -d -o foo.x
4414   fatal error: header and parser would both be named "foo.x"
4416 ** A missing ";" at the end of a rule triggers a warning
4417   In accordance with POSIX, and in agreement with other
4418   Yacc implementations, Bison will mandate this semicolon in the near
4419   future.  This eases the implementation of a Bison parser of Bison
4420   grammars by making this grammar LALR(1) instead of LR(2).  To
4421   facilitate the transition, this release introduces a warning.
4423 ** Revert the C++ namespace changes introduced in 1.31, as they caused too
4424   many portability hassles.
4426 ** DJGPP support added.
4428 ** Fix test suite portability problems.
4431 * Noteworthy changes in release 1.33 (2002-02-07)
4433 ** Fix C++ issues
4434   Groff could not be compiled for the definition of size_t was lacking
4435   under some conditions.
4437 ** Catch invalid @n
4438   As is done with $n.
4441 * Noteworthy changes in release 1.32 (2002-01-23)
4443 ** Fix Yacc output file names
4445 ** Portability fixes
4447 ** Italian, Dutch translations
4450 * Noteworthy changes in release 1.31 (2002-01-14)
4452 ** Many Bug Fixes
4454 ** GNU Gettext and %expect
4455   GNU Gettext asserts 10 s/r conflicts, but there are 7.  Now that
4456   Bison dies on incorrect %expectations, we fear there will be
4457   too many bug reports for Gettext, so _for the time being_, %expect
4458   does not trigger an error when the input file is named "plural.y".
4460 ** Use of alloca in parsers
4461   If YYSTACK_USE_ALLOCA is defined to 0, then the parsers will use
4462   malloc exclusively.  Since 1.29, but was not NEWS'ed.
4464   alloca is used only when compiled with GCC, to avoid portability
4465   problems as on AIX.
4467 ** yyparse now returns 2 if memory is exhausted; formerly it dumped core.
4469 ** When the generated parser lacks debugging code, YYDEBUG is now 0
4470   (as POSIX requires) instead of being undefined.
4472 ** User Actions
4473   Bison has always permitted actions such as { $$ = $1 }: it adds the
4474   ending semicolon.  Now if in Yacc compatibility mode, the semicolon
4475   is no longer output: one has to write { $$ = $1; }.
4477 ** Better C++ compliance
4478   The output parsers try to respect C++ namespaces.
4479   [This turned out to be a failed experiment, and it was reverted later.]
4481 ** Reduced Grammars
4482   Fixed bugs when reporting useless nonterminals.
4484 ** 64 bit hosts
4485   The parsers work properly on 64 bit hosts.
4487 ** Error messages
4488   Some calls to strerror resulted in scrambled or missing error messages.
4490 ** %expect
4491   When the number of shift/reduce conflicts is correct, don't issue
4492   any warning.
4494 ** The verbose report includes the rule line numbers.
4496 ** Rule line numbers are fixed in traces.
4498 ** Swedish translation
4500 ** Parse errors
4501   Verbose parse error messages from the parsers are better looking.
4502   Before: parse error: unexpected `'/'', expecting `"number"' or `'-'' or `'(''
4503      Now: parse error: unexpected '/', expecting "number" or '-' or '('
4505 ** Fixed parser memory leaks.
4506   When the generated parser was using malloc to extend its stacks, the
4507   previous allocations were not freed.
4509 ** Fixed verbose output file.
4510   Some newlines were missing.
4511   Some conflicts in state descriptions were missing.
4513 ** Fixed conflict report.
4514   Option -v was needed to get the result.
4516 ** %expect
4517   Was not used.
4518   Mismatches are errors, not warnings.
4520 ** Fixed incorrect processing of some invalid input.
4522 ** Fixed CPP guards: 9foo.h uses BISON_9FOO_H instead of 9FOO_H.
4524 ** Fixed some typos in the documentation.
4526 ** %token MY_EOF 0 is supported.
4527   Before, MY_EOF was silently renumbered as 257.
4529 ** doc/refcard.tex is updated.
4531 ** %output, %file-prefix, %name-prefix.
4532   New.
4534 ** --output
4535   New, aliasing "--output-file".
4538 * Noteworthy changes in release 1.30 (2001-10-26)
4540 ** "--defines" and "--graph" have now an optional argument which is the
4541   output file name. "-d" and "-g" do not change; they do not take any
4542   argument.
4544 ** "%source_extension" and "%header_extension" are removed, failed
4545   experiment.
4547 ** Portability fixes.
4550 * Noteworthy changes in release 1.29 (2001-09-07)
4552 ** The output file does not define const, as this caused problems when used
4553   with common autoconfiguration schemes.  If you still use ancient compilers
4554   that lack const, compile with the equivalent of the C compiler option
4555   "-Dconst=".  Autoconf's AC_C_CONST macro provides one way to do this.
4557 ** Added "-g" and "--graph".
4559 ** The Bison manual is now distributed under the terms of the GNU FDL.
4561 ** The input and the output files has automatically a similar extension.
4563 ** Russian translation added.
4565 ** NLS support updated; should hopefully be less troublesome.
4567 ** Added the old Bison reference card.
4569 ** Added "--locations" and "%locations".
4571 ** Added "-S" and "--skeleton".
4573 ** "%raw", "-r", "--raw" is disabled.
4575 ** Special characters are escaped when output.  This solves the problems
4576   of the #line lines with path names including backslashes.
4578 ** New directives.
4579   "%yacc", "%fixed_output_files", "%defines", "%no_parser", "%verbose",
4580   "%debug", "%source_extension" and "%header_extension".
4582 ** @$
4583   Automatic location tracking.
4586 * Noteworthy changes in release 1.28 (1999-07-06)
4588 ** Should compile better now with K&R compilers.
4590 ** Added NLS.
4592 ** Fixed a problem with escaping the double quote character.
4594 ** There is now a FAQ.
4597 * Noteworthy changes in release 1.27
4599 ** The make rule which prevented bison.simple from being created on
4600   some systems has been fixed.
4603 * Noteworthy changes in release 1.26
4605 ** Bison now uses Automake.
4607 ** New mailing lists: <bug-bison@gnu.org> and <help-bison@gnu.org>.
4609 ** Token numbers now start at 257 as previously documented, not 258.
4611 ** Bison honors the TMPDIR environment variable.
4613 ** A couple of buffer overruns have been fixed.
4615 ** Problems when closing files should now be reported.
4617 ** Generated parsers should now work even on operating systems which do
4618   not provide alloca().
4621 * Noteworthy changes in release 1.25 (1995-10-16)
4623 ** Errors in the input grammar are not fatal; Bison keeps reading
4624 the grammar file, and reports all the errors found in it.
4626 ** Tokens can now be specified as multiple-character strings: for
4627 example, you could use "<=" for a token which looks like <=, instead
4628 of choosing a name like LESSEQ.
4630 ** The %token_table declaration says to write a table of tokens (names
4631 and numbers) into the parser file.  The yylex function can use this
4632 table to recognize multiple-character string tokens, or for other
4633 purposes.
4635 ** The %no_lines declaration says not to generate any #line preprocessor
4636 directives in the parser file.
4638 ** The %raw declaration says to use internal Bison token numbers, not
4639 Yacc-compatible token numbers, when token names are defined as macros.
4641 ** The --no-parser option produces the parser tables without including
4642 the parser engine; a project can now use its own parser engine.
4643 The actions go into a separate file called NAME.act, in the form of
4644 a switch statement body.
4647 * Noteworthy changes in release 1.23
4649 The user can define YYPARSE_PARAM as the name of an argument to be
4650 passed into yyparse.  The argument should have type void *.  It should
4651 actually point to an object.  Grammar actions can access the variable
4652 by casting it to the proper pointer type.
4654 Line numbers in output file corrected.
4657 * Noteworthy changes in release 1.22
4659 --help option added.
4662 * Noteworthy changes in release 1.20
4664 Output file does not redefine const for C++.
4666 -----
4668 LocalWords:  yacc YYBACKUP glr GCC lalr ArrayIndexOutOfBoundsException nullptr
4669 LocalWords:  cplusplus liby rpl fprintf mfcalc Wyacc stmt cond expr mk sym lr
4670 LocalWords:  IELR ielr Lookahead YYERROR nonassoc LALR's api lookaheads yychar
4671 LocalWords:  destructor lookahead YYRHSLOC YYLLOC Rhs ifndef YYFAIL cpp sr rr
4672 LocalWords:  preprocessor initializer Wno Wnone Werror FreeBSD prec livelocks
4673 LocalWords:  Solaris AIX UX RHEL Tru LHS gcc's Wundef YYENABLE NLS YYLTYPE VCG
4674 LocalWords:  yyerror cpp's Wunused yylval yylloc prepend yyparse yylex yypush
4675 LocalWords:  Graphviz xml nonterminals midrule destructor's YYSTYPE typedef ly
4676 LocalWords:  CHR chr printf stdout namespace preprocessing enum pre include's
4677 LocalWords:  YYRECOVERING nonfree destructors YYABORT YYACCEPT params enums de
4678 LocalWords:  struct yystype DJGPP lex param Haible NUM alloca YYSTACK NUL goto
4679 LocalWords:  YYMAXDEPTH Unescaped UCNs YYLTYPE's yyltype typedefs inline Yaccs
4680 LocalWords:  Heriyanto Reenable dprec Hilfinger Eggert MYEOF Folle Menezes EOF
4681 LocalWords:  Lackovic define's itemset Groff Gettext malloc NEWS'ed YYDEBUG YY
4682 LocalWords:  namespaces strerror const autoconfiguration Dconst Autoconf's FDL
4683 LocalWords:  Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
4684 LocalWords:  extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
4685 LocalWords:  lang yyoutput dvi html ps POSIX lvalp llocp Wother nterm arg init
4686 LocalWords:  TOK calc yyo fval Wconflicts parsers yystackp yyval yynerrs
4687 LocalWords:  Théophile Ranquet Santet fno fnone stype associativity Tolmer
4688 LocalWords:  Wprecedence Rassoul Wempty Paolo Bonzini parser's Michiel loc
4689 LocalWords:  redeclaration sval fcaret reentrant XSLT xsl Wmaybe yyvsp Tedi
4690 LocalWords:  pragmas noreturn untyped Rozenman unexpanded Wojciech Polak
4691 LocalWords:  Alexandre MERCHANTABILITY yytype emplace ptr automove lvalues
4692 LocalWords:  nonterminal yy args Pragma dereference yyformat rhs docdir bw
4693 LocalWords:  Redeclarations rpcalc Autoconf YFLAGS Makefiles PROG DECL num
4694 LocalWords:  Heimbigner AST src ast Makefile srcdir MinGW xxlex XXSTYPE CVE
4695 LocalWords:  XXLTYPE strictfp IDEs ffixit fdiagnostics parseable fixits
4696 LocalWords:  Wdeprecated yytext Variadic variadic yyrhs yyphrs RCS README
4697 LocalWords:  noexcept constexpr ispell american deprecations backend Teoh
4698 LocalWords:  YYPRINT Mangold Bonzini's Wdangling exVal baz checkable gcc
4699 LocalWords:  fsanitize Vogelsgesang lis redeclared stdint automata yytname
4700 LocalWords:  yysymbol yytnamerr yyreport ctx ARGMAX yysyntax stderr LPAREN
4701 LocalWords:  symrec yypcontext TOKENMAX yyexpected YYEMPTY yypstate YYEOF
4702 LocalWords:  autocompletion bistromathic submessages Cayuela lexcalc hoc
4703 LocalWords:  yytoken YYUNDEF YYerror basename Automake's UTF ifdef ffile
4704 LocalWords:  gotos readline Imbimbo Wcounterexamples Wcex Nonunifying rcex
4705 LocalWords:  Vais xsltproc YYNOMEM YYLOCATION signedness YYBISON MITRE's
4706 LocalWords:  libreadline YYMALLOC YYFREE MSVC redefinitions
4708 Local Variables:
4709 ispell-dictionary: "american"
4710 mode: outline
4711 fill-column: 76
4712 End:
4714 Copyright (C) 1995-2015, 2018-2021 Free Software Foundation, Inc.
4716 This file is part of Bison, the GNU Parser Generator.
4718 Permission is granted to copy, distribute and/or modify this document
4719 under the terms of the GNU Free Documentation License, Version 1.3 or
4720 any later version published by the Free Software Foundation; with no
4721 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
4722 Texts.  A copy of the license is included in the "GNU Free
4723 Documentation License" file as part of this distribution.