glr: examples: fix locations
[bison.git] / NEWS
blobe12ba6fa28d9172f49d9933401ded9f30b461889
1 GNU Bison NEWS
3 * Noteworthy changes in release ?.? (????-??-??) [?]
5 ** Changes
7 *** C++ value_type
9   Prefer value_type to semantic_type to denote the semantic value type,
10   specified by the `api.value.type` %define variable.
12 *** GLR traces
14   There were not debug traces for deferred calls to user actions.  They are
15   logged now.
17 ** New features
19 *** Option -H, --header and directive %header
21   The option `-H`/`--header` supersedes the option `--defines`, and the
22   directive %header supersedes %defines.  Both `--defines` and `%defines`
23   are, of course, maintained for backward compatibility.
25 *** Option --html
27   Since version 2.4 Bison can be used to generate HTML reports.  However it
28   was a two-step process: first bison must be invoked with option `--xml`,
29   and then xsltproc must be run to the convert the XML reports into HTML.
31   The new option `--html` combines these steps.  The xsltproc program must
32   be available.
34 *** A C++ native GLR parser
36   A new version of the generated C++ GLR parser was added as "glr2.cc". It
37   is forked from the existing glr.c/cc parser, with the objective of making
38   it a more modern, truly C++ parser (instead of a C++ wrapper around a C
39   parser).  Down the line, the goal is to support `%define api.value.type
40   variant` and maybe share code with lalr1.cc.
42   The current parser should be identical in terms of interface, functionality
43   and performance to "glr.cc". To try it out, simply use
45   %skeleton "glr2.cc"
47 *** Counterexamples
49   Counterexamples now show the rule numbers, and always show ε for rules
50   with an empty right-hand side.  For instance
52     exp
53     ↳ 1: e1       e2     "a"
54          ↳ 3: ε • ↳ 1: ε
56   instead of
58     exp
59     ↳ e1  e2  "a"
60       ↳ • ↳ ε
62 *** Lookahead correction in Java
64   The Java skeleton (lalr1.java) now supports LAC, via the `parse.lac`
65   %define variable.
68 * Noteworthy changes in release 3.7.4 (2020-11-14) [stable]
70 ** Bug fixes
72 *** Bug fixes in yacc.c
74   In Yacc mode, all the tokens are defined twice: once as an enum, and then
75   as a macro.  YYEMPTY was missing its macro.
77 *** Bug fixes in lalr1.cc
79   The lalr1.cc skeleton used to emit internal assertions (using YY_ASSERT)
80   even when the `parse.assert` %define variable is not enabled.  It no
81   longer does.
83   The private internal macro YY_ASSERT now obeys the `api.prefix` %define
84   variable.
86   When there is a very large number of tokens, some assertions could be long
87   enough to hit arbitrary limits in Visual C++.  They have been rewritten to
88   work around this limitation.
90 ** Changes
92   The YYBISON macro in generated "regular C parsers" (from the "yacc.c"
93   skeleton) used to be defined to 1.  It is now defined to the version of
94   Bison as an integer (e.g., 30704 for version 3.7.4).
97 * Noteworthy changes in release 3.7.3 (2020-10-13) [stable]
99 ** Bug fixes
101   Fix concurrent build issues.
103   The bison executable is no longer linked uselessly against libreadline.
105   Fix incorrect use of yytname in glr.cc.
108 * Noteworthy changes in release 3.7.2 (2020-09-05) [stable]
110   This release of Bison fixes all known bugs reported for Bison in MITRE's
111   Common Vulnerabilities and Exposures (CVE) system.  These vulnerabilities
112   are only about bison-the-program itself, not the generated code.
114   Although these bugs are typically irrelevant to how Bison is used, they
115   are worth fixing if only to give users peace of mind.
117   There is no known vulnerability in the generated parsers.
119 ** Bug fixes
121   Fix concurrent build issues (introduced in Bison 3.5).
123   Push parsers always use YYMALLOC/YYFREE (no direct calls to malloc/free).
125   Fix portability issues of the test suite, and of bison itself.
127   Some unlikely crashes found by fuzzing have been fixed.  This is only
128   about bison itself, not the generated parsers.
131 * Noteworthy changes in release 3.7.1 (2020-08-02) [stable]
133 ** Bug fixes
135   Crash when a token alias contains a NUL byte.
137   Portability issues with libtextstyle.
139   Portability issues of Bison itself with MSVC.
141 ** Changes
143   Improvements and fixes in the documentation.
145   More precise location about symbol type redefinitions.
148 * Noteworthy changes in release 3.7 (2020-07-23) [stable]
150 ** Deprecated features
152   The YYPRINT macro, which works only with yacc.c and only for tokens, was
153   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
154   It is deprecated and its support will be removed eventually.
156   In conformance with the recommendations of the Graphviz team, in the next
157   version Bison the option `--graph` will generate a *.gv file by default,
158   instead of *.dot.  A transition started in Bison 3.4.
160 ** New features
162 *** Counterexample Generation
164   Contributed by Vincent Imbimbo.
166   When given `-Wcounterexamples`/`-Wcex`, bison will now output
167   counterexamples for conflicts.
169 **** Unifying Counterexamples
171   Unifying counterexamples are strings which can be parsed in two ways due
172   to the conflict.  For example on a grammar that contains the usual
173   "dangling else" ambiguity:
175     $ bison else.y
176     else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
177     else.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
179     $ bison else.y -Wcex
180     else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
181     else.y: warning: shift/reduce conflict on token "else" [-Wcounterexamples]
182       Example: "if" exp "then" "if" exp "then" exp • "else" exp
183       Shift derivation
184         exp
185         ↳ "if" exp "then" exp
186                           ↳ "if" exp "then" exp • "else" exp
187       Example: "if" exp "then" "if" exp "then" exp • "else" exp
188       Reduce derivation
189         exp
190         ↳ "if" exp "then" exp                     "else" exp
191                           ↳ "if" exp "then" exp •
193   When text styling is enabled, colors are used in the examples and the
194   derivations to highlight the structure of both analyses.  In this case,
196     "if" exp "then" [ "if" exp "then" exp • ] "else" exp
198   vs.
200     "if" exp "then" [ "if" exp "then" exp • "else" exp ]
203   The counterexamples are "focused", in two different ways.  First, they do
204   not clutter the output with all the derivations from the start symbol,
205   rather they start on the "conflicted nonterminal". They go straight to the
206   point.  Second, they don't "expand" nonterminal symbols uselessly.
208 **** Nonunifying Counterexamples
210   In the case of the dangling else, Bison found an example that can be
211   parsed in two ways (therefore proving that the grammar is ambiguous).
212   When it cannot find such an example, it instead generates two examples
213   that are the same up until the dot:
215     $ bison foo.y
216     foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
217     foo.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
218     foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
219         4 | a: expr
220           |    ^~~~
222     $ bison -Wcex foo.y
223     foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
224     foo.y: warning: shift/reduce conflict on token ID [-Wcounterexamples]
225       First example: expr • ID ',' ID $end
226       Shift derivation
227         $accept
228         ↳ s                      $end
229           ↳ a                 ID
230             ↳ expr
231               ↳ expr • ID ','
232       Second example: expr • ID $end
233       Reduce derivation
234         $accept
235         ↳ s             $end
236           ↳ a        ID
237             ↳ expr •
238     foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
239         4 | a: expr
240           |    ^~~~
242   In these cases, the parser usually doesn't have enough lookahead to
243   differentiate the two given examples.
245 **** Reports
247   Counterexamples are also included in the report when given
248   `--report=counterexamples`/`-rcex` (or `--report=all`), with more
249   technical details:
251     State 7
253       1 exp: "if" exp "then" exp •  [$end, "then", "else"]
254       2    | "if" exp "then" exp • "else" exp
256       "else"  shift, and go to state 8
258       "else"    [reduce using rule 1 (exp)]
259       $default  reduce using rule 1 (exp)
261       shift/reduce conflict on token "else":
262           1 exp: "if" exp "then" exp •
263           2 exp: "if" exp "then" exp • "else" exp
264         Example: "if" exp "then" "if" exp "then" exp • "else" exp
265         Shift derivation
266           exp
267           ↳ "if" exp "then" exp
268                             ↳ "if" exp "then" exp • "else" exp
269         Example: "if" exp "then" "if" exp "then" exp • "else" exp
270         Reduce derivation
271           exp
272           ↳ "if" exp "then" exp                     "else" exp
273                             ↳ "if" exp "then" exp •
275 *** File prefix mapping
277   Contributed by Joshua Watt.
279   Bison learned a new argument, `--file-prefix-map OLD=NEW`.  Any file path
280   in the output (specifically `#line` directives and `#ifdef` header guards)
281   that begins with the prefix OLD will have it replaced with the prefix NEW,
282   similar to the `-ffile-prefix-map` in GCC.  This option can be used to
283   make bison output reproducible.
285 ** Changes
287 *** Diagnostics
289   When text styling is enabled and the terminal supports it, the warnings
290   now include hyperlinks to the documentation.
292 *** Relocatable installation
294   When installed to be relocatable (via `configure --enable-relocatable`),
295   bison will now also look for a relocated m4.
297 *** C++ file names
299   The `filename_type` %define variable was renamed `api.filename.type`.
300   Instead of
302     %define filename_type "symbol"
304   write
306     %define api.filename.type {symbol}
308   (Or let `bison --update` do it for you).
310   It now defaults to `const std::string` instead of `std::string`.
312 *** Deprecated %define variable names
314   The following variables have been renamed for consistency.  Backward
315   compatibility is ensured, but upgrading is recommended.
317     filename_type       -> api.filename.type
318     package             -> api.package
320 *** Push parsers no longer clear their state when parsing is finished
322   Previously push-parsers cleared their state when parsing was finished (on
323   success and on failure).  This made it impossible to check if there were
324   parse errors, since `yynerrs` was also reset.  This can be especially
325   troublesome when used in autocompletion, since a parser with error
326   recovery would suggest (irrelevant) expected tokens even if there were
327   failure.
329   Now the parser state can be examined when parsing is finished.  The parser
330   state is reset when starting a new parse.
332 ** Documentation
334 *** Examples
336   The bistromathic demonstrates %param and how to quote sources in the error
337   messages:
339     > 123 456
340     1.5-7: syntax error: expected end of file or + or - or * or / or ^ before number
341         1 | 123 456
342           |     ^~~
344 ** Bug fixes
346 *** Include the generated header (yacc.c)
348   Historically, when --defines was used, bison generated a header and pasted
349   an exact copy of it into the generated parser implementation file.  Since
350   Bison 3.4 it is possible to specify that the header should be `#include`d,
351   and how.  For instance
353     %define api.header.include {"parse.h"}
355   or
357     %define api.header.include {<parser/parse.h>}
359   Now api.header.include defaults to `"header-basename"`, as was intended in
360   Bison 3.4, where `header-basename` is the basename of the generated
361   header.  This is disabled when the generated header is `y.tab.h`, to
362   comply with Automake's ylwrap.
364 *** String aliases are faithfully propagated
366   Bison used to interpret user strings (i.e., decoding backslash escapes)
367   when reading them, and to escape them (i.e., issue non-printable
368   characters as backslash escapes, taking the locale into account) when
369   outputting them.  As a consequence non-ASCII strings (say in UTF-8) ended
370   up "ciphered" as sequences of backslash escapes.  This happened not only
371   in the generated sources (where the compiler will reinterpret them), but
372   also in all the generated reports (text, xml, html, dot, etc.).  Reports
373   were therefore not readable when string aliases were not pure ASCII.
374   Worse yet: the output depended on the user's locale.
376   Now Bison faithfully treats the string aliases exactly the way the user
377   spelled them.  This fixes all the aforementioned problems.  However, now,
378   string aliases semantically equivalent but syntactically different (e.g.,
379   "A", "\x41", "\101") are considered to be different.
381 *** Crash when generating IELR
383   An old, well hidden, bug in the generation of IELR parsers was fixed.
386 * Noteworthy changes in release 3.6.4 (2020-06-15) [stable]
388 ** Bug fixes
390   In glr.cc some internal macros leaked in the user's code, and could damage
391   access to the token kinds.
394 * Noteworthy changes in release 3.6.3 (2020-06-03) [stable]
396 ** Bug fixes
398   Incorrect comments in the generated parsers.
400   Warnings in push parsers (yacc.c).
402   Incorrect display of gotos in LAC traces (lalr1.cc).
405 * Noteworthy changes in release 3.6.2 (2020-05-17) [stable]
407 ** Bug fixes
409   Some tests were fixed.
411   When token aliases contain comment delimiters:
413     %token FOO "/* foo */"
415   bison used to emit "nested" comments, which is invalid C.
418 * Noteworthy changes in release 3.6.1 (2020-05-10) [stable]
420 ** Bug fixes
422   Restored ANSI-C compliance in yacc.c.
424   GNU readline portability issues.
426   In C++, yy::parser::symbol_name is now a public member, as was intended.
428 ** New features
430   In C++, yy::parser::symbol_type now has a public name() member function.
433 * Noteworthy changes in release 3.6 (2020-05-08) [stable]
435 ** Backward incompatible changes
437   TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose".
439   The YYERROR_VERBOSE macro is no longer supported; the parsers that still
440   depend on it will now produce Yacc-like error messages (just "syntax
441   error").  It was superseded by the "%error-verbose" directive in Bison
442   1.875 (2003-01-01).  Bison 2.6 (2012-07-19) clearly announced that support
443   for YYERROR_VERBOSE would be removed.  Note that since Bison 3.0
444   (2013-07-25), "%error-verbose" is deprecated in favor of "%define
445   parse.error verbose".
447 ** Deprecated features
449   The YYPRINT macro, which works only with yacc.c and only for tokens, was
450   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
451   It is deprecated and its support will be removed eventually.
453 ** New features
455 *** Improved syntax error messages
457   Two new values for the %define parse.error variable offer more control to
458   the user.  Available in all the skeletons (C, C++, Java).
460 **** %define parse.error detailed
462   The behavior of "%define parse.error detailed" is closely resembling that
463   of "%define parse.error verbose" with a few exceptions.  First, it is safe
464   to use non-ASCII characters in token aliases (with 'verbose', the result
465   depends on the locale with which bison was run).  Second, a yysymbol_name
466   function is exposed to the user, instead of the yytnamerr function and the
467   yytname table.  Third, token internationalization is supported (see
468   below).
470 **** %define parse.error custom
472   With this directive, the user forges and emits the syntax error message
473   herself by defining the yyreport_syntax_error function.  A new type,
474   yypcontext_t, captures the circumstances of the error, and provides the
475   user with functions to get details, such as yypcontext_expected_tokens to
476   get the list of expected token kinds.
478   A possible implementation of yyreport_syntax_error is:
480     int
481     yyreport_syntax_error (const yypcontext_t *ctx)
482     {
483       int res = 0;
484       YY_LOCATION_PRINT (stderr, *yypcontext_location (ctx));
485       fprintf (stderr, ": syntax error");
486       // Report the tokens expected at this point.
487       {
488         enum { TOKENMAX = 10 };
489         yysymbol_kind_t expected[TOKENMAX];
490         int n = yypcontext_expected_tokens (ctx, expected, TOKENMAX);
491         if (n < 0)
492           // Forward errors to yyparse.
493           res = n;
494         else
495           for (int i = 0; i < n; ++i)
496             fprintf (stderr, "%s %s",
497                      i == 0 ? ": expected" : " or", yysymbol_name (expected[i]));
498       }
499       // Report the unexpected token.
500       {
501         yysymbol_kind_t lookahead = yypcontext_token (ctx);
502         if (lookahead != YYSYMBOL_YYEMPTY)
503           fprintf (stderr, " before %s", yysymbol_name (lookahead));
504       }
505       fprintf (stderr, "\n");
506       return res;
507     }
509 **** Token aliases internationalization
511   When the %define variable parse.error is set to `custom` or `detailed`,
512   one may specify which token aliases are to be translated using _().  For
513   instance
515     %token
516         PLUS   "+"
517         MINUS  "-"
518       <double>
519         NUM _("number")
520       <symrec*>
521         FUN _("function")
522         VAR _("variable")
524   In that case the user must define _() and N_(), and yysymbol_name returns
525   the translated symbol (i.e., it returns '_("variable")' rather that
526   '"variable"').  In Java, the user must provide an i18n() function.
528 *** List of expected tokens (yacc.c)
530   Push parsers may invoke yypstate_expected_tokens at any point during
531   parsing (including even before submitting the first token) to get the list
532   of possible tokens.  This feature can be used to propose autocompletion
533   (see below the "bistromathic" example).
535   It makes little sense to use this feature without enabling LAC (lookahead
536   correction).
538 *** Returning the error token
540   When the scanner returns an invalid token or the undefined token
541   (YYUNDEF), the parser generates an error message and enters error
542   recovery.  Because of that error message, most scanners that find lexical
543   errors generate an error message, and then ignore the invalid input
544   without entering the error-recovery.
546   The scanners may now return YYerror, the error token, to enter the
547   error-recovery mode without triggering an additional error message.  See
548   the bistromathic for an example.
550 *** Deep overhaul of the symbol and token kinds
552   To avoid the confusion with types in programming languages, we now refer
553   to token and symbol "kinds" instead of token and symbol "types".  The
554   documentation and error messages have been revised.
556   All the skeletons have been updated to use dedicated enum types rather
557   than integral types.  Special symbols are now regular citizens, instead of
558   being declared in ad hoc ways.
560 **** Token kinds
562   The "token kind" is what is returned by the scanner, e.g., PLUS, NUMBER,
563   LPAREN, etc.  While backward compatibility is of course ensured, users are
564   nonetheless invited to replace their uses of "enum yytokentype" by
565   "yytoken_kind_t".
567   This type now also includes tokens that were previously hidden: YYEOF (end
568   of input), YYUNDEF (undefined token), and YYerror (error token).  They
569   now have string aliases, internationalized when internationalization is
570   enabled.  Therefore, by default, error messages now refer to "end of file"
571   (internationalized) rather than the cryptic "$end", or to "invalid token"
572   rather than "$undefined".
574   Therefore in most cases it is now useless to define the end-of-line token
575   as follows:
577     %token T_EOF 0 "end of file"
579   Rather simply use "YYEOF" in your scanner.
581 **** Symbol kinds
583   The "symbol kinds" is what the parser actually uses.  (Unless the
584   api.token.raw %define variable is used, the symbol kind of a terminal
585   differs from the corresponding token kind.)
587   They are now exposed as a enum, "yysymbol_kind_t".
589   This allows users to tailor the error messages the way they want, or to
590   process some symbols in a specific way in autocompletion (see the
591   bistromathic example below).
593 *** Modernize display of explanatory statements in diagnostics
595   Since Bison 2.7, output was indented four spaces for explanatory
596   statements.  For example:
598     input.y:2.7-13: error: %type redeclaration for exp
599     input.y:1.7-11:     previous declaration
601   Since the introduction of caret-diagnostics, it became less clear.  This
602   indentation has been removed and submessages are displayed similarly as in
603   GCC:
605     input.y:2.7-13: error: %type redeclaration for exp
606         2 | %type <float> exp
607           |       ^~~~~~~
608     input.y:1.7-11: note: previous declaration
609         1 | %type <int> exp
610           |       ^~~~~
612   Contributed by Victor Morales Cayuela.
614 *** C++
616   The token and symbol kinds are yy::parser::token_kind_type and
617   yy::parser::symbol_kind_type.
619   The symbol_type::kind() member function allows to get the kind of a
620   symbol.  This can be used to write unit tests for scanners, e.g.,
622     yy::parser::symbol_type t = make_NUMBER ("123");
623     assert (t.kind () == yy::parser::symbol_kind::S_NUMBER);
624     assert (t.value.as<int> () == 123);
626 ** Documentation
628 *** User Manual
630   In order to avoid ambiguities with "type" as in "typing", we now refer to
631   the "token kind" (e.g., `PLUS`, `NUMBER`, etc.) rather than the "token
632   type".  We now also refer to the "symbol type" (e.g., `PLUS`, `expr`,
633   etc.).
635 *** Examples
637   There are now examples/java: a very simple calculator, and a more complete
638   one (push-parser, location tracking, and debug traces).
640   The lexcalc example (a simple example in C based on Flex and Bison) now
641   also demonstrates location tracking.
644   A new C example, bistromathic, is a fully featured interactive calculator
645   using many Bison features: pure interface, push parser, autocompletion
646   based on the current parser state (using yypstate_expected_tokens),
647   location tracking, internationalized custom error messages, lookahead
648   correction, rich debug traces, etc.
650   It shows how to depend on the symbol kinds to tailor autocompletion.  For
651   instance it recognizes the symbol kind "VARIABLE" to propose
652   autocompletion on the existing variables, rather than of the word
653   "variable".
656 * Noteworthy changes in release 3.5.4 (2020-04-05) [stable]
658 ** WARNING: Future backward-incompatibilities!
660   TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose".
662   Bison 3.6 will no longer support the YYERROR_VERBOSE macro; the parsers
663   that still depend on it will produce Yacc-like error messages (just
664   "syntax error").  It was superseded by the "%error-verbose" directive in
665   Bison 1.875 (2003-01-01).  Bison 2.6 (2012-07-19) clearly announced that
666   support for YYERROR_VERBOSE would be removed.  Note that since Bison 3.0
667   (2013-07-25), "%error-verbose" is deprecated in favor of "%define
668   parse.error verbose".
670 ** Bug fixes
672   Fix portability issues of the package itself on old compilers.
674   Fix api.token.raw support in Java.
677 * Noteworthy changes in release 3.5.3 (2020-03-08) [stable]
679 ** Bug fixes
681   Error messages could quote lines containing zero-width characters (such as
682   \005) with incorrect styling.  Fixes for similar issues with unexpectedly
683   short lines (e.g., the file was changed between parsing and diagnosing).
685   Some unlikely crashes found by fuzzing have been fixed.  This is only
686   about bison itself, not the generated parsers.
689 * Noteworthy changes in release 3.5.2 (2020-02-13) [stable]
691 ** Bug fixes
693   Portability issues and minor cosmetic issues.
695   The lalr1.cc skeleton properly rejects unsupported values for parse.lac
696   (as yacc.c does).
699 * Noteworthy changes in release 3.5.1 (2020-01-19) [stable]
701 ** Bug fixes
703   Portability fixes.
705   Fix compiler warnings.
708 * Noteworthy changes in release 3.5 (2019-12-11) [stable]
710 ** Backward incompatible changes
712   Lone carriage-return characters (aka \r or ^M) in the grammar files are no
713   longer treated as end-of-lines.  This changes the diagnostics, and in
714   particular their locations.
716   In C++, line numbers and columns are now represented as 'int' not
717   'unsigned', so that integer overflow on positions is easily checkable via
718   'gcc -fsanitize=undefined' and the like.  This affects the API for
719   positions.  The default position and location classes now expose
720   'counter_type' (int), used to define line and column numbers.
722 ** Deprecated features
724   The YYPRINT macro, which works only with yacc.c and only for tokens, was
725   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
726   It is deprecated and its support will be removed eventually.
728 ** New features
730 *** Lookahead correction in C++
732   Contributed by Adrian Vogelsgesang.
734   The C++ deterministic skeleton (lalr1.cc) now supports LAC, via the
735   %define variable parse.lac.
737 *** Variable api.token.raw: Optimized token numbers (all skeletons)
739   In the generated parsers, tokens have two numbers: the "external" token
740   number as returned by yylex (which starts at 257), and the "internal"
741   symbol number (which starts at 3).  Each time yylex is called, a table
742   lookup maps the external token number to the internal symbol number.
744   When the %define variable api.token.raw is set, tokens are assigned their
745   internal number, which saves one table lookup per token, and also saves
746   the generation of the mapping table.
748   The gain is typically moderate, but in extreme cases (very simple user
749   actions), a 10% improvement can be observed.
751 *** Generated parsers use better types for states
753   Stacks now use the best integral type for state numbers, instead of always
754   using 15 bits.  As a result "small" parsers now have a smaller memory
755   footprint (they use 8 bits), and there is support for large automata (16
756   bits), and extra large (using int, i.e., typically 31 bits).
758 *** Generated parsers prefer signed integer types
760   Bison skeletons now prefer signed to unsigned integer types when either
761   will do, as the signed types are less error-prone and allow for better
762   checking with 'gcc -fsanitize=undefined'.  Also, the types chosen are now
763   portable to unusual machines where char, short and int are all the same
764   width.  On non-GNU platforms this may entail including <limits.h> and (if
765   available) <stdint.h> to define integer types and constants.
767 *** A skeleton for the D programming language
769   For the last few releases, Bison has shipped a stealth experimental
770   skeleton: lalr1.d.  It was first contributed by Oliver Mangold, based on
771   Paolo Bonzini's lalr1.java, and was cleaned and improved thanks to
772   H. S. Teoh.
774   However, because nobody has committed to improving, testing, and
775   documenting this skeleton, it is not clear that it will be supported in
776   the future.
778   The lalr1.d skeleton *is functional*, and works well, as demonstrated in
779   examples/d/calc.d.  Please try it, enjoy it, and... commit to support it.
781 *** Debug traces in Java
783   The Java backend no longer emits code and data for parser tracing if the
784   %define variable parse.trace is not defined.
786 ** Diagnostics
788 *** New diagnostic: -Wdangling-alias
790   String literals, which allow for better error messages, are (too)
791   liberally accepted by Bison, which might result in silent errors.  For
792   instance
794     %type <exVal> cond "condition"
796   does not define "condition" as a string alias to 'cond' (nonterminal
797   symbols do not have string aliases).  It is rather equivalent to
799     %nterm <exVal> cond
800     %token <exVal> "condition"
802   i.e., it gives the type 'exVal' to the "condition" token, which was
803   clearly not the intention.
805   Also, because string aliases need not be defined, typos such as "baz"
806   instead of "bar" will be not reported.
808   The option `-Wdangling-alias` catches these situations.  On
810     %token BAR "bar"
811     %type <ival> foo "foo"
812     %%
813     foo: "baz" {}
815   bison -Wdangling-alias reports
817     warning: string literal not attached to a symbol
818           | %type <ival> foo "foo"
819           |                  ^~~~~
820     warning: string literal not attached to a symbol
821           | foo: "baz" {}
822           |      ^~~~~
824    The `-Wall` option does not (yet?) include `-Wdangling-alias`.
826 *** Better POSIX Yacc compatibility diagnostics
828   POSIX Yacc restricts %type to nonterminals.  This is now diagnosed by
829   -Wyacc.
831     %token TOKEN1
832     %type  <ival> TOKEN1 TOKEN2 't'
833     %token TOKEN2
834     %%
835     expr:
837   gives with -Wyacc
839     input.y:2.15-20: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
840         2 | %type  <ival> TOKEN1 TOKEN2 't'
841           |               ^~~~~~
842     input.y:2.29-31: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
843         2 | %type  <ival> TOKEN1 TOKEN2 't'
844           |                             ^~~
845     input.y:2.22-27: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
846         2 | %type  <ival> TOKEN1 TOKEN2 't'
847           |                      ^~~~~~
849 *** Diagnostics with insertion
851   The diagnostics now display the suggestion below the underlined source.
852   Replacement for undeclared symbols are now also suggested.
854     $ cat /tmp/foo.y
855     %%
856     list: lis '.' |
858     $ bison -Wall foo.y
859     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'?
860         2 | list: lis '.' |
861           |       ^~~
862           |       list
863     foo.y:2.16: warning: empty rule without %empty [-Wempty-rule]
864         2 | list: lis '.' |
865           |                ^
866           |                %empty
867     foo.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
869 *** Diagnostics about long lines
871   Quoted sources may now be truncated to fit the screen.  For instance, on a
872   30-column wide terminal:
874     $ cat foo.y
875     %token FOO                       FOO                         FOO
876     %%
877     exp: FOO
878     $ bison foo.y
879     foo.y:1.34-36: warning: symbol FOO redeclared [-Wother]
880         1 | …         FOO                  …
881           |           ^~~
882     foo.y:1.8-10:      previous declaration
883         1 | %token FOO                     …
884           |        ^~~
885     foo.y:1.62-64: warning: symbol FOO redeclared [-Wother]
886         1 | …         FOO
887           |           ^~~
888     foo.y:1.8-10:      previous declaration
889         1 | %token FOO                     …
890           |        ^~~
892 ** Changes
894 *** Debugging glr.c and glr.cc
896   The glr.c skeleton always had asserts to check its own behavior (not the
897   user's).  These assertions are now under the control of the parse.assert
898   %define variable (disabled by default).
900 *** Clean up
902   Several new compiler warnings in the generated output have been avoided.
903   Some unused features are no longer emitted.  Cleaner generated code in
904   general.
906 ** Bug Fixes
908   Portability issues in the test suite.
910   In theory, parsers using %nonassoc could crash when reporting verbose
911   error messages. This unlikely bug has been fixed.
913   In Java, %define api.prefix was ignored.  It now behaves as expected.
916 * Noteworthy changes in release 3.4.2 (2019-09-12) [stable]
918 ** Bug fixes
920   In some cases, when warnings are disabled, bison could emit tons of white
921   spaces as diagnostics.
923   When running out of memory, bison could crash (found by fuzzing).
925   When defining twice the EOF token, bison would crash.
927   New warnings from recent compilers have been addressed in the generated
928   parsers (yacc.c, glr.c, glr.cc).
930   When lone carriage-return characters appeared in the input file,
931   diagnostics could hang forever.
934 * Noteworthy changes in release 3.4.1 (2019-05-22) [stable]
936 ** Bug fixes
938   Portability fixes.
941 * Noteworthy changes in release 3.4 (2019-05-19) [stable]
943 ** Deprecated features
945   The %pure-parser directive is deprecated in favor of '%define api.pure'
946   since Bison 2.3b (2008-05-27), but no warning was issued; there is one
947   now.  Note that since Bison 2.7 you are strongly encouraged to use
948   '%define api.pure full' instead of '%define api.pure'.
950 ** New features
952 *** Colored diagnostics
954   As an experimental feature, diagnostics are now colored, controlled by the
955   new options --color and --style.
957   To use them, install the libtextstyle library before configuring Bison.
958   It is available from
960     https://alpha.gnu.org/gnu/gettext/
962   for instance
964     https://alpha.gnu.org/gnu/gettext/libtextstyle-0.8.tar.gz
966   The option --color supports the following arguments:
967     - always, yes: Enable colors.
968     - never, no: Disable colors.
969     - auto, tty (default): Enable colors if the output device is a tty.
971   To customize the styles, create a CSS file similar to
973     /* bison-bw.css */
974     .warning   { }
975     .error     { font-weight: 800; text-decoration: underline; }
976     .note      { }
978   then invoke bison with --style=bison-bw.css, or set the BISON_STYLE
979   environment variable to "bison-bw.css".
981 *** Disabling output
983   When given -fsyntax-only, the diagnostics are reported, but no output is
984   generated.
986   The name of this option is somewhat misleading as bison does more than
987   just checking the syntax: every stage is run (including checking for
988   conflicts for instance), except the generation of the output files.
990 *** Include the generated header (yacc.c)
992   Before, when --defines is used, bison generated a header, and pasted an
993   exact copy of it into the generated parser implementation file.  If the
994   header name is not "y.tab.h", it is now #included instead of being
995   duplicated.
997   To use an '#include' even if the header name is "y.tab.h" (which is what
998   happens with --yacc, or when using the Autotools' ylwrap), define
999   api.header.include to the exact argument to pass to #include.  For
1000   instance:
1002     %define api.header.include {"parse.h"}
1004   or
1006     %define api.header.include {<parser/parse.h>}
1008 *** api.location.type is now supported in C (yacc.c, glr.c)
1010   The %define variable api.location.type defines the name of the type to use
1011   for locations.  When defined, Bison no longer defines YYLTYPE.
1013   This can be used in programs with several parsers to factor their
1014   definition of locations: let one of them generate them, and the others
1015   just use them.
1017 ** Changes
1019 *** Graphviz output
1021   In conformance with the recommendations of the Graphviz team, if %require
1022   "3.4" (or better) is specified, the option --graph generates a *.gv file
1023   by default, instead of *.dot.
1025 *** Diagnostics overhaul
1027   Column numbers were wrong with multibyte characters, which would also
1028   result in skewed diagnostics with carets.  Beside, because we were
1029   indenting the quoted source with a single space, lines with tab characters
1030   were incorrectly underlined.
1032   To address these issues, and to be clearer, Bison now issues diagnostics
1033   as GCC9 does.  For instance it used to display (there's a tab before the
1034   opening brace):
1036     foo.y:3.37-38: error: $2 of ‘expr’ has no declared type
1037      expr: expr '+' "number"        { $$ = $1 + $2; }
1038                                          ^~
1039   It now reports
1041     foo.y:3.37-38: error: $2 of ‘expr’ has no declared type
1042         3 | expr: expr '+' "number" { $$ = $1 + $2; }
1043           |                                     ^~
1045   Other constructs now also have better locations, resulting in more precise
1046   diagnostics.
1048 *** Fix-it hints for %empty
1050   Running Bison with -Wempty-rules and --update will remove incorrect %empty
1051   annotations, and add the missing ones.
1053 *** Generated reports
1055   The format of the reports (parse.output) was improved for readability.
1057 *** Better support for --no-line.
1059   When --no-line is used, the generated files are now cleaner: no lines are
1060   generated instead of empty lines.  Together with using api.header.include,
1061   that should help people saving the generated files into version control
1062   systems get smaller diffs.
1064 ** Documentation
1066   A new example in C shows an simple infix calculator with a hand-written
1067   scanner (examples/c/calc).
1069   A new example in C shows a reentrant parser (capable of recursive calls)
1070   built with Flex and Bison (examples/c/reccalc).
1072   There is a new section about the history of Yaccs and Bison.
1074 ** Bug fixes
1076   A few obscure bugs were fixed, including the second oldest (known) bug in
1077   Bison: it was there when Bison was entered in the RCS version control
1078   system, in December 1987.  See the NEWS of Bison 3.3 for the previous
1079   oldest bug.
1082 * Noteworthy changes in release 3.3.2 (2019-02-03) [stable]
1084 ** Bug fixes
1086   Bison 3.3 failed to generate parsers for grammars with unused nonterminal
1087   symbols.
1090 * Noteworthy changes in release 3.3.1 (2019-01-27) [stable]
1092 ** Changes
1094   The option -y/--yacc used to imply -Werror=yacc, which turns uses of Bison
1095   extensions into errors.  It now makes them simple warnings (-Wyacc).
1098 * Noteworthy changes in release 3.3 (2019-01-26) [stable]
1100   A new mailing list was created, Bison Announce.  It is low traffic, and is
1101   only about announcing new releases and important messages (e.g., polls
1102   about major decisions to make).
1104   https://lists.gnu.org/mailman/listinfo/bison-announce
1106 ** Backward incompatible changes
1108   Support for DJGPP, which has been unmaintained and untested for years, is
1109   removed.
1111 ** Deprecated features
1113   A new feature, --update (see below) helps adjusting existing grammars to
1114   deprecations.
1116 *** Deprecated directives
1118   The %error-verbose directive is deprecated in favor of '%define
1119   parse.error verbose' since Bison 3.0, but no warning was issued.
1121   The '%name-prefix "xx"' directive is deprecated in favor of '%define
1122   api.prefix {xx}' since Bison 3.0, but no warning was issued.  These
1123   directives are slightly different, you might need to adjust your code.
1124   %name-prefix renames only symbols with external linkage, while api.prefix
1125   also renames types and macros, including YYDEBUG, YYTOKENTYPE,
1126   yytokentype, YYSTYPE, YYLTYPE, etc.
1128   Users of Flex that move from '%name-prefix "xx"' to '%define api.prefix
1129   {xx}' will typically have to update YY_DECL from
1131     #define YY_DECL int xxlex (YYSTYPE *yylval, YYLTYPE *yylloc)
1133   to
1135     #define YY_DECL int xxlex (XXSTYPE *yylval, XXLTYPE *yylloc)
1137 *** Deprecated %define variable names
1139   The following variables, mostly related to parsers in Java, have been
1140   renamed for consistency.  Backward compatibility is ensured, but upgrading
1141   is recommended.
1143     abstract           -> api.parser.abstract
1144     annotations        -> api.parser.annotations
1145     extends            -> api.parser.extends
1146     final              -> api.parser.final
1147     implements         -> api.parser.implements
1148     parser_class_name  -> api.parser.class
1149     public             -> api.parser.public
1150     strictfp           -> api.parser.strictfp
1152 ** New features
1154 *** Generation of fix-its for IDEs/Editors
1156   When given the new option -ffixit (aka -fdiagnostics-parseable-fixits),
1157   bison now generates machine readable editing instructions to fix some
1158   issues.  Currently, this is mostly limited to updating deprecated
1159   directives and removing duplicates.  For instance:
1161     $ cat foo.y
1162     %error-verbose
1163     %define parser_class_name "Parser"
1164     %define api.parser.class "Parser"
1165     %%
1166     exp:;
1168   See the "fix-it:" lines below:
1170     $ bison -ffixit foo.y
1171     foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated]
1172      %error-verbose
1173      ^~~~~~~~~~~~~~
1174     fix-it:"foo.y":{1:1-1:15}:"%define parse.error verbose"
1175     foo.y:2.1-34: warning: deprecated directive, use '%define api.parser.class {Parser}' [-Wdeprecated]
1176      %define parser_class_name "Parser"
1177      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1178     fix-it:"foo.y":{2:1-2:35}:"%define api.parser.class {Parser}"
1179     foo.y:3.1-33: error: %define variable 'api.parser.class' redefined
1180      %define api.parser.class "Parser"
1181      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1182     foo.y:2.1-34:     previous definition
1183      %define parser_class_name "Parser"
1184      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1185     fix-it:"foo.y":{3:1-3:34}:""
1186     foo.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
1188   This uses the same output format as GCC and Clang.
1190 *** Updating grammar files
1192   Fixes can be applied on the fly.  The previous example ends with the
1193   suggestion to re-run bison with the option -u/--update, which results in a
1194   cleaner grammar file.
1196     $ bison --update foo.y
1197     [...]
1198     bison: file 'foo.y' was updated (backup: 'foo.y~')
1200     $ cat foo.y
1201     %define parse.error verbose
1202     %define api.parser.class {Parser}
1203     %%
1204     exp:;
1206 *** Bison is now relocatable
1208   If you pass '--enable-relocatable' to 'configure', Bison is relocatable.
1210   A relocatable program can be moved or copied to a different location on
1211   the file system.  It can also be used through mount points for network
1212   sharing.  It is possible to make symbolic links to the installed and moved
1213   programs, and invoke them through the symbolic link.
1215 *** %expect and %expect-rr modifiers on individual rules
1217   One can now document (and check) which rules participate in shift/reduce
1218   and reduce/reduce conflicts.  This is particularly important GLR parsers,
1219   where conflicts are a normal occurrence.  For example,
1221       %glr-parser
1222       %expect 1
1223       %%
1225       ...
1227       argument_list:
1228         arguments %expect 1
1229       | arguments ','
1230       | %empty
1231       ;
1233       arguments:
1234         expression
1235       | argument_list ',' expression
1236       ;
1238       ...
1240   Looking at the output from -v, one can see that the shift/reduce conflict
1241   here is due to the fact that the parser does not know whether to reduce
1242   arguments to argument_list until it sees the token _after_ the following
1243   ','.  By marking the rule with %expect 1 (because there is a conflict in
1244   one state), we document the source of the 1 overall shift/reduce conflict.
1246   In GLR parsers, we can use %expect-rr in a rule for reduce/reduce
1247   conflicts.  In this case, we mark each of the conflicting rules.  For
1248   example,
1250       %glr-parser
1251       %expect-rr 1
1253       %%
1255       stmt:
1256         target_list '=' expr ';'
1257       | expr_list ';'
1258       ;
1260       target_list:
1261         target
1262       | target ',' target_list
1263       ;
1265       target:
1266         ID %expect-rr 1
1267       ;
1269       expr_list:
1270         expr
1271       | expr ',' expr_list
1272       ;
1274       expr:
1275         ID %expect-rr 1
1276       | ...
1277       ;
1279   In a statement such as
1281       x, y = 3, 4;
1283   the parser must reduce x to a target or an expr, but does not know which
1284   until it sees the '='.  So we notate the two possible reductions to
1285   indicate that each conflicts in one rule.
1287   This feature needs user feedback, and might evolve in the future.
1289 *** C++: Actual token constructors
1291   When variants and token constructors are enabled, in addition to the
1292   type-safe named token constructors (make_ID, make_INT, etc.), we now
1293   generate genuine constructors for symbol_type.
1295   For instance with these declarations
1297     %token           ':'
1298        <std::string> ID
1299        <int>         INT;
1301   you may use these constructors:
1303     symbol_type (int token, const std::string&);
1304     symbol_type (int token, const int&);
1305     symbol_type (int token);
1307   Correct matching between token types and value types is checked via
1308   'assert'; for instance, 'symbol_type (ID, 42)' would abort.  Named
1309   constructors are preferable, as they offer better type safety (for
1310   instance 'make_ID (42)' would not even compile), but symbol_type
1311   constructors may help when token types are discovered at run-time, e.g.,
1313      [a-z]+   {
1314                 if (auto i = lookup_keyword (yytext))
1315                   return yy::parser::symbol_type (i);
1316                 else
1317                   return yy::parser::make_ID (yytext);
1318               }
1320 *** C++: Variadic emplace
1322   If your application requires C++11 and you don't use symbol constructors,
1323   you may now use a variadic emplace for semantic values:
1325     %define api.value.type variant
1326     %token <std::pair<int, int>> PAIR
1328   in your scanner:
1330     int yylex (parser::semantic_type *lvalp)
1331     {
1332       lvalp->emplace <std::pair<int, int>> (1, 2);
1333       return parser::token::PAIR;
1334     }
1336 *** C++: Syntax error exceptions in GLR
1338   The glr.cc skeleton now supports syntax_error exceptions thrown from user
1339   actions, or from the scanner.
1341 *** More POSIX Yacc compatibility warnings
1343   More Bison specific directives are now reported with -y or -Wyacc.  This
1344   change was ready since the release of Bison 3.0 in September 2015.  It was
1345   delayed because Autoconf used to define YACC as `bison -y`, which resulted
1346   in numerous warnings for Bison users that use the GNU Build System.
1348   If you still experience that problem, either redefine YACC as `bison -o
1349   y.tab.c`, or pass -Wno-yacc to Bison.
1351 *** The tables yyrhs and yyphrs are back
1353   Because no Bison skeleton uses them, these tables were removed (no longer
1354   passed to the skeletons, not even computed) in 2008.  However, some users
1355   have expressed interest in being able to use them in their own skeletons.
1357 ** Bug fixes
1359 *** Incorrect number of reduce/reduce conflicts
1361   On a grammar such as
1363      exp: "num" | "num" | "num"
1365   bison used to report a single RR conflict, instead of two.  This is now
1366   fixed.  This was the oldest (known) bug in Bison: it was there when Bison
1367   was entered in the RCS version control system, in December 1987.
1369   Some grammar files might have to adjust their %expect-rr.
1371 *** Parser directives that were not careful enough
1373   Passing invalid arguments to %nterm, for instance character literals, used
1374   to result in unclear error messages.
1376 ** Documentation
1378   The examples/ directory (installed in .../share/doc/bison/examples) has
1379   been restructured per language for clarity.  The examples come with a
1380   README and a Makefile.  Not only can they be used to toy with Bison, they
1381   can also be starting points for your own grammars.
1383   There is now a Java example, and a simple example in C based on Flex and
1384   Bison (examples/c/lexcalc/).
1386 ** Changes
1388 *** Parsers in C++
1390   They now use noexcept and constexpr.  Please, report missing annotations.
1392 *** Symbol Declarations
1394   The syntax of the variation directives to declare symbols was overhauled
1395   for more consistency, and also better POSIX Yacc compliance (which, for
1396   instance, allows "%type" without actually providing a type).  The %nterm
1397   directive, supported by Bison since its inception, is now documented and
1398   officially supported.
1400   The syntax is now as follows:
1402     %token TAG? ( ID NUMBER? STRING? )+ ( TAG ( ID NUMBER? STRING? )+ )*
1403     %left  TAG? ( ID NUMBER? )+ ( TAG ( ID NUMBER? )+ )*
1404     %type  TAG? ( ID | CHAR | STRING )+ ( TAG ( ID | CHAR | STRING )+ )*
1405     %nterm TAG? ID+ ( TAG ID+ )*
1407   where TAG denotes a type tag such as ‘<ival>’, ID denotes an identifier
1408   such as ‘NUM’, NUMBER a decimal or hexadecimal integer such as ‘300’ or
1409   ‘0x12d’, CHAR a character literal such as ‘'+'’, and STRING a string
1410   literal such as ‘"number"’.  The post-fix quantifiers are ‘?’ (zero or
1411   one), ‘*’ (zero or more) and ‘+’ (one or more).
1414 * Noteworthy changes in release 3.2.4 (2018-12-24) [stable]
1416 ** Bug fixes
1418   Fix the move constructor of symbol_type.
1420   Always provide a copy constructor for symbol_type, even in modern C++.
1423 * Noteworthy changes in release 3.2.3 (2018-12-18) [stable]
1425 ** Bug fixes
1427   Properly support token constructors in C++ with types that include commas
1428   (e.g., std::pair<int, int>).  A regression introduced in Bison 3.2.
1431 * Noteworthy changes in release 3.2.2 (2018-11-21) [stable]
1433 ** Bug fixes
1435   C++ portability issues.
1438 * Noteworthy changes in release 3.2.1 (2018-11-09) [stable]
1440 ** Bug fixes
1442   Several portability issues have been fixed in the build system, in the
1443   test suite, and in the generated parsers in C++.
1446 * Noteworthy changes in release 3.2 (2018-10-29) [stable]
1448 ** Backward incompatible changes
1450   Support for DJGPP, which has been unmaintained and untested for years, is
1451   obsolete.  Unless there is activity to revive it, it will be removed.
1453 ** Changes
1455   %printers should use yyo rather than yyoutput to denote the output stream.
1457   Variant-based symbols in C++ should use emplace() rather than build().
1459   In C++ parsers, parser::operator() is now a synonym for the parser::parse.
1461 ** Documentation
1463   A new section, "A Simple C++ Example", is a tutorial for parsers in C++.
1465   A comment in the generated code now emphasizes that users should not
1466   depend upon non-documented implementation details, such as macros starting
1467   with YY_.
1469 ** New features
1471 *** C++: Support for move semantics (lalr1.cc)
1473   The lalr1.cc skeleton now fully supports C++ move semantics, while
1474   maintaining compatibility with C++98.  You may now store move-only types
1475   when using Bison's variants.  For instance:
1477     %code {
1478       #include <memory>
1479       #include <vector>
1480     }
1482     %skeleton "lalr1.cc"
1483     %define api.value.type variant
1485     %%
1487     %token <int> INT "int";
1488     %type <std::unique_ptr<int>> int;
1489     %type <std::vector<std::unique_ptr<int>>> list;
1491     list:
1492       %empty    {}
1493     | list int  { $$ = std::move($1); $$.emplace_back(std::move($2)); }
1495     int: "int"  { $$ = std::make_unique<int>($1); }
1497 *** C++: Implicit move of right-hand side values (lalr1.cc)
1499   In modern C++ (C++11 and later), you should always use 'std::move' with
1500   the values of the right-hand side symbols ($1, $2, etc.), as they will be
1501   popped from the stack anyway.  Using 'std::move' is mandatory for
1502   move-only types such as unique_ptr, and it provides a significant speedup
1503   for large types such as std::string, or std::vector, etc.
1505   If '%define api.value.automove' is set, every occurrence '$n' is replaced
1506   by 'std::move ($n)'.  The second rule in the previous grammar can be
1507   simplified to:
1509     list: list int  { $$ = $1; $$.emplace_back($2); }
1511   With automove enabled, the semantic values are no longer lvalues, so do
1512   not use the swap idiom:
1514     list: list int  { std::swap($$, $1); $$.emplace_back($2); }
1516   This idiom is anyway obsolete: it is preferable to move than to swap.
1518   A warning is issued when automove is enabled, and a value is used several
1519   times.
1521     input.yy:16.31-32: warning: multiple occurrences of $2 with api.value.automove enabled [-Wother]
1522     exp: "twice" exp   { $$ = $2 + $2; }
1523                                    ^^
1525   Enabling api.value.automove does not require support for modern C++.  The
1526   generated code is valid C++98/03, but will use copies instead of moves.
1528   The new examples/c++/variant-11.yy shows these features in action.
1530 *** C++: The implicit default semantic action is always run
1532   When variants are enabled, the default action was not run, so
1534     exp: "number"
1536   was equivalent to
1538     exp: "number"  {}
1540   It now behaves like in all the other cases, as
1542     exp: "number"  { $$ = $1; }
1544   possibly using std::move if automove is enabled.
1546   We do not expect backward compatibility issues.  However, beware of
1547   forward compatibility issues: if you rely on default actions with
1548   variants, be sure to '%require "3.2"' to avoid older versions of Bison to
1549   generate incorrect parsers.
1551 *** C++: Renaming location.hh
1553   When both %defines and %locations are enabled, Bison generates a
1554   location.hh file.  If you don't use locations outside of the parser, you
1555   may avoid its creation with:
1557     %define api.location.file none
1559   However this file is useful if, for instance, your parser builds an AST
1560   decorated with locations: you may use Bison's location independently of
1561   Bison's parser.  You can now give it another name, for instance:
1563     %define api.location.file "my-location.hh"
1565   This name can have directory components, and even be absolute.  The name
1566   under which the location file is included is controlled by
1567   api.location.include.
1569   This way it is possible to have several parsers share the same location
1570   file.
1572   For instance, in src/foo/parser.hh, generate the include/ast/loc.hh file:
1574     %locations
1575     %define api.namespace {foo}
1576     %define api.location.file "include/ast/loc.hh"
1577     %define api.location.include {<ast/loc.hh>}
1579   and use it in src/bar/parser.hh:
1581     %locations
1582     %define api.namespace {bar}
1583     %code requires {#include <ast/loc.hh>}
1584     %define api.location.type {bar::location}
1586   Absolute file names are supported, so in your Makefile, passing the flag
1587   -Dapi.location.file='"$(top_srcdir)/include/ast/location.hh"' to bison is
1588   safe.
1590 *** C++: stack.hh and position.hh are deprecated
1592   When asked to generate a header file (%defines), the lalr1.cc skeleton
1593   generates a stack.hh file.  This file had no interest for users; it is now
1594   made useless: its content is included in the parser definition.  It is
1595   still generated for backward compatibility.
1597   When in addition to %defines, location support is requested (%locations),
1598   the file position.hh is also generated.  It is now also useless: its
1599   content is now included in location.hh.
1601   These files are no longer generated when your grammar file requires at
1602   least Bison 3.2 (%require "3.2").
1604 ** Bug fixes
1606   Portability issues on MinGW and VS2015.
1608   Portability issues in the test suite.
1610   Portability/warning issues with Flex.
1613 * Noteworthy changes in release 3.1 (2018-08-27) [stable]
1615 ** Backward incompatible changes
1617   Compiling Bison now requires a C99 compiler---as announced during the
1618   release of Bison 3.0, five years ago.  Generated parsers do not require a
1619   C99 compiler.
1621   Support for DJGPP, which has been unmaintained and untested for years, is
1622   obsolete. Unless there is activity to revive it, the next release of Bison
1623   will have it removed.
1625 ** New features
1627 *** Typed midrule actions
1629   Because their type is unknown to Bison, the values of midrule actions are
1630   not treated like the others: they don't have %printer and %destructor
1631   support.  It also prevents C++ (Bison) variants to handle them properly.
1633   Typed midrule actions address these issues.  Instead of:
1635     exp: { $<ival>$ = 1; } { $<ival>$ = 2; }   { $$ = $<ival>1 + $<ival>2; }
1637   write:
1639     exp: <ival>{ $$ = 1; } <ival>{ $$ = 2; }   { $$ = $1 + $2; }
1641 *** Reports include the type of the symbols
1643   The sections about terminal and nonterminal symbols of the '*.output' file
1644   now specify their declared type.  For instance, for:
1646     %token <ival> NUM
1648   the report now shows '<ival>':
1650     Terminals, with rules where they appear
1652     NUM <ival> (258) 5
1654 *** Diagnostics about useless rules
1656   In the following grammar, the 'exp' nonterminal is trivially useless.  So,
1657   of course, its rules are useless too.
1659     %%
1660     input: '0' | exp
1661     exp: exp '+' exp | exp '-' exp | '(' exp ')'
1663   Previously all the useless rules were reported, including those whose
1664   left-hand side is the 'exp' nonterminal:
1666     warning: 1 nonterminal useless in grammar [-Wother]
1667     warning: 4 rules useless in grammar [-Wother]
1668     2.14-16: warning: nonterminal useless in grammar: exp [-Wother]
1669      input: '0' | exp
1670                   ^^^
1671     2.14-16: warning: rule useless in grammar [-Wother]
1672      input: '0' | exp
1673                   ^^^
1674     3.6-16: warning: rule useless in grammar [-Wother]
1675      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1676           ^^^^^^^^^^^
1677     3.20-30: warning: rule useless in grammar [-Wother]
1678      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1679                         ^^^^^^^^^^^
1680     3.34-44: warning: rule useless in grammar [-Wother]
1681      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1682                                       ^^^^^^^^^^^
1684   Now, rules whose left-hand side symbol is useless are no longer reported
1685   as useless.  The locations of the errors have also been adjusted to point
1686   to the first use of the nonterminal as a left-hand side of a rule:
1688     warning: 1 nonterminal useless in grammar [-Wother]
1689     warning: 4 rules useless in grammar [-Wother]
1690     3.1-3: warning: nonterminal useless in grammar: exp [-Wother]
1691      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1692      ^^^
1693     2.14-16: warning: rule useless in grammar [-Wother]
1694      input: '0' | exp
1695                   ^^^
1697 *** C++: Generated parsers can be compiled with -fno-exceptions (lalr1.cc)
1699   When compiled with exceptions disabled, the generated parsers no longer
1700   uses try/catch clauses.
1702   Currently only GCC and Clang are supported.
1704 ** Documentation
1706 *** A demonstration of variants
1708   A new example was added (installed in .../share/doc/bison/examples),
1709   'variant.yy', which shows how to use (Bison) variants in C++.
1711   The other examples were made nicer to read.
1713 *** Some features are no longer 'experimental'
1715   The following features, mature enough, are no longer flagged as
1716   experimental in the documentation: push parsers, default %printer and
1717   %destructor (typed: <*> and untyped: <>), %define api.value.type union and
1718   variant, Java parsers, XML output, LR family (lr, ielr, lalr), and
1719   semantic predicates (%?).
1721 ** Bug fixes
1723 *** GLR: Predicates support broken by #line directives
1725   Predicates (%?) in GLR such as
1727     widget:
1728       %? {new_syntax} 'w' id new_args
1729     | %?{!new_syntax} 'w' id old_args
1731   were issued with #lines in the middle of C code.
1733 *** Printer and destructor with broken #line directives
1735   The #line directives were not properly escaped when emitting the code for
1736   %printer/%destructor, which resulted in compiler errors if there are
1737   backslashes or double-quotes in the grammar file name.
1739 *** Portability on ICC
1741   The Intel compiler claims compatibility with GCC, yet rejects its _Pragma.
1742   Generated parsers now work around this.
1744 *** Various
1746   There were several small fixes in the test suite and in the build system,
1747   many warnings in bison and in the generated parsers were eliminated.  The
1748   documentation also received its share of minor improvements.
1750   Useless code was removed from C++ parsers, and some of the generated
1751   constructors are more 'natural'.
1754 * Noteworthy changes in release 3.0.5 (2018-05-27) [stable]
1756 ** Bug fixes
1758 *** C++: Fix support of 'syntax_error'
1760   One incorrect 'inline' resulted in linking errors about the constructor of
1761   the syntax_error exception.
1763 *** C++: Fix warnings
1765   GCC 7.3 (with -O1 or -O2 but not -O0 or -O3) issued null-dereference
1766   warnings about yyformat being possibly null.  It also warned about the
1767   deprecated implicit definition of copy constructors when there's a
1768   user-defined (copy) assignment operator.
1770 *** Location of errors
1772   In C++ parsers, out-of-bounds errors can happen when a rule with an empty
1773   ride-hand side raises a syntax error.  The behavior of the default parser
1774   (yacc.c) in such a condition was undefined.
1776   Now all the parsers match the behavior of glr.c: @$ is used as the
1777   location of the error.  This handles gracefully rules with and without
1778   rhs.
1780 *** Portability fixes in the test suite
1782   On some platforms, some Java and/or C++ tests were failing.
1785 * Noteworthy changes in release 3.0.4 (2015-01-23) [stable]
1787 ** Bug fixes
1789 *** C++ with Variants (lalr1.cc)
1791   Fix a compiler warning when no %destructor use $$.
1793 *** Test suites
1795   Several portability issues in tests were fixed.
1798 * Noteworthy changes in release 3.0.3 (2015-01-15) [stable]
1800 ** Bug fixes
1802 *** C++ with Variants (lalr1.cc)
1804   Problems with %destructor and '%define parse.assert' have been fixed.
1806 *** Named %union support (yacc.c, glr.c)
1808   Bison 3.0 introduced a regression on named %union such as
1810     %union foo { int ival; };
1812   The possibility to use a name was introduced "for Yacc compatibility".
1813   It is however not required by POSIX Yacc, and its usefulness is not clear.
1815 *** %define api.value.type union with %defines (yacc.c, glr.c)
1817   The C parsers were broken when %defines was used together with "%define
1818   api.value.type union".
1820 *** Redeclarations are reported in proper order
1822   On
1824     %token FOO "foo"
1825     %printer {} "foo"
1826     %printer {} FOO
1828   bison used to report:
1830     foo.yy:2.10-11: error: %printer redeclaration for FOO
1831      %printer {} "foo"
1832               ^^
1833     foo.yy:3.10-11:     previous declaration
1834      %printer {} FOO
1835               ^^
1837   Now, the "previous" declaration is always the first one.
1840 ** Documentation
1842   Bison now installs various files in its docdir (which defaults to
1843   '/usr/local/share/doc/bison'), including the three fully blown examples
1844   extracted from the documentation:
1846    - rpcalc
1847      Reverse Polish Calculator, a simple introductory example.
1848    - mfcalc
1849      Multi-function Calc, a calculator with memory and functions and located
1850      error messages.
1851    - calc++
1852      a calculator in C++ using variant support and token constructors.
1855 * Noteworthy changes in release 3.0.2 (2013-12-05) [stable]
1857 ** Bug fixes
1859 *** Generated source files when errors are reported
1861   When warnings are issued and -Werror is set, bison would still generate
1862   the source files (*.c, *.h...).  As a consequence, some runs of "make"
1863   could fail the first time, but not the second (as the files were generated
1864   anyway).
1866   This is fixed: bison no longer generates this source files, but, of
1867   course, still produces the various reports (*.output, *.xml, etc.).
1869 *** %empty is used in reports
1871   Empty right-hand sides are denoted by '%empty' in all the reports (text,
1872   dot, XML and formats derived from it).
1874 *** YYERROR and variants
1876   When C++ variant support is enabled, an error triggered via YYERROR, but
1877   not caught via error recovery, resulted in a double deletion.
1880 * Noteworthy changes in release 3.0.1 (2013-11-12) [stable]
1882 ** Bug fixes
1884 *** Errors in caret diagnostics
1886   On some platforms, some errors could result in endless diagnostics.
1888 *** Fixes of the -Werror option
1890   Options such as "-Werror -Wno-error=foo" were still turning "foo"
1891   diagnostics into errors instead of warnings.  This is fixed.
1893   Actually, for consistency with GCC, "-Wno-error=foo -Werror" now also
1894   leaves "foo" diagnostics as warnings.  Similarly, with "-Werror=foo
1895   -Wno-error", "foo" diagnostics are now errors.
1897 *** GLR Predicates
1899   As demonstrated in the documentation, one can now leave spaces between
1900   "%?" and its "{".
1902 *** Installation
1904   The yacc.1 man page is no longer installed if --disable-yacc was
1905   specified.
1907 *** Fixes in the test suite
1909   Bugs and portability issues.
1912 * Noteworthy changes in release 3.0 (2013-07-25) [stable]
1914 ** WARNING: Future backward-incompatibilities!
1916   Like other GNU packages, Bison will start using some of the C99 features
1917   for its own code, especially the definition of variables after statements.
1918   The generated C parsers still aim at C90.
1920 ** Backward incompatible changes
1922 *** Obsolete features
1924   Support for YYFAIL is removed (deprecated in Bison 2.4.2): use YYERROR.
1926   Support for yystype and yyltype is removed (deprecated in Bison 1.875):
1927   use YYSTYPE and YYLTYPE.
1929   Support for YYLEX_PARAM and YYPARSE_PARAM is removed (deprecated in Bison
1930   1.875): use %lex-param, %parse-param, or %param.
1932   Missing semicolons at the end of actions are no longer added (as announced
1933   in the release 2.5).
1935 *** Use of YACC='bison -y'
1937   TL;DR: With Autoconf <= 2.69, pass -Wno-yacc to (AM_)YFLAGS if you use
1938   Bison extensions.
1940   Traditional Yacc generates 'y.tab.c' whatever the name of the input file.
1941   Therefore Makefiles written for Yacc expect 'y.tab.c' (and possibly
1942   'y.tab.h' and 'y.output') to be generated from 'foo.y'.
1944   To this end, for ages, AC_PROG_YACC, Autoconf's macro to look for an
1945   implementation of Yacc, was using Bison as 'bison -y'.  While it does
1946   ensure compatible output file names, it also enables warnings for
1947   incompatibilities with POSIX Yacc.  In other words, 'bison -y' triggers
1948   warnings for Bison extensions.
1950   Autoconf 2.70+ fixes this incompatibility by using YACC='bison -o y.tab.c'
1951   (which also generates 'y.tab.h' and 'y.output' when needed).
1952   Alternatively, disable Yacc warnings by passing '-Wno-yacc' to your Yacc
1953   flags (YFLAGS, or AM_YFLAGS with Automake).
1955 ** Bug fixes
1957 *** The epilogue is no longer affected by internal #defines (glr.c)
1959   The glr.c skeleton uses defines such as #define yylval (yystackp->yyval) in
1960   generated code.  These weren't properly undefined before the inclusion of
1961   the user epilogue, so functions such as the following were butchered by the
1962   preprocessor expansion:
1964     int yylex (YYSTYPE *yylval);
1966   This is fixed: yylval, yynerrs, yychar, and yylloc are now valid
1967   identifiers for user-provided variables.
1969 *** stdio.h is no longer needed when locations are enabled (yacc.c)
1971   Changes in Bison 2.7 introduced a dependency on FILE and fprintf when
1972   locations are enabled.  This is fixed.
1974 *** Warnings about useless %pure-parser/%define api.pure are restored
1976 ** Diagnostics reported by Bison
1978   Most of these features were contributed by Théophile Ranquet and Victor
1979   Santet.
1981 *** Carets
1983   Version 2.7 introduced caret errors, for a prettier output.  These are now
1984   activated by default.  The old format can still be used by invoking Bison
1985   with -fno-caret (or -fnone).
1987   Some error messages that reproduced excerpts of the grammar are now using
1988   the caret information only.  For instance on:
1990     %%
1991     exp: 'a' | 'a';
1993   Bison 2.7 reports:
1995     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
1996     in.y:2.12-14: warning: rule useless in parser due to conflicts: exp: 'a' [-Wother]
1998   Now bison reports:
2000     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2001     in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
2002      exp: 'a' | 'a';
2003                 ^^^
2005   and "bison -fno-caret" reports:
2007     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2008     in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
2010 *** Enhancements of the -Werror option
2012   The -Werror=CATEGORY option is now recognized, and will treat specified
2013   warnings as errors. The warnings need not have been explicitly activated
2014   using the -W option, this is similar to what GCC 4.7 does.
2016   For example, given the following command line, Bison will treat both
2017   warnings related to POSIX Yacc incompatibilities and S/R conflicts as
2018   errors (and only those):
2020     $ bison -Werror=yacc,error=conflicts-sr input.y
2022   If no categories are specified, -Werror will make all active warnings into
2023   errors. For example, the following line does the same the previous example:
2025     $ bison -Werror -Wnone -Wyacc -Wconflicts-sr input.y
2027   (By default -Wconflicts-sr,conflicts-rr,deprecated,other is enabled.)
2029   Note that the categories in this -Werror option may not be prefixed with
2030   "no-". However, -Wno-error[=CATEGORY] is valid.
2032   Note that -y enables -Werror=yacc. Therefore it is now possible to require
2033   Yacc-like behavior (e.g., always generate y.tab.c), but to report
2034   incompatibilities as warnings: "-y -Wno-error=yacc".
2036 *** The display of warnings is now richer
2038   The option that controls a given warning is now displayed:
2040     foo.y:4.6: warning: type clash on default action: <foo> != <bar> [-Wother]
2042   In the case of warnings treated as errors, the prefix is changed from
2043   "warning: " to "error: ", and the suffix is displayed, in a manner similar
2044   to GCC, as [-Werror=CATEGORY].
2046   For instance, where the previous version of Bison would report (and exit
2047   with failure):
2049     bison: warnings being treated as errors
2050     input.y:1.1: warning: stray ',' treated as white space
2052   it now reports:
2054     input.y:1.1: error: stray ',' treated as white space [-Werror=other]
2056 *** Deprecated constructs
2058   The new 'deprecated' warning category flags obsolete constructs whose
2059   support will be discontinued.  It is enabled by default.  These warnings
2060   used to be reported as 'other' warnings.
2062 *** Useless semantic types
2064   Bison now warns about useless (uninhabited) semantic types.  Since
2065   semantic types are not declared to Bison (they are defined in the opaque
2066   %union structure), it is %printer/%destructor directives about useless
2067   types that trigger the warning:
2069     %token <type1> term
2070     %type  <type2> nterm
2071     %printer    {} <type1> <type3>
2072     %destructor {} <type2> <type4>
2073     %%
2074     nterm: term { $$ = $1; };
2076     3.28-34: warning: type <type3> is used, but is not associated to any symbol
2077     4.28-34: warning: type <type4> is used, but is not associated to any symbol
2079 *** Undefined but unused symbols
2081   Bison used to raise an error for undefined symbols that are not used in
2082   the grammar.  This is now only a warning.
2084     %printer    {} symbol1
2085     %destructor {} symbol2
2086     %type <type>   symbol3
2087     %%
2088     exp: "a";
2090 *** Useless destructors or printers
2092   Bison now warns about useless destructors or printers.  In the following
2093   example, the printer for <type1>, and the destructor for <type2> are
2094   useless: all symbols of <type1> (token1) already have a printer, and all
2095   symbols of type <type2> (token2) already have a destructor.
2097     %token <type1> token1
2098            <type2> token2
2099            <type3> token3
2100            <type4> token4
2101     %printer    {} token1 <type1> <type3>
2102     %destructor {} token2 <type2> <type4>
2104 *** Conflicts
2106   The warnings and error messages about shift/reduce and reduce/reduce
2107   conflicts have been normalized.  For instance on the following foo.y file:
2109     %glr-parser
2110     %%
2111     exp: exp '+' exp | '0' | '0';
2113   compare the previous version of bison:
2115     $ bison foo.y
2116     foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2117     $ bison -Werror foo.y
2118     bison: warnings being treated as errors
2119     foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2121   with the new behavior:
2123     $ bison foo.y
2124     foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
2125     foo.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
2126     $ bison -Werror foo.y
2127     foo.y: error: 1 shift/reduce conflict [-Werror=conflicts-sr]
2128     foo.y: error: 2 reduce/reduce conflicts [-Werror=conflicts-rr]
2130   When %expect or %expect-rr is used, such as with bar.y:
2132     %expect 0
2133     %glr-parser
2134     %%
2135     exp: exp '+' exp | '0' | '0';
2137   Former behavior:
2139     $ bison bar.y
2140     bar.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2141     bar.y: expected 0 shift/reduce conflicts
2142     bar.y: expected 0 reduce/reduce conflicts
2144   New one:
2146     $ bison bar.y
2147     bar.y: error: shift/reduce conflicts: 1 found, 0 expected
2148     bar.y: error: reduce/reduce conflicts: 2 found, 0 expected
2150 ** Incompatibilities with POSIX Yacc
2152   The 'yacc' category is no longer part of '-Wall', enable it explicitly
2153   with '-Wyacc'.
2155 ** Additional yylex/yyparse arguments
2157   The new directive %param declares additional arguments to both yylex and
2158   yyparse.  The %lex-param, %parse-param, and %param directives support one
2159   or more arguments.  Instead of
2161     %lex-param   {arg1_type *arg1}
2162     %lex-param   {arg2_type *arg2}
2163     %parse-param {arg1_type *arg1}
2164     %parse-param {arg2_type *arg2}
2166   one may now declare
2168     %param {arg1_type *arg1} {arg2_type *arg2}
2170 ** Types of values for %define variables
2172   Bison used to make no difference between '%define foo bar' and '%define
2173   foo "bar"'.  The former is now called a 'keyword value', and the latter a
2174   'string value'.  A third kind was added: 'code values', such as '%define
2175   foo {bar}'.
2177   Keyword variables are used for fixed value sets, e.g.,
2179     %define lr.type lalr
2181   Code variables are used for value in the target language, e.g.,
2183     %define api.value.type {struct semantic_type}
2185   String variables are used remaining cases, e.g. file names.
2187 ** Variable api.token.prefix
2189   The variable api.token.prefix changes the way tokens are identified in
2190   the generated files.  This is especially useful to avoid collisions
2191   with identifiers in the target language.  For instance
2193     %token FILE for ERROR
2194     %define api.token.prefix {TOK_}
2195     %%
2196     start: FILE for ERROR;
2198   will generate the definition of the symbols TOK_FILE, TOK_for, and
2199   TOK_ERROR in the generated sources.  In particular, the scanner must
2200   use these prefixed token names, although the grammar itself still
2201   uses the short names (as in the sample rule given above).
2203 ** Variable api.value.type
2205   This new %define variable supersedes the #define macro YYSTYPE.  The use
2206   of YYSTYPE is discouraged.  In particular, #defining YYSTYPE *and* either
2207   using %union or %defining api.value.type results in undefined behavior.
2209   Either define api.value.type, or use "%union":
2211     %union
2212     {
2213       int ival;
2214       char *sval;
2215     }
2216     %token <ival> INT "integer"
2217     %token <sval> STRING "string"
2218     %printer { fprintf (yyo, "%d", $$); } <ival>
2219     %destructor { free ($$); } <sval>
2221     /* In yylex().  */
2222     yylval.ival = 42; return INT;
2223     yylval.sval = "42"; return STRING;
2225   The %define variable api.value.type supports both keyword and code values.
2227   The keyword value 'union' means that the user provides genuine types, not
2228   union member names such as "ival" and "sval" above (WARNING: will fail if
2229   -y/--yacc/%yacc is enabled).
2231     %define api.value.type union
2232     %token <int> INT "integer"
2233     %token <char *> STRING "string"
2234     %printer { fprintf (yyo, "%d", $$); } <int>
2235     %destructor { free ($$); } <char *>
2237     /* In yylex().  */
2238     yylval.INT = 42; return INT;
2239     yylval.STRING = "42"; return STRING;
2241   The keyword value variant is somewhat equivalent, but for C++ special
2242   provision is made to allow classes to be used (more about this below).
2244     %define api.value.type variant
2245     %token <int> INT "integer"
2246     %token <std::string> STRING "string"
2248   Code values (in braces) denote user defined types.  This is where YYSTYPE
2249   used to be used.
2251     %code requires
2252     {
2253       struct my_value
2254       {
2255         enum
2256         {
2257           is_int, is_string
2258         } kind;
2259         union
2260         {
2261           int ival;
2262           char *sval;
2263         } u;
2264       };
2265     }
2266     %define api.value.type {struct my_value}
2267     %token <u.ival> INT "integer"
2268     %token <u.sval> STRING "string"
2269     %printer { fprintf (yyo, "%d", $$); } <u.ival>
2270     %destructor { free ($$); } <u.sval>
2272     /* In yylex().  */
2273     yylval.u.ival = 42; return INT;
2274     yylval.u.sval = "42"; return STRING;
2276 ** Variable parse.error
2278   This variable controls the verbosity of error messages.  The use of the
2279   %error-verbose directive is deprecated in favor of "%define parse.error
2280   verbose".
2282 ** Deprecated %define variable names
2284   The following variables have been renamed for consistency.  Backward
2285   compatibility is ensured, but upgrading is recommended.
2287     lr.default-reductions      -> lr.default-reduction
2288     lr.keep-unreachable-states -> lr.keep-unreachable-state
2289     namespace                  -> api.namespace
2290     stype                      -> api.value.type
2292 ** Semantic predicates
2294   Contributed by Paul Hilfinger.
2296   The new, experimental, semantic-predicate feature allows actions of the
2297   form "%?{ BOOLEAN-EXPRESSION }", which cause syntax errors (as for
2298   YYERROR) if the expression evaluates to 0, and are evaluated immediately
2299   in GLR parsers, rather than being deferred.  The result is that they allow
2300   the programmer to prune possible parses based on the values of run-time
2301   expressions.
2303 ** The directive %expect-rr is now an error in non GLR mode
2305   It used to be an error only if used in non GLR mode, _and_ if there are
2306   reduce/reduce conflicts.
2308 ** Tokens are numbered in their order of appearance
2310   Contributed by Valentin Tolmer.
2312   With '%token A B', A had a number less than the one of B.  However,
2313   precedence declarations used to generate a reversed order.  This is now
2314   fixed, and introducing tokens with any of %token, %left, %right,
2315   %precedence, or %nonassoc yields the same result.
2317   When mixing declarations of tokens with a literal character (e.g., 'a') or
2318   with an identifier (e.g., B) in a precedence declaration, Bison numbered
2319   the literal characters first.  For example
2321     %right A B 'c' 'd'
2323   would lead to the tokens declared in this order: 'c' 'd' A B.  Again, the
2324   input order is now preserved.
2326   These changes were made so that one can remove useless precedence and
2327   associativity declarations (i.e., map %nonassoc, %left or %right to
2328   %precedence, or to %token) and get exactly the same output.
2330 ** Useless precedence and associativity
2332   Contributed by Valentin Tolmer.
2334   When developing and maintaining a grammar, useless associativity and
2335   precedence directives are common.  They can be a nuisance: new ambiguities
2336   arising are sometimes masked because their conflicts are resolved due to
2337   the extra precedence or associativity information.  Furthermore, it can
2338   hinder the comprehension of a new grammar: one will wonder about the role
2339   of a precedence, where in fact it is useless.  The following changes aim
2340   at detecting and reporting these extra directives.
2342 *** Precedence warning category
2344   A new category of warning, -Wprecedence, was introduced. It flags the
2345   useless precedence and associativity directives.
2347 *** Useless associativity
2349   Bison now warns about symbols with a declared associativity that is never
2350   used to resolve conflicts.  In that case, using %precedence is sufficient;
2351   the parsing tables will remain unchanged.  Solving these warnings may raise
2352   useless precedence warnings, as the symbols no longer have associativity.
2353   For example:
2355     %left '+'
2356     %left '*'
2357     %%
2358     exp:
2359       "number"
2360     | exp '+' "number"
2361     | exp '*' exp
2362     ;
2364   will produce a
2366     warning: useless associativity for '+', use %precedence [-Wprecedence]
2367      %left '+'
2368            ^^^
2370 *** Useless precedence
2372   Bison now warns about symbols with a declared precedence and no declared
2373   associativity (i.e., declared with %precedence), and whose precedence is
2374   never used.  In that case, the symbol can be safely declared with %token
2375   instead, without modifying the parsing tables.  For example:
2377     %precedence '='
2378     %%
2379     exp: "var" '=' "number";
2381   will produce a
2383     warning: useless precedence for '=' [-Wprecedence]
2384      %precedence '='
2385                  ^^^
2387 *** Useless precedence and associativity
2389   In case of both useless precedence and associativity, the issue is flagged
2390   as follows:
2392     %nonassoc '='
2393     %%
2394     exp: "var" '=' "number";
2396   The warning is:
2398     warning: useless precedence and associativity for '=' [-Wprecedence]
2399      %nonassoc '='
2400                ^^^
2402 ** Empty rules
2404   With help from Joel E. Denny and Gabriel Rassoul.
2406   Empty rules (i.e., with an empty right-hand side) can now be explicitly
2407   marked by the new %empty directive.  Using %empty on a non-empty rule is
2408   an error.  The new -Wempty-rule warning reports empty rules without
2409   %empty.  On the following grammar:
2411     %%
2412     s: a b c;
2413     a: ;
2414     b: %empty;
2415     c: 'a' %empty;
2417   bison reports:
2419     3.4-5: warning: empty rule without %empty [-Wempty-rule]
2420      a: {}
2421         ^^
2422     5.8-13: error: %empty on non-empty rule
2423      c: 'a' %empty {};
2424             ^^^^^^
2426 ** Java skeleton improvements
2428   The constants for token names were moved to the Lexer interface.  Also, it
2429   is possible to add code to the parser's constructors using "%code init"
2430   and "%define init_throws".
2431   Contributed by Paolo Bonzini.
2433   The Java skeleton now supports push parsing.
2434   Contributed by Dennis Heimbigner.
2436 ** C++ skeletons improvements
2438 *** The parser header is no longer mandatory (lalr1.cc, glr.cc)
2440   Using %defines is now optional.  Without it, the needed support classes
2441   are defined in the generated parser, instead of additional files (such as
2442   location.hh, position.hh and stack.hh).
2444 *** Locations are no longer mandatory (lalr1.cc, glr.cc)
2446   Both lalr1.cc and glr.cc no longer require %location.
2448 *** syntax_error exception (lalr1.cc)
2450   The C++ parser features a syntax_error exception, which can be
2451   thrown from the scanner or from user rules to raise syntax errors.
2452   This facilitates reporting errors caught in sub-functions (e.g.,
2453   rejecting too large integral literals from a conversion function
2454   used by the scanner, or rejecting invalid combinations from a
2455   factory invoked by the user actions).
2457 *** %define api.value.type variant
2459   This is based on a submission from Michiel De Wilde.  With help
2460   from Théophile Ranquet.
2462   In this mode, complex C++ objects can be used as semantic values.  For
2463   instance:
2465     %token <::std::string> TEXT;
2466     %token <int> NUMBER;
2467     %token SEMICOLON ";"
2468     %type <::std::string> item;
2469     %type <::std::list<std::string>> list;
2470     %%
2471     result:
2472       list  { std::cout << $1 << std::endl; }
2473     ;
2475     list:
2476       %empty        { /* Generates an empty string list. */ }
2477     | list item ";" { std::swap ($$, $1); $$.push_back ($2); }
2478     ;
2480     item:
2481       TEXT    { std::swap ($$, $1); }
2482     | NUMBER  { $$ = string_cast ($1); }
2483     ;
2485 *** %define api.token.constructor
2487   When variants are enabled, Bison can generate functions to build the
2488   tokens.  This guarantees that the token type (e.g., NUMBER) is consistent
2489   with the semantic value (e.g., int):
2491     parser::symbol_type yylex ()
2492     {
2493       parser::location_type loc = ...;
2494       ...
2495       return parser::make_TEXT ("Hello, world!", loc);
2496       ...
2497       return parser::make_NUMBER (42, loc);
2498       ...
2499       return parser::make_SEMICOLON (loc);
2500       ...
2501     }
2503 *** C++ locations
2505   There are operator- and operator-= for 'location'.  Negative line/column
2506   increments can no longer underflow the resulting value.
2509 * Noteworthy changes in release 2.7.1 (2013-04-15) [stable]
2511 ** Bug fixes
2513 *** Fix compiler attribute portability (yacc.c)
2515   With locations enabled, __attribute__ was used unprotected.
2517 *** Fix some compiler warnings (lalr1.cc)
2520 * Noteworthy changes in release 2.7 (2012-12-12) [stable]
2522 ** Bug fixes
2524   Warnings about uninitialized yylloc in yyparse have been fixed.
2526   Restored C90 compliance (yet no report was ever made).
2528 ** Diagnostics are improved
2530   Contributed by Théophile Ranquet.
2532 *** Changes in the format of error messages
2534   This used to be the format of many error reports:
2536     input.y:2.7-12: %type redeclaration for exp
2537     input.y:1.7-12: previous declaration
2539   It is now:
2541     input.y:2.7-12: error: %type redeclaration for exp
2542     input.y:1.7-12:     previous declaration
2544 *** New format for error reports: carets
2546   Caret errors have been added to Bison:
2548     input.y:2.7-12: error: %type redeclaration for exp
2549      %type <sval> exp
2550            ^^^^^^
2551     input.y:1.7-12:     previous declaration
2552      %type <ival> exp
2553            ^^^^^^
2555   or
2557     input.y:3.20-23: error: ambiguous reference: '$exp'
2558      exp: exp '+' exp { $exp = $1 + $3; };
2559                         ^^^^
2560     input.y:3.1-3:       refers to: $exp at $$
2561      exp: exp '+' exp { $exp = $1 + $3; };
2562      ^^^
2563     input.y:3.6-8:       refers to: $exp at $1
2564      exp: exp '+' exp { $exp = $1 + $3; };
2565           ^^^
2566     input.y:3.14-16:     refers to: $exp at $3
2567      exp: exp '+' exp { $exp = $1 + $3; };
2568                   ^^^
2570   The default behavior for now is still not to display these unless
2571   explicitly asked with -fcaret (or -fall). However, in a later release, it
2572   will be made the default behavior (but may still be deactivated with
2573   -fno-caret).
2575 ** New value for %define variable: api.pure full
2577   The %define variable api.pure requests a pure (reentrant) parser. However,
2578   for historical reasons, using it in a location-tracking Yacc parser
2579   resulted in a yyerror function that did not take a location as a
2580   parameter. With this new value, the user may request a better pure parser,
2581   where yyerror does take a location as a parameter (in location-tracking
2582   parsers).
2584   The use of "%define api.pure true" is deprecated in favor of this new
2585   "%define api.pure full".
2587 ** New %define variable: api.location.type (glr.cc, lalr1.cc, lalr1.java)
2589   The %define variable api.location.type defines the name of the type to use
2590   for locations.  When defined, Bison no longer generates the position.hh
2591   and location.hh files, nor does the parser will include them: the user is
2592   then responsible to define her type.
2594   This can be used in programs with several parsers to factor their location
2595   and position files: let one of them generate them, and the others just use
2596   them.
2598   This feature was actually introduced, but not documented, in Bison 2.5,
2599   under the name "location_type" (which is maintained for backward
2600   compatibility).
2602   For consistency, lalr1.java's %define variables location_type and
2603   position_type are deprecated in favor of api.location.type and
2604   api.position.type.
2606 ** Exception safety (lalr1.cc)
2608   The parse function now catches exceptions, uses the %destructors to
2609   release memory (the lookahead symbol and the symbols pushed on the stack)
2610   before re-throwing the exception.
2612   This feature is somewhat experimental.  User feedback would be
2613   appreciated.
2615 ** Graph improvements in DOT and XSLT
2617   Contributed by Théophile Ranquet.
2619   The graphical presentation of the states is more readable: their shape is
2620   now rectangular, the state number is clearly displayed, and the items are
2621   numbered and left-justified.
2623   The reductions are now explicitly represented as transitions to other
2624   diamond shaped nodes.
2626   These changes are present in both --graph output and xml2dot.xsl XSLT
2627   processing, with minor (documented) differences.
2629 ** %language is no longer an experimental feature.
2631   The introduction of this feature, in 2.4, was four years ago. The
2632   --language option and the %language directive are no longer experimental.
2634 ** Documentation
2636   The sections about shift/reduce and reduce/reduce conflicts resolution
2637   have been fixed and extended.
2639   Although introduced more than four years ago, XML and Graphviz reports
2640   were not properly documented.
2642   The translation of midrule actions is now described.
2645 * Noteworthy changes in release 2.6.5 (2012-11-07) [stable]
2647   We consider compiler warnings about Bison generated parsers to be bugs.
2648   Rather than working around them in your own project, please consider
2649   reporting them to us.
2651 ** Bug fixes
2653   Warnings about uninitialized yylval and/or yylloc for push parsers with a
2654   pure interface have been fixed for GCC 4.0 up to 4.8, and Clang 2.9 to
2655   3.2.
2657   Other issues in the test suite have been addressed.
2659   Null characters are correctly displayed in error messages.
2661   When possible, yylloc is correctly initialized before calling yylex.  It
2662   is no longer necessary to initialize it in the %initial-action.
2665 * Noteworthy changes in release 2.6.4 (2012-10-23) [stable]
2667   Bison 2.6.3's --version was incorrect.  This release fixes this issue.
2670 * Noteworthy changes in release 2.6.3 (2012-10-22) [stable]
2672 ** Bug fixes
2674   Bugs and portability issues in the test suite have been fixed.
2676   Some errors in translations have been addressed, and --help now directs
2677   users to the appropriate place to report them.
2679   Stray Info files shipped by accident are removed.
2681   Incorrect definitions of YY_, issued by yacc.c when no parser header is
2682   generated, are removed.
2684   All the generated headers are self-contained.
2686 ** Header guards (yacc.c, glr.c, glr.cc)
2688   In order to avoid collisions, the header guards are now
2689   YY_<PREFIX>_<FILE>_INCLUDED, instead of merely <PREFIX>_<FILE>.
2690   For instance the header generated from
2692     %define api.prefix "calc"
2693     %defines "lib/parse.h"
2695   will use YY_CALC_LIB_PARSE_H_INCLUDED as guard.
2697 ** Fix compiler warnings in the generated parser (yacc.c, glr.c)
2699   The compilation of pure parsers (%define api.pure) can trigger GCC
2700   warnings such as:
2702     input.c: In function 'yyparse':
2703     input.c:1503:12: warning: 'yylval' may be used uninitialized in this
2704                               function [-Wmaybe-uninitialized]
2705        *++yyvsp = yylval;
2706                 ^
2708   This is now fixed; pragmas to avoid these warnings are no longer needed.
2710   Warnings from clang ("equality comparison with extraneous parentheses" and
2711   "function declared 'noreturn' should not return") have also been
2712   addressed.
2715 * Noteworthy changes in release 2.6.2 (2012-08-03) [stable]
2717 ** Bug fixes
2719   Buffer overruns, complaints from Flex, and portability issues in the test
2720   suite have been fixed.
2722 ** Spaces in %lex- and %parse-param (lalr1.cc, glr.cc)
2724   Trailing end-of-lines in %parse-param or %lex-param would result in
2725   invalid C++.  This is fixed.
2727 ** Spurious spaces and end-of-lines
2729   The generated files no longer end (nor start) with empty lines.
2732 * Noteworthy changes in release 2.6.1 (2012-07-30) [stable]
2734  Bison no longer executes user-specified M4 code when processing a grammar.
2736 ** Future Changes
2738   In addition to the removal of the features announced in Bison 2.6, the
2739   next major release will remove the "Temporary hack for adding a semicolon
2740   to the user action", as announced in the release 2.5.  Instead of:
2742     exp: exp "+" exp { $$ = $1 + $3 };
2744   write:
2746     exp: exp "+" exp { $$ = $1 + $3; };
2748 ** Bug fixes
2750 *** Type names are now properly escaped.
2752 *** glr.cc: set_debug_level and debug_level work as expected.
2754 *** Stray @ or $ in actions
2756   While Bison used to warn about stray $ or @ in action rules, it did not
2757   for other actions such as printers, destructors, or initial actions.  It
2758   now does.
2760 ** Type names in actions
2762   For consistency with rule actions, it is now possible to qualify $$ by a
2763   type-name in destructors, printers, and initial actions.  For instance:
2765     %printer { fprintf (yyo, "(%d, %f)", $<ival>$, $<fval>$); } <*> <>;
2767   will display two values for each typed and untyped symbol (provided
2768   that YYSTYPE has both "ival" and "fval" fields).
2771 * Noteworthy changes in release 2.6 (2012-07-19) [stable]
2773 ** Future changes
2775   The next major release of Bison will drop support for the following
2776   deprecated features.  Please report disagreements to bug-bison@gnu.org.
2778 *** K&R C parsers
2780   Support for generating parsers in K&R C will be removed.  Parsers
2781   generated for C support ISO C90, and are tested with ISO C99 and ISO C11
2782   compilers.
2784 *** Features deprecated since Bison 1.875
2786   The definitions of yystype and yyltype will be removed; use YYSTYPE and
2787   YYLTYPE.
2789   YYPARSE_PARAM and YYLEX_PARAM, deprecated in favor of %parse-param and
2790   %lex-param, will no longer be supported.
2792   Support for the preprocessor symbol YYERROR_VERBOSE will be removed, use
2793   %error-verbose.
2795 *** The generated header will be included (yacc.c)
2797   Instead of duplicating the content of the generated header (definition of
2798   YYSTYPE, yyparse declaration etc.), the generated parser will include it,
2799   as is already the case for GLR or C++ parsers.  This change is deferred
2800   because existing versions of ylwrap (e.g., Automake 1.12.1) do not support
2801   it.
2803 ** Generated Parser Headers
2805 *** Guards (yacc.c, glr.c, glr.cc)
2807   The generated headers are now guarded, as is already the case for C++
2808   parsers (lalr1.cc).  For instance, with --defines=foo.h:
2810     #ifndef YY_FOO_H
2811     # define YY_FOO_H
2812     ...
2813     #endif /* !YY_FOO_H  */
2815 *** New declarations (yacc.c, glr.c)
2817   The generated header now declares yydebug and yyparse.  Both honor
2818   --name-prefix=bar_, and yield
2820     int bar_parse (void);
2822   rather than
2824     #define yyparse bar_parse
2825     int yyparse (void);
2827   in order to facilitate the inclusion of several parser headers inside a
2828   single compilation unit.
2830 *** Exported symbols in C++
2832   The symbols YYTOKEN_TABLE and YYERROR_VERBOSE, which were defined in the
2833   header, are removed, as they prevent the possibility of including several
2834   generated headers from a single compilation unit.
2836 *** YYLSP_NEEDED
2838   For the same reasons, the undocumented and unused macro YYLSP_NEEDED is no
2839   longer defined.
2841 ** New %define variable: api.prefix
2843   Now that the generated headers are more complete and properly protected
2844   against multiple inclusions, constant names, such as YYSTYPE are a
2845   problem.  While yyparse and others are properly renamed by %name-prefix,
2846   YYSTYPE, YYDEBUG and others have never been affected by it.  Because it
2847   would introduce backward compatibility issues in projects not expecting
2848   YYSTYPE to be renamed, instead of changing the behavior of %name-prefix,
2849   it is deprecated in favor of a new %define variable: api.prefix.
2851   The following examples compares both:
2853     %name-prefix "bar_"               | %define api.prefix "bar_"
2854     %token <ival> FOO                   %token <ival> FOO
2855     %union { int ival; }                %union { int ival; }
2856     %%                                  %%
2857     exp: 'a';                           exp: 'a';
2859   bison generates:
2861     #ifndef BAR_FOO_H                   #ifndef BAR_FOO_H
2862     # define BAR_FOO_H                  # define BAR_FOO_H
2864     /* Enabling traces.  */             /* Enabling traces.  */
2865     # ifndef YYDEBUG                  | # ifndef BAR_DEBUG
2866                                       > #  if defined YYDEBUG
2867                                       > #   if YYDEBUG
2868                                       > #    define BAR_DEBUG 1
2869                                       > #   else
2870                                       > #    define BAR_DEBUG 0
2871                                       > #   endif
2872                                       > #  else
2873     #  define YYDEBUG 0               | #   define BAR_DEBUG 0
2874                                       > #  endif
2875     # endif                           | # endif
2877     # if YYDEBUG                      | # if BAR_DEBUG
2878     extern int bar_debug;               extern int bar_debug;
2879     # endif                             # endif
2881     /* Tokens.  */                      /* Tokens.  */
2882     # ifndef YYTOKENTYPE              | # ifndef BAR_TOKENTYPE
2883     #  define YYTOKENTYPE             | #  define BAR_TOKENTYPE
2884        enum yytokentype {             |    enum bar_tokentype {
2885          FOO = 258                           FOO = 258
2886        };                                  };
2887     # endif                             # endif
2889     #if ! defined YYSTYPE \           | #if ! defined BAR_STYPE \
2890      && ! defined YYSTYPE_IS_DECLARED |  && ! defined BAR_STYPE_IS_DECLARED
2891     typedef union YYSTYPE             | typedef union BAR_STYPE
2892     {                                   {
2893      int ival;                           int ival;
2894     } YYSTYPE;                        | } BAR_STYPE;
2895     # define YYSTYPE_IS_DECLARED 1    | # define BAR_STYPE_IS_DECLARED 1
2896     #endif                              #endif
2898     extern YYSTYPE bar_lval;          | extern BAR_STYPE bar_lval;
2900     int bar_parse (void);               int bar_parse (void);
2902     #endif /* !BAR_FOO_H  */            #endif /* !BAR_FOO_H  */
2905 * Noteworthy changes in release 2.5.1 (2012-06-05) [stable]
2907 ** Future changes:
2909   The next major release will drop support for generating parsers in K&R C.
2911 ** yacc.c: YYBACKUP works as expected.
2913 ** glr.c improvements:
2915 *** Location support is eliminated when not requested:
2917   GLR parsers used to include location-related code even when locations were
2918   not requested, and therefore not even usable.
2920 *** __attribute__ is preserved:
2922   __attribute__ is no longer disabled when __STRICT_ANSI__ is defined (i.e.,
2923   when -std is passed to GCC).
2925 ** lalr1.java: several fixes:
2927   The Java parser no longer throws ArrayIndexOutOfBoundsException if the
2928   first token leads to a syntax error.  Some minor clean ups.
2930 ** Changes for C++:
2932 *** C++11 compatibility:
2934   C and C++ parsers use "nullptr" instead of "0" when __cplusplus is 201103L
2935   or higher.
2937 *** Header guards
2939   The header files such as "parser.hh", "location.hh", etc. used a constant
2940   name for preprocessor guards, for instance:
2942     #ifndef BISON_LOCATION_HH
2943     # define BISON_LOCATION_HH
2944     ...
2945     #endif // !BISON_LOCATION_HH
2947   The inclusion guard is now computed from "PREFIX/FILE-NAME", where lower
2948   case characters are converted to upper case, and series of
2949   non-alphanumerical characters are converted to an underscore.
2951   With "bison -o lang++/parser.cc", "location.hh" would now include:
2953     #ifndef YY_LANG_LOCATION_HH
2954     # define YY_LANG_LOCATION_HH
2955     ...
2956     #endif // !YY_LANG_LOCATION_HH
2958 *** C++ locations:
2960   The position and location constructors (and their initialize methods)
2961   accept new arguments for line and column.  Several issues in the
2962   documentation were fixed.
2964 ** liby is no longer asking for "rpl_fprintf" on some platforms.
2966 ** Changes in the manual:
2968 *** %printer is documented
2970   The "%printer" directive, supported since at least Bison 1.50, is finally
2971   documented.  The "mfcalc" example is extended to demonstrate it.
2973   For consistency with the C skeletons, the C++ parsers now also support
2974   "yyoutput" (as an alias to "debug_stream ()").
2976 *** Several improvements have been made:
2978   The layout for grammar excerpts was changed to a more compact scheme.
2979   Named references are motivated.  The description of the automaton
2980   description file (*.output) is updated to the current format.  Incorrect
2981   index entries were fixed.  Some other errors were fixed.
2983 ** Building bison:
2985 *** Conflicting prototypes with recent/modified Flex.
2987   Fixed build problems with the current, unreleased, version of Flex, and
2988   some modified versions of 2.5.35, which have modified function prototypes.
2990 *** Warnings during the build procedure have been eliminated.
2992 *** Several portability problems in the test suite have been fixed:
2994   This includes warnings with some compilers, unexpected behavior of tools
2995   such as diff, warning messages from the test suite itself, etc.
2997 *** The install-pdf target works properly:
2999   Running "make install-pdf" (or -dvi, -html, -info, and -ps) no longer
3000   halts in the middle of its course.
3003 * Noteworthy changes in release 2.5 (2011-05-14)
3005 ** Grammar symbol names can now contain non-initial dashes:
3007   Consistently with directives (such as %error-verbose) and with
3008   %define variables (e.g. push-pull), grammar symbol names may contain
3009   dashes in any position except the beginning.  This is a GNU
3010   extension over POSIX Yacc.  Thus, use of this extension is reported
3011   by -Wyacc and rejected in Yacc mode (--yacc).
3013 ** Named references:
3015   Historically, Yacc and Bison have supported positional references
3016   ($n, $$) to allow access to symbol values from inside of semantic
3017   actions code.
3019   Starting from this version, Bison can also accept named references.
3020   When no ambiguity is possible, original symbol names may be used
3021   as named references:
3023     if_stmt : "if" cond_expr "then" then_stmt ';'
3024     { $if_stmt = mk_if_stmt($cond_expr, $then_stmt); }
3026   In the more common case, explicit names may be declared:
3028     stmt[res] : "if" expr[cond] "then" stmt[then] "else" stmt[else] ';'
3029     { $res = mk_if_stmt($cond, $then, $else); }
3031   Location information is also accessible using @name syntax.  When
3032   accessing symbol names containing dots or dashes, explicit bracketing
3033   ($[sym.1]) must be used.
3035   These features are experimental in this version.  More user feedback
3036   will help to stabilize them.
3037   Contributed by Alex Rozenman.
3039 ** IELR(1) and canonical LR(1):
3041   IELR(1) is a minimal LR(1) parser table generation algorithm.  That
3042   is, given any context-free grammar, IELR(1) generates parser tables
3043   with the full language-recognition power of canonical LR(1) but with
3044   nearly the same number of parser states as LALR(1).  This reduction
3045   in parser states is often an order of magnitude.  More importantly,
3046   because canonical LR(1)'s extra parser states may contain duplicate
3047   conflicts in the case of non-LR(1) grammars, the number of conflicts
3048   for IELR(1) is often an order of magnitude less as well.  This can
3049   significantly reduce the complexity of developing of a grammar.
3051   Bison can now generate IELR(1) and canonical LR(1) parser tables in
3052   place of its traditional LALR(1) parser tables, which remain the
3053   default.  You can specify the type of parser tables in the grammar
3054   file with these directives:
3056     %define lr.type lalr
3057     %define lr.type ielr
3058     %define lr.type canonical-lr
3060   The default-reduction optimization in the parser tables can also be
3061   adjusted using "%define lr.default-reductions".  For details on both
3062   of these features, see the new section "Tuning LR" in the Bison
3063   manual.
3065   These features are experimental.  More user feedback will help to
3066   stabilize them.
3068 ** LAC (Lookahead Correction) for syntax error handling
3070   Contributed by Joel E. Denny.
3072   Canonical LR, IELR, and LALR can suffer from a couple of problems
3073   upon encountering a syntax error.  First, the parser might perform
3074   additional parser stack reductions before discovering the syntax
3075   error.  Such reductions can perform user semantic actions that are
3076   unexpected because they are based on an invalid token, and they
3077   cause error recovery to begin in a different syntactic context than
3078   the one in which the invalid token was encountered.  Second, when
3079   verbose error messages are enabled (with %error-verbose or the
3080   obsolete "#define YYERROR_VERBOSE"), the expected token list in the
3081   syntax error message can both contain invalid tokens and omit valid
3082   tokens.
3084   The culprits for the above problems are %nonassoc, default
3085   reductions in inconsistent states, and parser state merging.  Thus,
3086   IELR and LALR suffer the most.  Canonical LR can suffer only if
3087   %nonassoc is used or if default reductions are enabled for
3088   inconsistent states.
3090   LAC is a new mechanism within the parsing algorithm that solves
3091   these problems for canonical LR, IELR, and LALR without sacrificing
3092   %nonassoc, default reductions, or state merging.  When LAC is in
3093   use, canonical LR and IELR behave almost exactly the same for both
3094   syntactically acceptable and syntactically unacceptable input.
3095   While LALR still does not support the full language-recognition
3096   power of canonical LR and IELR, LAC at least enables LALR's syntax
3097   error handling to correctly reflect LALR's language-recognition
3098   power.
3100   Currently, LAC is only supported for deterministic parsers in C.
3101   You can enable LAC with the following directive:
3103     %define parse.lac full
3105   See the new section "LAC" in the Bison manual for additional
3106   details including a few caveats.
3108   LAC is an experimental feature.  More user feedback will help to
3109   stabilize it.
3111 ** %define improvements:
3113 *** Can now be invoked via the command line:
3115   Each of these command-line options
3117     -D NAME[=VALUE]
3118     --define=NAME[=VALUE]
3120     -F NAME[=VALUE]
3121     --force-define=NAME[=VALUE]
3123   is equivalent to this grammar file declaration
3125     %define NAME ["VALUE"]
3127   except that the manner in which Bison processes multiple definitions
3128   for the same NAME differs.  Most importantly, -F and --force-define
3129   quietly override %define, but -D and --define do not.  For further
3130   details, see the section "Bison Options" in the Bison manual.
3132 *** Variables renamed:
3134   The following %define variables
3136     api.push_pull
3137     lr.keep_unreachable_states
3139   have been renamed to
3141     api.push-pull
3142     lr.keep-unreachable-states
3144   The old names are now deprecated but will be maintained indefinitely
3145   for backward compatibility.
3147 *** Values no longer need to be quoted in the grammar file:
3149   If a %define value is an identifier, it no longer needs to be placed
3150   within quotations marks.  For example,
3152     %define api.push-pull "push"
3154   can be rewritten as
3156     %define api.push-pull push
3158 *** Unrecognized variables are now errors not warnings.
3160 *** Multiple invocations for any variable is now an error not a warning.
3162 ** Unrecognized %code qualifiers are now errors not warnings.
3164 ** Character literals not of length one:
3166   Previously, Bison quietly converted all character literals to length
3167   one.  For example, without warning, Bison interpreted the operators in
3168   the following grammar to be the same token:
3170     exp: exp '++'
3171        | exp '+' exp
3172        ;
3174   Bison now warns when a character literal is not of length one.  In
3175   some future release, Bison will start reporting an error instead.
3177 ** Destructor calls fixed for lookaheads altered in semantic actions:
3179   Previously for deterministic parsers in C, if a user semantic action
3180   altered yychar, the parser in some cases used the old yychar value to
3181   determine which destructor to call for the lookahead upon a syntax
3182   error or upon parser return.  This bug has been fixed.
3184 ** C++ parsers use YYRHSLOC:
3186   Similarly to the C parsers, the C++ parsers now define the YYRHSLOC
3187   macro and use it in the default YYLLOC_DEFAULT.  You are encouraged
3188   to use it.  If, for instance, your location structure has "first"
3189   and "last" members, instead of
3191     # define YYLLOC_DEFAULT(Current, Rhs, N)                             \
3192       do                                                                 \
3193         if (N)                                                           \
3194           {                                                              \
3195             (Current).first = (Rhs)[1].location.first;                   \
3196             (Current).last  = (Rhs)[N].location.last;                    \
3197           }                                                              \
3198         else                                                             \
3199           {                                                              \
3200             (Current).first = (Current).last = (Rhs)[0].location.last;   \
3201           }                                                              \
3202       while (false)
3204   use:
3206     # define YYLLOC_DEFAULT(Current, Rhs, N)                             \
3207       do                                                                 \
3208         if (N)                                                           \
3209           {                                                              \
3210             (Current).first = YYRHSLOC (Rhs, 1).first;                   \
3211             (Current).last  = YYRHSLOC (Rhs, N).last;                    \
3212           }                                                              \
3213         else                                                             \
3214           {                                                              \
3215             (Current).first = (Current).last = YYRHSLOC (Rhs, 0).last;   \
3216           }                                                              \
3217       while (false)
3219 ** YYLLOC_DEFAULT in C++:
3221   The default implementation of YYLLOC_DEFAULT used to be issued in
3222   the header file.  It is now output in the implementation file, after
3223   the user %code sections so that its #ifndef guard does not try to
3224   override the user's YYLLOC_DEFAULT if provided.
3226 ** YYFAIL now produces warnings and Java parsers no longer implement it:
3228   YYFAIL has existed for many years as an undocumented feature of
3229   deterministic parsers in C generated by Bison.  More recently, it was
3230   a documented feature of Bison's experimental Java parsers.  As
3231   promised in Bison 2.4.2's NEWS entry, any appearance of YYFAIL in a
3232   semantic action now produces a deprecation warning, and Java parsers
3233   no longer implement YYFAIL at all.  For further details, including a
3234   discussion of how to suppress C preprocessor warnings about YYFAIL
3235   being unused, see the Bison 2.4.2 NEWS entry.
3237 ** Temporary hack for adding a semicolon to the user action:
3239   Previously, Bison appended a semicolon to every user action for
3240   reductions when the output language defaulted to C (specifically, when
3241   neither %yacc, %language, %skeleton, or equivalent command-line
3242   options were specified).  This allowed actions such as
3244     exp: exp "+" exp { $$ = $1 + $3 };
3246   instead of
3248     exp: exp "+" exp { $$ = $1 + $3; };
3250   As a first step in removing this misfeature, Bison now issues a
3251   warning when it appends a semicolon.  Moreover, in cases where Bison
3252   cannot easily determine whether a semicolon is needed (for example, an
3253   action ending with a cpp directive or a braced compound initializer),
3254   it no longer appends one.  Thus, the C compiler might now complain
3255   about a missing semicolon where it did not before.  Future releases of
3256   Bison will cease to append semicolons entirely.
3258 ** Verbose syntax error message fixes:
3260   When %error-verbose or the obsolete "#define YYERROR_VERBOSE" is
3261   specified, syntax error messages produced by the generated parser
3262   include the unexpected token as well as a list of expected tokens.
3263   The effect of %nonassoc on these verbose messages has been corrected
3264   in two ways, but a more complete fix requires LAC, described above:
3266 *** When %nonassoc is used, there can exist parser states that accept no
3267     tokens, and so the parser does not always require a lookahead token
3268     in order to detect a syntax error.  Because no unexpected token or
3269     expected tokens can then be reported, the verbose syntax error
3270     message described above is suppressed, and the parser instead
3271     reports the simpler message, "syntax error".  Previously, this
3272     suppression was sometimes erroneously triggered by %nonassoc when a
3273     lookahead was actually required.  Now verbose messages are
3274     suppressed only when all previous lookaheads have already been
3275     shifted or discarded.
3277 *** Previously, the list of expected tokens erroneously included tokens
3278     that would actually induce a syntax error because conflicts for them
3279     were resolved with %nonassoc in the current parser state.  Such
3280     tokens are now properly omitted from the list.
3282 *** Expected token lists are still often wrong due to state merging
3283     (from LALR or IELR) and default reductions, which can both add
3284     invalid tokens and subtract valid tokens.  Canonical LR almost
3285     completely fixes this problem by eliminating state merging and
3286     default reductions.  However, there is one minor problem left even
3287     when using canonical LR and even after the fixes above.  That is,
3288     if the resolution of a conflict with %nonassoc appears in a later
3289     parser state than the one at which some syntax error is
3290     discovered, the conflicted token is still erroneously included in
3291     the expected token list.  Bison's new LAC implementation,
3292     described above, eliminates this problem and the need for
3293     canonical LR.  However, LAC is still experimental and is disabled
3294     by default.
3296 ** Java skeleton fixes:
3298 *** A location handling bug has been fixed.
3300 *** The top element of each of the value stack and location stack is now
3301     cleared when popped so that it can be garbage collected.
3303 *** Parser traces now print the top element of the stack.
3305 ** -W/--warnings fixes:
3307 *** Bison now properly recognizes the "no-" versions of categories:
3309   For example, given the following command line, Bison now enables all
3310   warnings except warnings for incompatibilities with POSIX Yacc:
3312     bison -Wall,no-yacc gram.y
3314 *** Bison now treats S/R and R/R conflicts like other warnings:
3316   Previously, conflict reports were independent of Bison's normal
3317   warning system.  Now, Bison recognizes the warning categories
3318   "conflicts-sr" and "conflicts-rr".  This change has important
3319   consequences for the -W and --warnings command-line options.  For
3320   example:
3322     bison -Wno-conflicts-sr gram.y  # S/R conflicts not reported
3323     bison -Wno-conflicts-rr gram.y  # R/R conflicts not reported
3324     bison -Wnone            gram.y  # no conflicts are reported
3325     bison -Werror           gram.y  # any conflict is an error
3327   However, as before, if the %expect or %expect-rr directive is
3328   specified, an unexpected number of conflicts is an error, and an
3329   expected number of conflicts is not reported, so -W and --warning
3330   then have no effect on the conflict report.
3332 *** The "none" category no longer disables a preceding "error":
3334   For example, for the following command line, Bison now reports
3335   errors instead of warnings for incompatibilities with POSIX Yacc:
3337     bison -Werror,none,yacc gram.y
3339 *** The "none" category now disables all Bison warnings:
3341   Previously, the "none" category disabled only Bison warnings for
3342   which there existed a specific -W/--warning category.  However,
3343   given the following command line, Bison is now guaranteed to
3344   suppress all warnings:
3346     bison -Wnone gram.y
3348 ** Precedence directives can now assign token number 0:
3350   Since Bison 2.3b, which restored the ability of precedence
3351   directives to assign token numbers, doing so for token number 0 has
3352   produced an assertion failure.  For example:
3354     %left END 0
3356   This bug has been fixed.
3359 * Noteworthy changes in release 2.4.3 (2010-08-05)
3361 ** Bison now obeys -Werror and --warnings=error for warnings about
3362    grammar rules that are useless in the parser due to conflicts.
3364 ** Problems with spawning M4 on at least FreeBSD 8 and FreeBSD 9 have
3365    been fixed.
3367 ** Failures in the test suite for GCC 4.5 have been fixed.
3369 ** Failures in the test suite for some versions of Sun Studio C++ have
3370    been fixed.
3372 ** Contrary to Bison 2.4.2's NEWS entry, it has been decided that
3373    warnings about undefined %prec identifiers will not be converted to
3374    errors in Bison 2.5.  They will remain warnings, which should be
3375    sufficient for POSIX while avoiding backward compatibility issues.
3377 ** Minor documentation fixes.
3380 * Noteworthy changes in release 2.4.2 (2010-03-20)
3382 ** Some portability problems that resulted in failures and livelocks
3383    in the test suite on some versions of at least Solaris, AIX, HP-UX,
3384    RHEL4, and Tru64 have been addressed.  As a result, fatal Bison
3385    errors should no longer cause M4 to report a broken pipe on the
3386    affected platforms.
3388 ** "%prec IDENTIFIER" requires IDENTIFIER to be defined separately.
3390   POSIX specifies that an error be reported for any identifier that does
3391   not appear on the LHS of a grammar rule and that is not defined by
3392   %token, %left, %right, or %nonassoc.  Bison 2.3b and later lost this
3393   error report for the case when an identifier appears only after a
3394   %prec directive.  It is now restored.  However, for backward
3395   compatibility with recent Bison releases, it is only a warning for
3396   now.  In Bison 2.5 and later, it will return to being an error.
3397   [Between the 2.4.2 and 2.4.3 releases, it was decided that this
3398   warning will not be converted to an error in Bison 2.5.]
3400 ** Detection of GNU M4 1.4.6 or newer during configure is improved.
3402 ** Warnings from gcc's -Wundef option about undefined YYENABLE_NLS,
3403    YYLTYPE_IS_TRIVIAL, and __STRICT_ANSI__ in C/C++ parsers are now
3404    avoided.
3406 ** %code is now a permanent feature.
3408   A traditional Yacc prologue directive is written in the form:
3410     %{CODE%}
3412   To provide a more flexible alternative, Bison 2.3b introduced the
3413   %code directive with the following forms for C/C++:
3415     %code          {CODE}
3416     %code requires {CODE}
3417     %code provides {CODE}
3418     %code top      {CODE}
3420   These forms are now considered permanent features of Bison.  See the
3421   %code entries in the section "Bison Declaration Summary" in the Bison
3422   manual for a summary of their functionality.  See the section
3423   "Prologue Alternatives" for a detailed discussion including the
3424   advantages of %code over the traditional Yacc prologue directive.
3426   Bison's Java feature as a whole including its current usage of %code
3427   is still considered experimental.
3429 ** YYFAIL is deprecated and will eventually be removed.
3431   YYFAIL has existed for many years as an undocumented feature of
3432   deterministic parsers in C generated by Bison.  Previously, it was
3433   documented for Bison's experimental Java parsers.  YYFAIL is no longer
3434   documented for Java parsers and is formally deprecated in both cases.
3435   Users are strongly encouraged to migrate to YYERROR, which is
3436   specified by POSIX.
3438   Like YYERROR, you can invoke YYFAIL from a semantic action in order to
3439   induce a syntax error.  The most obvious difference from YYERROR is
3440   that YYFAIL will automatically invoke yyerror to report the syntax
3441   error so that you don't have to.  However, there are several other
3442   subtle differences between YYERROR and YYFAIL, and YYFAIL suffers from
3443   inherent flaws when %error-verbose or "#define YYERROR_VERBOSE" is
3444   used.  For a more detailed discussion, see:
3446     http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html
3448   The upcoming Bison 2.5 will remove YYFAIL from Java parsers, but
3449   deterministic parsers in C will continue to implement it.  However,
3450   because YYFAIL is already flawed, it seems futile to try to make new
3451   Bison features compatible with it.  Thus, during parser generation,
3452   Bison 2.5 will produce a warning whenever it discovers YYFAIL in a
3453   rule action.  In a later release, YYFAIL will be disabled for
3454   %error-verbose and "#define YYERROR_VERBOSE".  Eventually, YYFAIL will
3455   be removed altogether.
3457   There exists at least one case where Bison 2.5's YYFAIL warning will
3458   be a false positive.  Some projects add phony uses of YYFAIL and other
3459   Bison-defined macros for the sole purpose of suppressing C
3460   preprocessor warnings (from GCC cpp's -Wunused-macros, for example).
3461   To avoid Bison's future warning, such YYFAIL uses can be moved to the
3462   epilogue (that is, after the second "%%") in the Bison input file.  In
3463   this release (2.4.2), Bison already generates its own code to suppress
3464   C preprocessor warnings for YYFAIL, so projects can remove their own
3465   phony uses of YYFAIL if compatibility with Bison releases prior to
3466   2.4.2 is not necessary.
3468 ** Internationalization.
3470   Fix a regression introduced in Bison 2.4: Under some circumstances,
3471   message translations were not installed although supported by the
3472   host system.
3475 * Noteworthy changes in release 2.4.1 (2008-12-11)
3477 ** In the GLR defines file, unexpanded M4 macros in the yylval and yylloc
3478    declarations have been fixed.
3480 ** Temporary hack for adding a semicolon to the user action.
3482   Bison used to prepend a trailing semicolon at the end of the user
3483   action for reductions.  This allowed actions such as
3485     exp: exp "+" exp { $$ = $1 + $3 };
3487   instead of
3489     exp: exp "+" exp { $$ = $1 + $3; };
3491   Some grammars still depend on this "feature".  Bison 2.4.1 restores
3492   the previous behavior in the case of C output (specifically, when
3493   neither %language or %skeleton or equivalent command-line options
3494   are used) to leave more time for grammars depending on the old
3495   behavior to be adjusted.  Future releases of Bison will disable this
3496   feature.
3498 ** A few minor improvements to the Bison manual.
3501 * Noteworthy changes in release 2.4 (2008-11-02)
3503 ** %language is an experimental feature.
3505   We first introduced this feature in test release 2.3b as a cleaner
3506   alternative to %skeleton.  Since then, we have discussed the possibility of
3507   modifying its effect on Bison's output file names.  Thus, in this release,
3508   we consider %language to be an experimental feature that will likely evolve
3509   in future releases.
3511 ** Forward compatibility with GNU M4 has been improved.
3513 ** Several bugs in the C++ skeleton and the experimental Java skeleton have been
3514   fixed.
3517 * Noteworthy changes in release 2.3b (2008-05-27)
3519 ** The quotes around NAME that used to be required in the following directive
3520   are now deprecated:
3522     %define NAME "VALUE"
3524 ** The directive "%pure-parser" is now deprecated in favor of:
3526     %define api.pure
3528   which has the same effect except that Bison is more careful to warn about
3529   unreasonable usage in the latter case.
3531 ** Push Parsing
3533   Bison can now generate an LALR(1) parser in C with a push interface.  That
3534   is, instead of invoking "yyparse", which pulls tokens from "yylex", you can
3535   push one token at a time to the parser using "yypush_parse", which will
3536   return to the caller after processing each token.  By default, the push
3537   interface is disabled.  Either of the following directives will enable it:
3539     %define api.push_pull "push" // Just push; does not require yylex.
3540     %define api.push_pull "both" // Push and pull; requires yylex.
3542   See the new section "A Push Parser" in the Bison manual for details.
3544   The current push parsing interface is experimental and may evolve.  More user
3545   feedback will help to stabilize it.
3547 ** The -g and --graph options now output graphs in Graphviz DOT format,
3548   not VCG format.  Like --graph, -g now also takes an optional FILE argument
3549   and thus cannot be bundled with other short options.
3551 ** Java
3553   Bison can now generate an LALR(1) parser in Java.  The skeleton is
3554   "data/lalr1.java".  Consider using the new %language directive instead of
3555   %skeleton to select it.
3557   See the new section "Java Parsers" in the Bison manual for details.
3559   The current Java interface is experimental and may evolve.  More user
3560   feedback will help to stabilize it.
3561   Contributed by Paolo Bonzini.
3563 ** %language
3565   This new directive specifies the programming language of the generated
3566   parser, which can be C (the default), C++, or Java.  Besides the skeleton
3567   that Bison uses, the directive affects the names of the generated files if
3568   the grammar file's name ends in ".y".
3570 ** XML Automaton Report
3572   Bison can now generate an XML report of the LALR(1) automaton using the new
3573   "--xml" option.  The current XML schema is experimental and may evolve.  More
3574   user feedback will help to stabilize it.
3575   Contributed by Wojciech Polak.
3577 ** The grammar file may now specify the name of the parser header file using
3578   %defines.  For example:
3580     %defines "parser.h"
3582 ** When reporting useless rules, useless nonterminals, and unused terminals,
3583   Bison now employs the terms "useless in grammar" instead of "useless",
3584   "useless in parser" instead of "never reduced", and "unused in grammar"
3585   instead of "unused".
3587 ** Unreachable State Removal
3589   Previously, Bison sometimes generated parser tables containing unreachable
3590   states.  A state can become unreachable during conflict resolution if Bison
3591   disables a shift action leading to it from a predecessor state.  Bison now:
3593     1. Removes unreachable states.
3595     2. Does not report any conflicts that appeared in unreachable states.
3596        WARNING: As a result, you may need to update %expect and %expect-rr
3597        directives in existing grammar files.
3599     3. For any rule used only in such states, Bison now reports the rule as
3600        "useless in parser due to conflicts".
3602   This feature can be disabled with the following directive:
3604     %define lr.keep_unreachable_states
3606   See the %define entry in the "Bison Declaration Summary" in the Bison manual
3607   for further discussion.
3609 ** Lookahead Set Correction in the ".output" Report
3611   When instructed to generate a ".output" file including lookahead sets
3612   (using "--report=lookahead", for example), Bison now prints each reduction's
3613   lookahead set only next to the associated state's one item that (1) is
3614   associated with the same rule as the reduction and (2) has its dot at the end
3615   of its RHS.  Previously, Bison also erroneously printed the lookahead set
3616   next to all of the state's other items associated with the same rule.  This
3617   bug affected only the ".output" file and not the generated parser source
3618   code.
3620 ** --report-file=FILE is a new option to override the default ".output" file
3621   name.
3623 ** The "=" that used to be required in the following directives is now
3624   deprecated:
3626     %file-prefix "parser"
3627     %name-prefix "c_"
3628     %output "parser.c"
3630 ** An Alternative to "%{...%}" -- "%code QUALIFIER {CODE}"
3632   Bison 2.3a provided a new set of directives as a more flexible alternative to
3633   the traditional Yacc prologue blocks.  Those have now been consolidated into
3634   a single %code directive with an optional qualifier field, which identifies
3635   the purpose of the code and thus the location(s) where Bison should generate
3636   it:
3638     1. "%code          {CODE}" replaces "%after-header  {CODE}"
3639     2. "%code requires {CODE}" replaces "%start-header  {CODE}"
3640     3. "%code provides {CODE}" replaces "%end-header    {CODE}"
3641     4. "%code top      {CODE}" replaces "%before-header {CODE}"
3643   See the %code entries in section "Bison Declaration Summary" in the Bison
3644   manual for a summary of the new functionality.  See the new section "Prologue
3645   Alternatives" for a detailed discussion including the advantages of %code
3646   over the traditional Yacc prologues.
3648   The prologue alternatives are experimental.  More user feedback will help to
3649   determine whether they should become permanent features.
3651 ** Revised warning: unset or unused midrule values
3653   Since Bison 2.2, Bison has warned about midrule values that are set but not
3654   used within any of the actions of the parent rule.  For example, Bison warns
3655   about unused $2 in:
3657     exp: '1' { $$ = 1; } '+' exp { $$ = $1 + $4; };
3659   Now, Bison also warns about midrule values that are used but not set.  For
3660   example, Bison warns about unset $$ in the midrule action in:
3662     exp: '1' { $1 = 1; } '+' exp { $$ = $2 + $4; };
3664   However, Bison now disables both of these warnings by default since they
3665   sometimes prove to be false alarms in existing grammars employing the Yacc
3666   constructs $0 or $-N (where N is some positive integer).
3668   To enable these warnings, specify the option "--warnings=midrule-values" or
3669   "-W", which is a synonym for "--warnings=all".
3671 ** Default %destructor or %printer with "<*>" or "<>"
3673   Bison now recognizes two separate kinds of default %destructor's and
3674   %printer's:
3676     1. Place "<*>" in a %destructor/%printer symbol list to define a default
3677        %destructor/%printer for all grammar symbols for which you have formally
3678        declared semantic type tags.
3680     2. Place "<>" in a %destructor/%printer symbol list to define a default
3681        %destructor/%printer for all grammar symbols without declared semantic
3682        type tags.
3684   Bison no longer supports the "%symbol-default" notation from Bison 2.3a.
3685   "<*>" and "<>" combined achieve the same effect with one exception: Bison no
3686   longer applies any %destructor to a midrule value if that midrule value is
3687   not actually ever referenced using either $$ or $n in a semantic action.
3689   The default %destructor's and %printer's are experimental.  More user
3690   feedback will help to determine whether they should become permanent
3691   features.
3693   See the section "Freeing Discarded Symbols" in the Bison manual for further
3694   details.
3696 ** %left, %right, and %nonassoc can now declare token numbers.  This is required
3697   by POSIX.  However, see the end of section "Operator Precedence" in the Bison
3698   manual for a caveat concerning the treatment of literal strings.
3700 ** The nonfunctional --no-parser, -n, and %no-parser options have been
3701   completely removed from Bison.
3704 * Noteworthy changes in release 2.3a (2006-09-13)
3706 ** Instead of %union, you can define and use your own union type
3707   YYSTYPE if your grammar contains at least one <type> tag.
3708   Your YYSTYPE need not be a macro; it can be a typedef.
3709   This change is for compatibility with other Yacc implementations,
3710   and is required by POSIX.
3712 ** Locations columns and lines start at 1.
3713   In accordance with the GNU Coding Standards and Emacs.
3715 ** You may now declare per-type and default %destructor's and %printer's:
3717   For example:
3719     %union { char *string; }
3720     %token <string> STRING1
3721     %token <string> STRING2
3722     %type  <string> string1
3723     %type  <string> string2
3724     %union { char character; }
3725     %token <character> CHR
3726     %type  <character> chr
3727     %destructor { free ($$); } %symbol-default
3728     %destructor { free ($$); printf ("%d", @$.first_line); } STRING1 string1
3729     %destructor { } <character>
3731   guarantees that, when the parser discards any user-defined symbol that has a
3732   semantic type tag other than "<character>", it passes its semantic value to
3733   "free".  However, when the parser discards a "STRING1" or a "string1", it
3734   also prints its line number to "stdout".  It performs only the second
3735   "%destructor" in this case, so it invokes "free" only once.
3737   [Although we failed to mention this here in the 2.3a release, the default
3738   %destructor's and %printer's were experimental, and they were rewritten in
3739   future versions.]
3741 ** Except for LALR(1) parsers in C with POSIX Yacc emulation enabled (with "-y",
3742   "--yacc", or "%yacc"), Bison no longer generates #define statements for
3743   associating token numbers with token names.  Removing the #define statements
3744   helps to sanitize the global namespace during preprocessing, but POSIX Yacc
3745   requires them.  Bison still generates an enum for token names in all cases.
3747 ** Handling of traditional Yacc prologue blocks is now more consistent but
3748   potentially incompatible with previous releases of Bison.
3750   As before, you declare prologue blocks in your grammar file with the
3751   "%{ ... %}" syntax.  To generate the pre-prologue, Bison concatenates all
3752   prologue blocks that you've declared before the first %union.  To generate
3753   the post-prologue, Bison concatenates all prologue blocks that you've
3754   declared after the first %union.
3756   Previous releases of Bison inserted the pre-prologue into both the header
3757   file and the code file in all cases except for LALR(1) parsers in C.  In the
3758   latter case, Bison inserted it only into the code file.  For parsers in C++,
3759   the point of insertion was before any token definitions (which associate
3760   token numbers with names).  For parsers in C, the point of insertion was
3761   after the token definitions.
3763   Now, Bison never inserts the pre-prologue into the header file.  In the code
3764   file, it always inserts it before the token definitions.
3766 ** Bison now provides a more flexible alternative to the traditional Yacc
3767   prologue blocks: %before-header, %start-header, %end-header, and
3768   %after-header.
3770   For example, the following declaration order in the grammar file reflects the
3771   order in which Bison will output these code blocks.  However, you are free to
3772   declare these code blocks in your grammar file in whatever order is most
3773   convenient for you:
3775     %before-header {
3776       /* Bison treats this block like a pre-prologue block: it inserts it into
3777        * the code file before the contents of the header file.  It does *not*
3778        * insert it into the header file.  This is a good place to put
3779        * #include's that you want at the top of your code file.  A common
3780        * example is '#include "system.h"'.  */
3781     }
3782     %start-header {
3783       /* Bison inserts this block into both the header file and the code file.
3784        * In both files, the point of insertion is before any Bison-generated
3785        * token, semantic type, location type, and class definitions.  This is a
3786        * good place to define %union dependencies, for example.  */
3787     }
3788     %union {
3789       /* Unlike the traditional Yacc prologue blocks, the output order for the
3790        * new %*-header blocks is not affected by their declaration position
3791        * relative to any %union in the grammar file.  */
3792     }
3793     %end-header {
3794       /* Bison inserts this block into both the header file and the code file.
3795        * In both files, the point of insertion is after the Bison-generated
3796        * definitions.  This is a good place to declare or define public
3797        * functions or data structures that depend on the Bison-generated
3798        * definitions.  */
3799     }
3800     %after-header {
3801       /* Bison treats this block like a post-prologue block: it inserts it into
3802        * the code file after the contents of the header file.  It does *not*
3803        * insert it into the header file.  This is a good place to declare or
3804        * define internal functions or data structures that depend on the
3805        * Bison-generated definitions.  */
3806     }
3808   If you have multiple occurrences of any one of the above declarations, Bison
3809   will concatenate the contents in declaration order.
3811   [Although we failed to mention this here in the 2.3a release, the prologue
3812   alternatives were experimental, and they were rewritten in future versions.]
3814 ** The option "--report=look-ahead" has been changed to "--report=lookahead".
3815   The old spelling still works, but is not documented and may be removed
3816   in a future release.
3819 * Noteworthy changes in release 2.3 (2006-06-05)
3821 ** GLR grammars should now use "YYRECOVERING ()" instead of "YYRECOVERING",
3822   for compatibility with LALR(1) grammars.
3824 ** It is now documented that any definition of YYSTYPE or YYLTYPE should
3825   be to a type name that does not contain parentheses or brackets.
3828 * Noteworthy changes in release 2.2 (2006-05-19)
3830 ** The distribution terms for all Bison-generated parsers now permit
3831   using the parsers in nonfree programs.  Previously, this permission
3832   was granted only for Bison-generated LALR(1) parsers in C.
3834 ** %name-prefix changes the namespace name in C++ outputs.
3836 ** The C++ parsers export their token_type.
3838 ** Bison now allows multiple %union declarations, and concatenates
3839   their contents together.
3841 ** New warning: unused values
3842   Right-hand side symbols whose values are not used are reported,
3843   if the symbols have destructors.  For instance:
3845      exp: exp "?" exp ":" exp { $1 ? $1 : $3; }
3846         | exp "+" exp
3847         ;
3849   will trigger a warning about $$ and $5 in the first rule, and $3 in
3850   the second ($1 is copied to $$ by the default rule).  This example
3851   most likely contains three errors, and could be rewritten as:
3853      exp: exp "?" exp ":" exp
3854             { $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); }
3855         | exp "+" exp
3856             { $$ = $1 ? $1 : $3; if ($1) free ($3); }
3857         ;
3859   However, if the original actions were really intended, memory leaks
3860   and all, the warnings can be suppressed by letting Bison believe the
3861   values are used, e.g.:
3863      exp: exp "?" exp ":" exp { $1 ? $1 : $3; (void) ($$, $5); }
3864         | exp "+" exp         { $$ = $1; (void) $3; }
3865         ;
3867   If there are midrule actions, the warning is issued if no action
3868   uses it.  The following triggers no warning: $1 and $3 are used.
3870      exp: exp { push ($1); } '+' exp { push ($3); sum (); };
3872   The warning is intended to help catching lost values and memory leaks.
3873   If a value is ignored, its associated memory typically is not reclaimed.
3875 ** %destructor vs. YYABORT, YYACCEPT, and YYERROR.
3876   Destructors are now called when user code invokes YYABORT, YYACCEPT,
3877   and YYERROR, for all objects on the stack, other than objects
3878   corresponding to the right-hand side of the current rule.
3880 ** %expect, %expect-rr
3881   Incorrect numbers of expected conflicts are now actual errors,
3882   instead of warnings.
3884 ** GLR, YACC parsers.
3885   The %parse-params are available in the destructors (and the
3886   experimental printers) as per the documentation.
3888 ** Bison now warns if it finds a stray "$" or "@" in an action.
3890 ** %require "VERSION"
3891   This specifies that the grammar file depends on features implemented
3892   in Bison version VERSION or higher.
3894 ** lalr1.cc: The token and value types are now class members.
3895   The tokens were defined as free form enums and cpp macros.  YYSTYPE
3896   was defined as a free form union.  They are now class members:
3897   tokens are enumerations of the "yy::parser::token" struct, and the
3898   semantic values have the "yy::parser::semantic_type" type.
3900   If you do not want or can update to this scheme, the directive
3901   '%define "global_tokens_and_yystype" "1"' triggers the global
3902   definition of tokens and YYSTYPE.  This change is suitable both
3903   for previous releases of Bison, and this one.
3905   If you wish to update, then make sure older version of Bison will
3906   fail using '%require "2.2"'.
3908 ** DJGPP support added.
3911 * Noteworthy changes in release 2.1 (2005-09-16)
3913 ** The C++ lalr1.cc skeleton supports %lex-param.
3915 ** Bison-generated parsers now support the translation of diagnostics like
3916   "syntax error" into languages other than English.  The default
3917   language is still English.  For details, please see the new
3918   Internationalization section of the Bison manual.  Software
3919   distributors should also see the new PACKAGING file.  Thanks to
3920   Bruno Haible for this new feature.
3922 ** Wording in the Bison-generated parsers has been changed slightly to
3923   simplify translation.  In particular, the message "memory exhausted"
3924   has replaced "parser stack overflow", as the old message was not
3925   always accurate for modern Bison-generated parsers.
3927 ** Destructors are now called when the parser aborts, for all symbols left
3928   behind on the stack.  Also, the start symbol is now destroyed after a
3929   successful parse.  In both cases, the behavior was formerly inconsistent.
3931 ** When generating verbose diagnostics, Bison-generated parsers no longer
3932   quote the literal strings associated with tokens.  For example, for
3933   a syntax error associated with '%token NUM "number"' they might
3934   print 'syntax error, unexpected number' instead of 'syntax error,
3935   unexpected "number"'.
3938 * Noteworthy changes in release 2.0 (2004-12-25)
3940 ** Possibly-incompatible changes
3942   - Bison-generated parsers no longer default to using the alloca function
3943     (when available) to extend the parser stack, due to widespread
3944     problems in unchecked stack-overflow detection.  You can "#define
3945     YYSTACK_USE_ALLOCA 1" to require the use of alloca, but please read
3946     the manual to determine safe values for YYMAXDEPTH in that case.
3948   - Error token location.
3949     During error recovery, the location of the syntax error is updated
3950     to cover the whole sequence covered by the error token: it includes
3951     the shifted symbols thrown away during the first part of the error
3952     recovery, and the lookahead rejected during the second part.
3954   - Semicolon changes:
3955     . Stray semicolons are no longer allowed at the start of a grammar.
3956     . Semicolons are now required after in-grammar declarations.
3958   - Unescaped newlines are no longer allowed in character constants or
3959     string literals.  They were never portable, and GCC 3.4.0 has
3960     dropped support for them.  Better diagnostics are now generated if
3961     forget a closing quote.
3963   - NUL bytes are no longer allowed in Bison string literals, unfortunately.
3965 ** New features
3967   - GLR grammars now support locations.
3969   - New directive: %initial-action.
3970     This directive allows the user to run arbitrary code (including
3971     initializing @$) from yyparse before parsing starts.
3973   - A new directive "%expect-rr N" specifies the expected number of
3974     reduce/reduce conflicts in GLR parsers.
3976   - %token numbers can now be hexadecimal integers, e.g., "%token FOO 0x12d".
3977     This is a GNU extension.
3979   - The option "--report=lookahead" was changed to "--report=look-ahead".
3980     [However, this was changed back after 2.3.]
3982   - Experimental %destructor support has been added to lalr1.cc.
3984   - New configure option --disable-yacc, to disable installation of the
3985     yacc command and -ly library introduced in 1.875 for POSIX conformance.
3987 ** Bug fixes
3989   - For now, %expect-count violations are now just warnings, not errors.
3990     This is for compatibility with Bison 1.75 and earlier (when there are
3991     reduce/reduce conflicts) and with Bison 1.30 and earlier (when there
3992     are too many or too few shift/reduce conflicts).  However, in future
3993     versions of Bison we plan to improve the %expect machinery so that
3994     these violations will become errors again.
3996   - Within Bison itself, numbers (e.g., goto numbers) are no longer
3997     arbitrarily limited to 16-bit counts.
3999   - Semicolons are now allowed before "|" in grammar rules, as POSIX requires.
4002 * Noteworthy changes in release 1.875 (2003-01-01)
4004 ** The documentation license has been upgraded to version 1.2
4005   of the GNU Free Documentation License.
4007 ** syntax error processing
4009   - In Yacc-style parsers YYLLOC_DEFAULT is now used to compute error
4010     locations too.  This fixes bugs in error-location computation.
4012   - %destructor
4013     It is now possible to reclaim the memory associated to symbols
4014     discarded during error recovery.  This feature is still experimental.
4016   - %error-verbose
4017     This new directive is preferred over YYERROR_VERBOSE.
4019   - #defining yyerror to steal internal variables is discouraged.
4020     It is not guaranteed to work forever.
4022 ** POSIX conformance
4024   - Semicolons are once again optional at the end of grammar rules.
4025     This reverts to the behavior of Bison 1.33 and earlier, and improves
4026     compatibility with Yacc.
4028   - "parse error" -> "syntax error"
4029     Bison now uniformly uses the term "syntax error"; formerly, the code
4030     and manual sometimes used the term "parse error" instead.  POSIX
4031     requires "syntax error" in diagnostics, and it was thought better to
4032     be consistent.
4034   - The documentation now emphasizes that yylex and yyerror must be
4035     declared before use.  C99 requires this.
4037   - Bison now parses C99 lexical constructs like UCNs and
4038     backslash-newline within C escape sequences, as POSIX 1003.1-2001 requires.
4040   - File names are properly escaped in C output.  E.g., foo\bar.y is
4041     output as "foo\\bar.y".
4043   - Yacc command and library now available
4044     The Bison distribution now installs a "yacc" command, as POSIX requires.
4045     Also, Bison now installs a small library liby.a containing
4046     implementations of Yacc-compatible yyerror and main functions.
4047     This library is normally not useful, but POSIX requires it.
4049   - Type clashes now generate warnings, not errors.
4051   - If the user does not define YYSTYPE as a macro, Bison now declares it
4052     using typedef instead of defining it as a macro.
4053     For consistency, YYLTYPE is also declared instead of defined.
4055 ** Other compatibility issues
4057   - %union directives can now have a tag before the "{", e.g., the
4058     directive "%union foo {...}" now generates the C code
4059     "typedef union foo { ... } YYSTYPE;"; this is for Yacc compatibility.
4060     The default union tag is "YYSTYPE", for compatibility with Solaris 9 Yacc.
4061     For consistency, YYLTYPE's struct tag is now "YYLTYPE" not "yyltype".
4062     This is for compatibility with both Yacc and Bison 1.35.
4064   - ";" is output before the terminating "}" of an action, for
4065     compatibility with Bison 1.35.
4067   - Bison now uses a Yacc-style format for conflict reports, e.g.,
4068     "conflicts: 2 shift/reduce, 1 reduce/reduce".
4070   - "yystype" and "yyltype" are now obsolescent macros instead of being
4071     typedefs or tags; they are no longer documented and are planned to be
4072     withdrawn in a future release.
4074 ** GLR parser notes
4076   - GLR and inline
4077     Users of Bison have to decide how they handle the portability of the
4078     C keyword "inline".
4080   - "parsing stack overflow..." -> "parser stack overflow"
4081     GLR parsers now report "parser stack overflow" as per the Bison manual.
4083 ** %parse-param and %lex-param
4084   The macros YYPARSE_PARAM and YYLEX_PARAM provide a means to pass
4085   additional context to yyparse and yylex.  They suffer from several
4086   shortcomings:
4088   - a single argument only can be added,
4089   - their types are weak (void *),
4090   - this context is not passed to ancillary functions such as yyerror,
4091   - only yacc.c parsers support them.
4093   The new %parse-param/%lex-param directives provide a more precise control.
4094   For instance:
4096     %parse-param {int *nastiness}
4097     %lex-param   {int *nastiness}
4098     %parse-param {int *randomness}
4100   results in the following signatures:
4102     int yylex   (int *nastiness);
4103     int yyparse (int *nastiness, int *randomness);
4105   or, if both %pure-parser and %locations are used:
4107     int yylex   (YYSTYPE *lvalp, YYLTYPE *llocp, int *nastiness);
4108     int yyparse (int *nastiness, int *randomness);
4110 ** Bison now warns if it detects conflicting outputs to the same file,
4111   e.g., it generates a warning for "bison -d -o foo.h foo.y" since
4112   that command outputs both code and header to foo.h.
4114 ** #line in output files
4115   - --no-line works properly.
4117 ** Bison can no longer be built by a K&R C compiler; it requires C89 or
4118   later to be built.  This change originally took place a few versions
4119   ago, but nobody noticed until we recently asked someone to try
4120   building Bison with a K&R C compiler.
4123 * Noteworthy changes in release 1.75 (2002-10-14)
4125 ** Bison should now work on 64-bit hosts.
4127 ** Indonesian translation thanks to Tedi Heriyanto.
4129 ** GLR parsers
4130   Fix spurious parse errors.
4132 ** Pure parsers
4133   Some people redefine yyerror to steal yyparse' private variables.
4134   Reenable this trick until an official feature replaces it.
4136 ** Type Clashes
4137   In agreement with POSIX and with other Yaccs, leaving a default
4138   action is valid when $$ is untyped, and $1 typed:
4140         untyped: ... typed;
4142   but the converse remains an error:
4144         typed: ... untyped;
4146 ** Values of midrule actions
4147   The following code:
4149         foo: { ... } { $$ = $1; } ...
4151   was incorrectly rejected: $1 is defined in the second midrule
4152   action, and is equal to the $$ of the first midrule action.
4155 * Noteworthy changes in release 1.50 (2002-10-04)
4157 ** GLR parsing
4158   The declaration
4159      %glr-parser
4160   causes Bison to produce a Generalized LR (GLR) parser, capable of handling
4161   almost any context-free grammar, ambiguous or not.  The new declarations
4162   %dprec and %merge on grammar rules allow parse-time resolution of
4163   ambiguities.  Contributed by Paul Hilfinger.
4165   Unfortunately Bison 1.50 does not work properly on 64-bit hosts
4166   like the Alpha, so please stick to 32-bit hosts for now.
4168 ** Output Directory
4169   When not in Yacc compatibility mode, when the output file was not
4170   specified, running "bison foo/bar.y" created "foo/bar.c".  It
4171   now creates "bar.c".
4173 ** Undefined token
4174   The undefined token was systematically mapped to 2 which prevented
4175   the use of 2 by the user.  This is no longer the case.
4177 ** Unknown token numbers
4178   If yylex returned an out of range value, yyparse could die.  This is
4179   no longer the case.
4181 ** Error token
4182   According to POSIX, the error token must be 256.
4183   Bison extends this requirement by making it a preference: *if* the
4184   user specified that one of her tokens is numbered 256, then error
4185   will be mapped onto another number.
4187 ** Verbose error messages
4188   They no longer report "..., expecting error or..." for states where
4189   error recovery is possible.
4191 ** End token
4192   Defaults to "$end" instead of "$".
4194 ** Error recovery now conforms to documentation and to POSIX
4195   When a Bison-generated parser encounters a syntax error, it now pops
4196   the stack until it finds a state that allows shifting the error
4197   token.  Formerly, it popped the stack until it found a state that
4198   allowed some non-error action other than a default reduction on the
4199   error token.  The new behavior has long been the documented behavior,
4200   and has long been required by POSIX.  For more details, please see
4201   Paul Eggert, "Reductions during Bison error handling" (2002-05-20)
4202   <http://lists.gnu.org/archive/html/bug-bison/2002-05/msg00038.html>.
4204 ** Traces
4205   Popped tokens and nonterminals are now reported.
4207 ** Larger grammars
4208   Larger grammars are now supported (larger token numbers, larger grammar
4209   size (= sum of the LHS and RHS lengths), larger LALR tables).
4210   Formerly, many of these numbers ran afoul of 16-bit limits;
4211   now these limits are 32 bits on most hosts.
4213 ** Explicit initial rule
4214   Bison used to play hacks with the initial rule, which the user does
4215   not write.  It is now explicit, and visible in the reports and
4216   graphs as rule 0.
4218 ** Useless rules
4219   Before, Bison reported the useless rules, but, although not used,
4220   included them in the parsers.  They are now actually removed.
4222 ** Useless rules, useless nonterminals
4223   They are now reported, as a warning, with their locations.
4225 ** Rules never reduced
4226   Rules that can never be reduced because of conflicts are now
4227   reported.
4229 ** Incorrect "Token not used"
4230   On a grammar such as
4232     %token useless useful
4233     %%
4234     exp: '0' %prec useful;
4236   where a token was used to set the precedence of the last rule,
4237   bison reported both "useful" and "useless" as useless tokens.
4239 ** Revert the C++ namespace changes introduced in 1.31
4240   as they caused too many portability hassles.
4242 ** Default locations
4243   By an accident of design, the default computation of @$ was
4244   performed after another default computation was performed: @$ = @1.
4245   The latter is now removed: YYLLOC_DEFAULT is fully responsible of
4246   the computation of @$.
4248 ** Token end-of-file
4249   The token end of file may be specified by the user, in which case,
4250   the user symbol is used in the reports, the graphs, and the verbose
4251   error messages instead of "$end", which remains being the default.
4252   For instance
4253     %token MYEOF 0
4254   or
4255     %token MYEOF 0 "end of file"
4257 ** Semantic parser
4258   This old option, which has been broken for ages, is removed.
4260 ** New translations
4261   Brazilian Portuguese, thanks to Alexandre Folle de Menezes.
4262   Croatian, thanks to Denis Lackovic.
4264 ** Incorrect token definitions
4265   When given
4266     %token 'a' "A"
4267   bison used to output
4268     #define 'a' 65
4270 ** Token definitions as enums
4271   Tokens are output both as the traditional #define's, and, provided
4272   the compiler supports ANSI C or is a C++ compiler, as enums.
4273   This lets debuggers display names instead of integers.
4275 ** Reports
4276   In addition to --verbose, bison supports --report=THINGS, which
4277   produces additional information:
4278   - itemset
4279     complete the core item sets with their closure
4280   - lookahead [changed to "look-ahead" in 1.875e through 2.3, but changed back]
4281     explicitly associate lookahead tokens to items
4282   - solved
4283     describe shift/reduce conflicts solving.
4284     Bison used to systematically output this information on top of
4285     the report.  Solved conflicts are now attached to their states.
4287 ** Type clashes
4288   Previous versions don't complain when there is a type clash on
4289   the default action if the rule has a midrule action, such as in:
4291     %type <foo> bar
4292     %%
4293     bar: '0' {} '0';
4295   This is fixed.
4297 ** GNU M4 is now required when using Bison.
4300 * Noteworthy changes in release 1.35 (2002-03-25)
4302 ** C Skeleton
4303   Some projects use Bison's C parser with C++ compilers, and define
4304   YYSTYPE as a class.  The recent adjustment of C parsers for data
4305   alignment and 64 bit architectures made this impossible.
4307   Because for the time being no real solution for C++ parser
4308   generation exists, kludges were implemented in the parser to
4309   maintain this use.  In the future, when Bison has C++ parsers, this
4310   kludge will be disabled.
4312   This kludge also addresses some C++ problems when the stack was
4313   extended.
4316 * Noteworthy changes in release 1.34 (2002-03-12)
4318 ** File name clashes are detected
4319   $ bison foo.y -d -o foo.x
4320   fatal error: header and parser would both be named "foo.x"
4322 ** A missing ";" at the end of a rule triggers a warning
4323   In accordance with POSIX, and in agreement with other
4324   Yacc implementations, Bison will mandate this semicolon in the near
4325   future.  This eases the implementation of a Bison parser of Bison
4326   grammars by making this grammar LALR(1) instead of LR(2).  To
4327   facilitate the transition, this release introduces a warning.
4329 ** Revert the C++ namespace changes introduced in 1.31, as they caused too
4330   many portability hassles.
4332 ** DJGPP support added.
4334 ** Fix test suite portability problems.
4337 * Noteworthy changes in release 1.33 (2002-02-07)
4339 ** Fix C++ issues
4340   Groff could not be compiled for the definition of size_t was lacking
4341   under some conditions.
4343 ** Catch invalid @n
4344   As is done with $n.
4347 * Noteworthy changes in release 1.32 (2002-01-23)
4349 ** Fix Yacc output file names
4351 ** Portability fixes
4353 ** Italian, Dutch translations
4356 * Noteworthy changes in release 1.31 (2002-01-14)
4358 ** Many Bug Fixes
4360 ** GNU Gettext and %expect
4361   GNU Gettext asserts 10 s/r conflicts, but there are 7.  Now that
4362   Bison dies on incorrect %expectations, we fear there will be
4363   too many bug reports for Gettext, so _for the time being_, %expect
4364   does not trigger an error when the input file is named "plural.y".
4366 ** Use of alloca in parsers
4367   If YYSTACK_USE_ALLOCA is defined to 0, then the parsers will use
4368   malloc exclusively.  Since 1.29, but was not NEWS'ed.
4370   alloca is used only when compiled with GCC, to avoid portability
4371   problems as on AIX.
4373 ** yyparse now returns 2 if memory is exhausted; formerly it dumped core.
4375 ** When the generated parser lacks debugging code, YYDEBUG is now 0
4376   (as POSIX requires) instead of being undefined.
4378 ** User Actions
4379   Bison has always permitted actions such as { $$ = $1 }: it adds the
4380   ending semicolon.  Now if in Yacc compatibility mode, the semicolon
4381   is no longer output: one has to write { $$ = $1; }.
4383 ** Better C++ compliance
4384   The output parsers try to respect C++ namespaces.
4385   [This turned out to be a failed experiment, and it was reverted later.]
4387 ** Reduced Grammars
4388   Fixed bugs when reporting useless nonterminals.
4390 ** 64 bit hosts
4391   The parsers work properly on 64 bit hosts.
4393 ** Error messages
4394   Some calls to strerror resulted in scrambled or missing error messages.
4396 ** %expect
4397   When the number of shift/reduce conflicts is correct, don't issue
4398   any warning.
4400 ** The verbose report includes the rule line numbers.
4402 ** Rule line numbers are fixed in traces.
4404 ** Swedish translation
4406 ** Parse errors
4407   Verbose parse error messages from the parsers are better looking.
4408   Before: parse error: unexpected `'/'', expecting `"number"' or `'-'' or `'(''
4409      Now: parse error: unexpected '/', expecting "number" or '-' or '('
4411 ** Fixed parser memory leaks.
4412   When the generated parser was using malloc to extend its stacks, the
4413   previous allocations were not freed.
4415 ** Fixed verbose output file.
4416   Some newlines were missing.
4417   Some conflicts in state descriptions were missing.
4419 ** Fixed conflict report.
4420   Option -v was needed to get the result.
4422 ** %expect
4423   Was not used.
4424   Mismatches are errors, not warnings.
4426 ** Fixed incorrect processing of some invalid input.
4428 ** Fixed CPP guards: 9foo.h uses BISON_9FOO_H instead of 9FOO_H.
4430 ** Fixed some typos in the documentation.
4432 ** %token MY_EOF 0 is supported.
4433   Before, MY_EOF was silently renumbered as 257.
4435 ** doc/refcard.tex is updated.
4437 ** %output, %file-prefix, %name-prefix.
4438   New.
4440 ** --output
4441   New, aliasing "--output-file".
4444 * Noteworthy changes in release 1.30 (2001-10-26)
4446 ** "--defines" and "--graph" have now an optional argument which is the
4447   output file name. "-d" and "-g" do not change; they do not take any
4448   argument.
4450 ** "%source_extension" and "%header_extension" are removed, failed
4451   experiment.
4453 ** Portability fixes.
4456 * Noteworthy changes in release 1.29 (2001-09-07)
4458 ** The output file does not define const, as this caused problems when used
4459   with common autoconfiguration schemes.  If you still use ancient compilers
4460   that lack const, compile with the equivalent of the C compiler option
4461   "-Dconst=".  Autoconf's AC_C_CONST macro provides one way to do this.
4463 ** Added "-g" and "--graph".
4465 ** The Bison manual is now distributed under the terms of the GNU FDL.
4467 ** The input and the output files has automatically a similar extension.
4469 ** Russian translation added.
4471 ** NLS support updated; should hopefully be less troublesome.
4473 ** Added the old Bison reference card.
4475 ** Added "--locations" and "%locations".
4477 ** Added "-S" and "--skeleton".
4479 ** "%raw", "-r", "--raw" is disabled.
4481 ** Special characters are escaped when output.  This solves the problems
4482   of the #line lines with path names including backslashes.
4484 ** New directives.
4485   "%yacc", "%fixed_output_files", "%defines", "%no_parser", "%verbose",
4486   "%debug", "%source_extension" and "%header_extension".
4488 ** @$
4489   Automatic location tracking.
4492 * Noteworthy changes in release 1.28 (1999-07-06)
4494 ** Should compile better now with K&R compilers.
4496 ** Added NLS.
4498 ** Fixed a problem with escaping the double quote character.
4500 ** There is now a FAQ.
4503 * Noteworthy changes in release 1.27
4505 ** The make rule which prevented bison.simple from being created on
4506   some systems has been fixed.
4509 * Noteworthy changes in release 1.26
4511 ** Bison now uses Automake.
4513 ** New mailing lists: <bug-bison@gnu.org> and <help-bison@gnu.org>.
4515 ** Token numbers now start at 257 as previously documented, not 258.
4517 ** Bison honors the TMPDIR environment variable.
4519 ** A couple of buffer overruns have been fixed.
4521 ** Problems when closing files should now be reported.
4523 ** Generated parsers should now work even on operating systems which do
4524   not provide alloca().
4527 * Noteworthy changes in release 1.25 (1995-10-16)
4529 ** Errors in the input grammar are not fatal; Bison keeps reading
4530 the grammar file, and reports all the errors found in it.
4532 ** Tokens can now be specified as multiple-character strings: for
4533 example, you could use "<=" for a token which looks like <=, instead
4534 of choosing a name like LESSEQ.
4536 ** The %token_table declaration says to write a table of tokens (names
4537 and numbers) into the parser file.  The yylex function can use this
4538 table to recognize multiple-character string tokens, or for other
4539 purposes.
4541 ** The %no_lines declaration says not to generate any #line preprocessor
4542 directives in the parser file.
4544 ** The %raw declaration says to use internal Bison token numbers, not
4545 Yacc-compatible token numbers, when token names are defined as macros.
4547 ** The --no-parser option produces the parser tables without including
4548 the parser engine; a project can now use its own parser engine.
4549 The actions go into a separate file called NAME.act, in the form of
4550 a switch statement body.
4553 * Noteworthy changes in release 1.23
4555 The user can define YYPARSE_PARAM as the name of an argument to be
4556 passed into yyparse.  The argument should have type void *.  It should
4557 actually point to an object.  Grammar actions can access the variable
4558 by casting it to the proper pointer type.
4560 Line numbers in output file corrected.
4563 * Noteworthy changes in release 1.22
4565 --help option added.
4568 * Noteworthy changes in release 1.20
4570 Output file does not redefine const for C++.
4572 -----
4574 LocalWords:  yacc YYBACKUP glr GCC lalr ArrayIndexOutOfBoundsException nullptr
4575 LocalWords:  cplusplus liby rpl fprintf mfcalc Wyacc stmt cond expr mk sym lr
4576 LocalWords:  IELR ielr Lookahead YYERROR nonassoc LALR's api lookaheads yychar
4577 LocalWords:  destructor lookahead YYRHSLOC YYLLOC Rhs ifndef YYFAIL cpp sr rr
4578 LocalWords:  preprocessor initializer Wno Wnone Werror FreeBSD prec livelocks
4579 LocalWords:  Solaris AIX UX RHEL Tru LHS gcc's Wundef YYENABLE NLS YYLTYPE VCG
4580 LocalWords:  yyerror cpp's Wunused yylval yylloc prepend yyparse yylex yypush
4581 LocalWords:  Graphviz xml nonterminals midrule destructor's YYSTYPE typedef ly
4582 LocalWords:  CHR chr printf stdout namespace preprocessing enum pre include's
4583 LocalWords:  YYRECOVERING nonfree destructors YYABORT YYACCEPT params enums de
4584 LocalWords:  struct yystype DJGPP lex param Haible NUM alloca YYSTACK NUL goto
4585 LocalWords:  YYMAXDEPTH Unescaped UCNs YYLTYPE's yyltype typedefs inline Yaccs
4586 LocalWords:  Heriyanto Reenable dprec Hilfinger Eggert MYEOF Folle Menezes EOF
4587 LocalWords:  Lackovic define's itemset Groff Gettext malloc NEWS'ed YYDEBUG YY
4588 LocalWords:  namespaces strerror const autoconfiguration Dconst Autoconf's FDL
4589 LocalWords:  Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
4590 LocalWords:  extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
4591 LocalWords:  lang yyoutput dvi html ps POSIX lvalp llocp Wother nterm arg init
4592 LocalWords:  TOK calc yyo fval Wconflicts parsers yystackp yyval yynerrs
4593 LocalWords:  Théophile Ranquet Santet fno fnone stype associativity Tolmer
4594 LocalWords:  Wprecedence Rassoul Wempty Paolo Bonzini parser's Michiel loc
4595 LocalWords:  redeclaration sval fcaret reentrant XSLT xsl Wmaybe yyvsp Tedi
4596 LocalWords:  pragmas noreturn untyped Rozenman unexpanded Wojciech Polak
4597 LocalWords:  Alexandre MERCHANTABILITY yytype emplace ptr automove lvalues
4598 LocalWords:  nonterminal yy args Pragma dereference yyformat rhs docdir bw
4599 LocalWords:  Redeclarations rpcalc Autoconf YFLAGS Makefiles PROG DECL num
4600 LocalWords:  Heimbigner AST src ast Makefile srcdir MinGW xxlex XXSTYPE
4601 LocalWords:  XXLTYPE strictfp IDEs ffixit fdiagnostics parseable fixits
4602 LocalWords:  Wdeprecated yytext Variadic variadic yyrhs yyphrs RCS README
4603 LocalWords:  noexcept constexpr ispell american deprecations backend Teoh
4604 LocalWords:  YYPRINT Mangold Bonzini's Wdangling exVal baz checkable gcc
4605 LocalWords:  fsanitize Vogelsgesang lis redeclared stdint automata yytname
4606 LocalWords:  yysymbol yytnamerr yyreport ctx ARGMAX yysyntax stderr LPAREN
4607 LocalWords:  symrec yypcontext TOKENMAX yyexpected YYEMPTY yypstate YYEOF
4608 LocalWords:  autocompletion bistromathic submessages Cayuela lexcalc hoc
4609 LocalWords:  yytoken YYUNDEF YYerror basename Automake's UTF ifdef ffile
4610 LocalWords:  gotos readline Imbimbo Wcounterexamples Wcex Nonunifying rcex
4612 Local Variables:
4613 ispell-dictionary: "american"
4614 mode: outline
4615 fill-column: 76
4616 End:
4618 Copyright (C) 1995-2015, 2018-2020 Free Software Foundation, Inc.
4620 This file is part of Bison, the GNU Parser Generator.
4622 Permission is granted to copy, distribute and/or modify this document
4623 under the terms of the GNU Free Documentation License, Version 1.3 or
4624 any later version published by the Free Software Foundation; with no
4625 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
4626 Texts.  A copy of the license is included in the "GNU Free
4627 Documentation License" file as part of this distribution.