doc: catch up with the current display of cex
[bison.git] / NEWS
blobdeca6100d1bd4f6c08214fdfa35ca55f662787b7
1 GNU Bison NEWS
3 * Noteworthy changes in release ?.? (????-??-??) [?]
6 * Noteworthy changes in release 3.6.93 (2020-07-20) [beta]
8 ** Bug fixes
10   Portability issues.
13 * Noteworthy changes in release 3.6.92 (2020-07-19) [beta]
15 Changes in the display of counterexamples.
17 ** Documentation
19 *** Examples
21   The bistromathic demonstrates %param and how to quote sources in the error
22   messages:
24     > 123 456
25     1.5-7: syntax error: expected end of file or + or - or * or / or ^ before number
26         1 | 123 456
27           |     ^~~
29 * Noteworthy changes in release 3.6.91 (2020-07-09) [beta]
31 ** Bug fixes
33   Portability issues.
36 * Noteworthy changes in release 3.6.90 (2020-07-04) [beta]
38 ** Deprecated features
40   The YYPRINT macro, which works only with yacc.c and only for tokens, was
41   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
42   It is deprecated and its support will be removed eventually.
44   In conformance with the recommendations of the Graphviz team, in the next
45   version Bison the option `--graph` will generate a *.gv file by default,
46   instead of *.dot.  A transition started in Bison 3.4.
48 ** New features
50 *** Counterexample Generation
52   Contributed by Vincent Imbimbo.
54   When given `--report=counterexamples` or `-Wcounterexamples`, bison will
55   now output counterexamples for conflicts in the grammar.  These are
56   strings in the grammar which can be parsed in two ways due to the
57   conflict.  For example:
59     Shift/reduce conflict on token "/":
60       Example              exp "+" exp • "/" exp
61       Shift derivation
62         exp
63         ↳ exp "+" exp
64                   ↳ exp • "/" exp
65       Example              exp "+" exp • "/" exp
66       Reduce derivation
67         exp
68         ↳ exp             "/" exp
69           ↳ exp "+" exp •
71   When Bison is installed with text styling enabled, the example is actually
72   shown twice, with colors highlighting the ambiguity.
74   This is a shift/reduce conflict caused by none of the operators having
75   precedence, so the example can be parsed in the two ways shown.  When
76   bison cannot find an example that can be derived in two ways, it instead
77   generates two examples that are the same up until the dot:
79     First example        expr • ID ',' ID $end
80     Shift derivation
81       $accept
82       ↳ s                      $end
83         ↳ a                 ID
84           ↳ expr
85             ↳ expr • ID ','
86     Second example       expr • ID $end
87     Reduce derivation
88       $accept
89       ↳ s             $end
90         ↳ a        ID
91           ↳ expr •
93   In these cases, the parser usually doesn't have enough lookahead to
94   differentiate the two given examples.
96   The counterexamples are "focused" in two different ways.  First, they do
97   not clutter the output with all the derivations from the start symbol,
98   rather they start on the "conflicted nonterminal". They go straight to the
99   point.  Second, they don't "expand" nonterminal symbols uselessly.
101 *** File prefix mapping
103   Contributed by Joshua Watt.
105   Bison learned a new argument, `--file-prefix-map OLD=NEW`.  Any file path
106   in the output (specifically `#line` directives and `#ifdef` header guards)
107   that begins with the prefix OLD will have it replaced with the prefix NEW,
108   similar to the `-ffile-prefix-map` in GCC.  This option can be used to
109   make bison output reproducible.
111 ** Changes
113 *** Relocatable installation
115   When installed to be relocatable (via `configure --enable-relocatable`),
116   bison will now also look for a relocated m4.
118 *** C++ file names
120   The `filename_type` %define variable was renamed `api.filename.type`.
121   Instead of
123     %define filename_type "symbol"
125   write
127     %define api.filename.type {symbol}
129   (Or let `bison --update` do it for you).
131   It now defaults to `const std::string` instead of `std::string`.
133 *** Deprecated %define variable names
135   The following variables have been renamed for consistency.  Backward
136   compatibility is ensured, but upgrading is recommended.
138     filename_type       -> api.filename.type
139     package             -> api.package
141 *** Push parsers no longer clear their state when parsing is finished
143   Previously push-parsers cleared their state when parsing was finished (on
144   success and on failure).  This made it impossible to check if there were
145   parse errors, since `yynerrs` was also reset.  This can be especially
146   troublesome when used in autocompletion, since a parser with error
147   recovery would suggest (irrelevant) expected tokens even if there were
148   failure.
150   Now the parser state can be examined when parsing is finished.  The parser
151   state is reset when starting a new parse.
153 ** Bug fixes
155 *** Include the generated header (yacc.c)
157   Historically, when --defines was used, bison generated a header and pasted
158   an exact copy of it into the generated parser implementation file.  Since
159   Bison 3.4 it is possible to specify that the header should be `#include`d,
160   and how.  For instance
162     %define api.header.include {"parse.h"}
164   or
166     %define api.header.include {<parser/parse.h>}
168   Now api.header.include defaults to `"header-basename"`, as was intended in
169   Bison 3.4, where `header-basename` is the basename of the generated
170   header.  This is disabled when the generated header is `y.tab.h`, to
171   comply with Automake's ylwrap.
173 *** String aliases are faithfully propagated
175   Bison used to interpret user strings (i.e., decoding backslash escapes)
176   when reading them, and to escape them (i.e., issue non-printable
177   characters as backslash escapes, taking the locale into account) when
178   outputting them.  As a consequence non-ASCII strings (say in UTF-8) ended
179   up "ciphered" as sequences of backslash escapes.  This happened not only
180   in the generated sources (where the compiler will reinterpret them), but
181   also in all the generated reports (text, xml, html, dot, etc.).  Reports
182   were therefore not readable when string aliases were not pure ASCII.
183   Worse yet: the output depended on the user's locale.
185   Now Bison faithfully treats the string aliases exactly the way the user
186   spelled them.  This fixes all the aforementioned problems.  However, now,
187   string aliases semantically equivalent but syntactically different (e.g.,
188   "A", "\x41", "\101") are considered to be different.
190 *** Crash when generating IELR
192   An old, well hidden, bug in the generation of IELR parsers was fixed.
195 * Noteworthy changes in release 3.6.4 (2020-06-15) [stable]
197 ** Bug fixes
199   In glr.cc some internal macros leaked in the user's code, and could damage
200   access to the token kinds.
203 * Noteworthy changes in release 3.6.3 (2020-06-03) [stable]
205 ** Bug fixes
207   Incorrect comments in the generated parsers.
209   Warnings in push parsers (yacc.c).
211   Incorrect display of gotos in LAC traces (lalr1.cc).
214 * Noteworthy changes in release 3.6.2 (2020-05-17) [stable]
216 ** Bug fixes
218   Some tests were fixed.
220   When token aliases contain comment delimiters:
222     %token FOO "/* foo */"
224   bison used to emit "nested" comments, which is invalid C.
227 * Noteworthy changes in release 3.6.1 (2020-05-10) [stable]
229 ** Bug fixes
231   Restored ANSI-C compliance in yacc.c.
233   GNU readline portability issues.
235   In C++, yy::parser::symbol_name is now a public member, as was intended.
237 ** New features
239   In C++, yy::parser::symbol_type now has a public name() member function.
242 * Noteworthy changes in release 3.6 (2020-05-08) [stable]
244 ** Backward incompatible changes
246   TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose".
248   The YYERROR_VERBOSE macro is no longer supported; the parsers that still
249   depend on it will now produce Yacc-like error messages (just "syntax
250   error").  It was superseded by the "%error-verbose" directive in Bison
251   1.875 (2003-01-01).  Bison 2.6 (2012-07-19) clearly announced that support
252   for YYERROR_VERBOSE would be removed.  Note that since Bison 3.0
253   (2013-07-25), "%error-verbose" is deprecated in favor of "%define
254   parse.error verbose".
256 ** Deprecated features
258   The YYPRINT macro, which works only with yacc.c and only for tokens, was
259   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
260   It is deprecated and its support will be removed eventually.
262 ** New features
264 *** Improved syntax error messages
266   Two new values for the %define parse.error variable offer more control to
267   the user.  Available in all the skeletons (C, C++, Java).
269 **** %define parse.error detailed
271   The behavior of "%define parse.error detailed" is closely resembling that
272   of "%define parse.error verbose" with a few exceptions.  First, it is safe
273   to use non-ASCII characters in token aliases (with 'verbose', the result
274   depends on the locale with which bison was run).  Second, a yysymbol_name
275   function is exposed to the user, instead of the yytnamerr function and the
276   yytname table.  Third, token internationalization is supported (see
277   below).
279 **** %define parse.error custom
281   With this directive, the user forges and emits the syntax error message
282   herself by defining the yyreport_syntax_error function.  A new type,
283   yypcontext_t, captures the circumstances of the error, and provides the
284   user with functions to get details, such as yypcontext_expected_tokens to
285   get the list of expected token kinds.
287   A possible implementation of yyreport_syntax_error is:
289     int
290     yyreport_syntax_error (const yypcontext_t *ctx)
291     {
292       int res = 0;
293       YY_LOCATION_PRINT (stderr, *yypcontext_location (ctx));
294       fprintf (stderr, ": syntax error");
295       // Report the tokens expected at this point.
296       {
297         enum { TOKENMAX = 10 };
298         yysymbol_kind_t expected[TOKENMAX];
299         int n = yypcontext_expected_tokens (ctx, expected, TOKENMAX);
300         if (n < 0)
301           // Forward errors to yyparse.
302           res = n;
303         else
304           for (int i = 0; i < n; ++i)
305             fprintf (stderr, "%s %s",
306                      i == 0 ? ": expected" : " or", yysymbol_name (expected[i]));
307       }
308       // Report the unexpected token.
309       {
310         yysymbol_kind_t lookahead = yypcontext_token (ctx);
311         if (lookahead != YYSYMBOL_YYEMPTY)
312           fprintf (stderr, " before %s", yysymbol_name (lookahead));
313       }
314       fprintf (stderr, "\n");
315       return res;
316     }
318 **** Token aliases internationalization
320   When the %define variable parse.error is set to `custom` or `detailed`,
321   one may specify which token aliases are to be translated using _().  For
322   instance
324     %token
325         PLUS   "+"
326         MINUS  "-"
327       <double>
328         NUM _("number")
329       <symrec*>
330         FUN _("function")
331         VAR _("variable")
333   In that case the user must define _() and N_(), and yysymbol_name returns
334   the translated symbol (i.e., it returns '_("variable")' rather that
335   '"variable"').  In Java, the user must provide an i18n() function.
337 *** List of expected tokens (yacc.c)
339   Push parsers may invoke yypstate_expected_tokens at any point during
340   parsing (including even before submitting the first token) to get the list
341   of possible tokens.  This feature can be used to propose autocompletion
342   (see below the "bistromathic" example).
344   It makes little sense to use this feature without enabling LAC (lookahead
345   correction).
347 *** Returning the error token
349   When the scanner returns an invalid token or the undefined token
350   (YYUNDEF), the parser generates an error message and enters error
351   recovery.  Because of that error message, most scanners that find lexical
352   errors generate an error message, and then ignore the invalid input
353   without entering the error-recovery.
355   The scanners may now return YYerror, the error token, to enter the
356   error-recovery mode without triggering an additional error message.  See
357   the bistromathic for an example.
359 *** Deep overhaul of the symbol and token kinds
361   To avoid the confusion with types in programming languages, we now refer
362   to token and symbol "kinds" instead of token and symbol "types".  The
363   documentation and error messages have been revised.
365   All the skeletons have been updated to use dedicated enum types rather
366   than integral types.  Special symbols are now regular citizens, instead of
367   being declared in ad hoc ways.
369 **** Token kinds
371   The "token kind" is what is returned by the scanner, e.g., PLUS, NUMBER,
372   LPAREN, etc.  While backward compatibility is of course ensured, users are
373   nonetheless invited to replace their uses of "enum yytokentype" by
374   "yytoken_kind_t".
376   This type now also includes tokens that were previously hidden: YYEOF (end
377   of input), YYUNDEF (undefined token), and YYerror (error token).  They
378   now have string aliases, internationalized when internationalization is
379   enabled.  Therefore, by default, error messages now refer to "end of file"
380   (internationalized) rather than the cryptic "$end", or to "invalid token"
381   rather than "$undefined".
383   Therefore in most cases it is now useless to define the end-of-line token
384   as follows:
386     %token T_EOF 0 "end of file"
388   Rather simply use "YYEOF" in your scanner.
390 **** Symbol kinds
392   The "symbol kinds" is what the parser actually uses.  (Unless the
393   api.token.raw %define variable is used, the symbol kind of a terminal
394   differs from the corresponding token kind.)
396   They are now exposed as a enum, "yysymbol_kind_t".
398   This allows users to tailor the error messages the way they want, or to
399   process some symbols in a specific way in autocompletion (see the
400   bistromathic example below).
402 *** Modernize display of explanatory statements in diagnostics
404   Since Bison 2.7, output was indented four spaces for explanatory
405   statements.  For example:
407     input.y:2.7-13: error: %type redeclaration for exp
408     input.y:1.7-11:     previous declaration
410   Since the introduction of caret-diagnostics, it became less clear.  This
411   indentation has been removed and submessages are displayed similarly as in
412   GCC:
414     input.y:2.7-13: error: %type redeclaration for exp
415         2 | %type <float> exp
416           |       ^~~~~~~
417     input.y:1.7-11: note: previous declaration
418         1 | %type <int> exp
419           |       ^~~~~
421   Contributed by Victor Morales Cayuela.
423 *** C++
425   The token and symbol kinds are yy::parser::token_kind_type and
426   yy::parser::symbol_kind_type.
428   The symbol_type::kind() member function allows to get the kind of a
429   symbol.  This can be used to write unit tests for scanners, e.g.,
431     yy::parser::symbol_type t = make_NUMBER ("123");
432     assert (t.kind () == yy::parser::symbol_kind::S_NUMBER);
433     assert (t.value.as<int> () == 123);
435 ** Documentation
437 *** User Manual
439   In order to avoid ambiguities with "type" as in "typing", we now refer to
440   the "token kind" (e.g., `PLUS`, `NUMBER`, etc.) rather than the "token
441   type".  We now also refer to the "symbol type" (e.g., `PLUS`, `expr`,
442   etc.).
444 *** Examples
446   There are now examples/java: a very simple calculator, and a more complete
447   one (push-parser, location tracking, and debug traces).
449   The lexcalc example (a simple example in C based on Flex and Bison) now
450   also demonstrates location tracking.
453   A new C example, bistromathic, is a fully featured interactive calculator
454   using many Bison features: pure interface, push parser, autocompletion
455   based on the current parser state (using yypstate_expected_tokens),
456   location tracking, internationalized custom error messages, lookahead
457   correction, rich debug traces, etc.
459   It shows how to depend on the symbol kinds to tailor autocompletion.  For
460   instance it recognizes the symbol kind "VARIABLE" to propose
461   autocompletion on the existing variables, rather than of the word
462   "variable".
465 * Noteworthy changes in release 3.5.4 (2020-04-05) [stable]
467 ** WARNING: Future backward-incompatibilities!
469   TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose".
471   Bison 3.6 will no longer support the YYERROR_VERBOSE macro; the parsers
472   that still depend on it will produce Yacc-like error messages (just
473   "syntax error").  It was superseded by the "%error-verbose" directive in
474   Bison 1.875 (2003-01-01).  Bison 2.6 (2012-07-19) clearly announced that
475   support for YYERROR_VERBOSE would be removed.  Note that since Bison 3.0
476   (2013-07-25), "%error-verbose" is deprecated in favor of "%define
477   parse.error verbose".
479 ** Bug fixes
481   Fix portability issues of the package itself on old compilers.
483   Fix api.token.raw support in Java.
486 * Noteworthy changes in release 3.5.3 (2020-03-08) [stable]
488 ** Bug fixes
490   Error messages could quote lines containing zero-width characters (such as
491   \005) with incorrect styling.  Fixes for similar issues with unexpectedly
492   short lines (e.g., the file was changed between parsing and diagnosing).
494   Several unlikely crashes found by fuzzing have been fixed.
497 * Noteworthy changes in release 3.5.2 (2020-02-13) [stable]
499 ** Bug fixes
501   Portability issues and minor cosmetic issues.
503   The lalr1.cc skeleton properly rejects unsupported values for parse.lac
504   (as yacc.c does).
507 * Noteworthy changes in release 3.5.1 (2020-01-19) [stable]
509 ** Bug fixes
511   Portability fixes.
513   Fix compiler warnings.
516 * Noteworthy changes in release 3.5 (2019-12-11) [stable]
518 ** Backward incompatible changes
520   Lone carriage-return characters (aka \r or ^M) in the grammar files are no
521   longer treated as end-of-lines.  This changes the diagnostics, and in
522   particular their locations.
524   In C++, line numbers and columns are now represented as 'int' not
525   'unsigned', so that integer overflow on positions is easily checkable via
526   'gcc -fsanitize=undefined' and the like.  This affects the API for
527   positions.  The default position and location classes now expose
528   'counter_type' (int), used to define line and column numbers.
530 ** Deprecated features
532   The YYPRINT macro, which works only with yacc.c and only for tokens, was
533   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
534   It is deprecated and its support will be removed eventually.
536 ** New features
538 *** Lookahead correction in C++
540   Contributed by Adrian Vogelsgesang.
542   The C++ deterministic skeleton (lalr1.cc) now supports LAC, via the
543   %define variable parse.lac.
545 *** Variable api.token.raw: Optimized token numbers (all skeletons)
547   In the generated parsers, tokens have two numbers: the "external" token
548   number as returned by yylex (which starts at 257), and the "internal"
549   symbol number (which starts at 3).  Each time yylex is called, a table
550   lookup maps the external token number to the internal symbol number.
552   When the %define variable api.token.raw is set, tokens are assigned their
553   internal number, which saves one table lookup per token, and also saves
554   the generation of the mapping table.
556   The gain is typically moderate, but in extreme cases (very simple user
557   actions), a 10% improvement can be observed.
559 *** Generated parsers use better types for states
561   Stacks now use the best integral type for state numbers, instead of always
562   using 15 bits.  As a result "small" parsers now have a smaller memory
563   footprint (they use 8 bits), and there is support for large automata (16
564   bits), and extra large (using int, i.e., typically 31 bits).
566 *** Generated parsers prefer signed integer types
568   Bison skeletons now prefer signed to unsigned integer types when either
569   will do, as the signed types are less error-prone and allow for better
570   checking with 'gcc -fsanitize=undefined'.  Also, the types chosen are now
571   portable to unusual machines where char, short and int are all the same
572   width.  On non-GNU platforms this may entail including <limits.h> and (if
573   available) <stdint.h> to define integer types and constants.
575 *** A skeleton for the D programming language
577   For the last few releases, Bison has shipped a stealth experimental
578   skeleton: lalr1.d.  It was first contributed by Oliver Mangold, based on
579   Paolo Bonzini's lalr1.java, and was cleaned and improved thanks to
580   H. S. Teoh.
582   However, because nobody has committed to improving, testing, and
583   documenting this skeleton, it is not clear that it will be supported in
584   the future.
586   The lalr1.d skeleton *is functional*, and works well, as demonstrated in
587   examples/d/calc.d.  Please try it, enjoy it, and... commit to support it.
589 *** Debug traces in Java
591   The Java backend no longer emits code and data for parser tracing if the
592   %define variable parse.trace is not defined.
594 ** Diagnostics
596 *** New diagnostic: -Wdangling-alias
598   String literals, which allow for better error messages, are (too)
599   liberally accepted by Bison, which might result in silent errors.  For
600   instance
602     %type <exVal> cond "condition"
604   does not define "condition" as a string alias to 'cond' (nonterminal
605   symbols do not have string aliases).  It is rather equivalent to
607     %nterm <exVal> cond
608     %token <exVal> "condition"
610   i.e., it gives the type 'exVal' to the "condition" token, which was
611   clearly not the intention.
613   Also, because string aliases need not be defined, typos such as "baz"
614   instead of "bar" will be not reported.
616   The option -Wdangling-alias catches these situations.  On
618     %token BAR "bar"
619     %type <ival> foo "foo"
620     %%
621     foo: "baz" {}
623   bison -Wdangling-alias reports
625     warning: string literal not attached to a symbol
626           | %type <ival> foo "foo"
627           |                  ^~~~~
628     warning: string literal not attached to a symbol
629           | foo: "baz" {}
630           |      ^~~~~
632    The -Wall option does not (yet?) include -Wdangling-alias.
634 *** Better POSIX Yacc compatibility diagnostics
636   POSIX Yacc restricts %type to nonterminals.  This is now diagnosed by
637   -Wyacc.
639     %token TOKEN1
640     %type  <ival> TOKEN1 TOKEN2 't'
641     %token TOKEN2
642     %%
643     expr:
645   gives with -Wyacc
647     input.y:2.15-20: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
648         2 | %type  <ival> TOKEN1 TOKEN2 't'
649           |               ^~~~~~
650     input.y:2.29-31: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
651         2 | %type  <ival> TOKEN1 TOKEN2 't'
652           |                             ^~~
653     input.y:2.22-27: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
654         2 | %type  <ival> TOKEN1 TOKEN2 't'
655           |                      ^~~~~~
657 *** Diagnostics with insertion
659   The diagnostics now display the suggestion below the underlined source.
660   Replacement for undeclared symbols are now also suggested.
662     $ cat /tmp/foo.y
663     %%
664     list: lis '.' |
666     $ bison -Wall foo.y
667     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'?
668         2 | list: lis '.' |
669           |       ^~~
670           |       list
671     foo.y:2.16: warning: empty rule without %empty [-Wempty-rule]
672         2 | list: lis '.' |
673           |                ^
674           |                %empty
675     foo.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
677 *** Diagnostics about long lines
679   Quoted sources may now be truncated to fit the screen.  For instance, on a
680   30-column wide terminal:
682     $ cat foo.y
683     %token FOO                       FOO                         FOO
684     %%
685     exp: FOO
686     $ bison foo.y
687     foo.y:1.34-36: warning: symbol FOO redeclared [-Wother]
688         1 | …         FOO                  …
689           |           ^~~
690     foo.y:1.8-10:      previous declaration
691         1 | %token FOO                     …
692           |        ^~~
693     foo.y:1.62-64: warning: symbol FOO redeclared [-Wother]
694         1 | …         FOO
695           |           ^~~
696     foo.y:1.8-10:      previous declaration
697         1 | %token FOO                     …
698           |        ^~~
700 ** Changes
702 *** Debugging glr.c and glr.cc
704   The glr.c skeleton always had asserts to check its own behavior (not the
705   user's).  These assertions are now under the control of the parse.assert
706   %define variable (disabled by default).
708 *** Clean up
710   Several new compiler warnings in the generated output have been avoided.
711   Some unused features are no longer emitted.  Cleaner generated code in
712   general.
714 ** Bug Fixes
716   Portability issues in the test suite.
718   In theory, parsers using %nonassoc could crash when reporting verbose
719   error messages. This unlikely bug has been fixed.
721   In Java, %define api.prefix was ignored.  It now behaves as expected.
724 * Noteworthy changes in release 3.4.2 (2019-09-12) [stable]
726 ** Bug fixes
728   In some cases, when warnings are disabled, bison could emit tons of white
729   spaces as diagnostics.
731   When running out of memory, bison could crash (found by fuzzing).
733   When defining twice the EOF token, bison would crash.
735   New warnings from recent compilers have been addressed in the generated
736   parsers (yacc.c, glr.c, glr.cc).
738   When lone carriage-return characters appeared in the input file,
739   diagnostics could hang forever.
742 * Noteworthy changes in release 3.4.1 (2019-05-22) [stable]
744 ** Bug fixes
746   Portability fixes.
749 * Noteworthy changes in release 3.4 (2019-05-19) [stable]
751 ** Deprecated features
753   The %pure-parser directive is deprecated in favor of '%define api.pure'
754   since Bison 2.3b (2008-05-27), but no warning was issued; there is one
755   now.  Note that since Bison 2.7 you are strongly encouraged to use
756   '%define api.pure full' instead of '%define api.pure'.
758 ** New features
760 *** Colored diagnostics
762   As an experimental feature, diagnostics are now colored, controlled by the
763   new options --color and --style.
765   To use them, install the libtextstyle library before configuring Bison.
766   It is available from
768     https://alpha.gnu.org/gnu/gettext/
770   for instance
772     https://alpha.gnu.org/gnu/gettext/libtextstyle-0.8.tar.gz
774   The option --color supports the following arguments:
775     - always, yes: Enable colors.
776     - never, no: Disable colors.
777     - auto, tty (default): Enable colors if the output device is a tty.
779   To customize the styles, create a CSS file similar to
781     /* bison-bw.css */
782     .warning   { }
783     .error     { font-weight: 800; text-decoration: underline; }
784     .note      { }
786   then invoke bison with --style=bison-bw.css, or set the BISON_STYLE
787   environment variable to "bison-bw.css".
789 *** Disabling output
791   When given -fsyntax-only, the diagnostics are reported, but no output is
792   generated.
794   The name of this option is somewhat misleading as bison does more than
795   just checking the syntax: every stage is run (including checking for
796   conflicts for instance), except the generation of the output files.
798 *** Include the generated header (yacc.c)
800   Before, when --defines is used, bison generated a header, and pasted an
801   exact copy of it into the generated parser implementation file.  If the
802   header name is not "y.tab.h", it is now #included instead of being
803   duplicated.
805   To use an '#include' even if the header name is "y.tab.h" (which is what
806   happens with --yacc, or when using the Autotools' ylwrap), define
807   api.header.include to the exact argument to pass to #include.  For
808   instance:
810     %define api.header.include {"parse.h"}
812   or
814     %define api.header.include {<parser/parse.h>}
816 *** api.location.type is now supported in C (yacc.c, glr.c)
818   The %define variable api.location.type defines the name of the type to use
819   for locations.  When defined, Bison no longer defines YYLTYPE.
821   This can be used in programs with several parsers to factor their
822   definition of locations: let one of them generate them, and the others
823   just use them.
825 ** Changes
827 *** Graphviz output
829   In conformance with the recommendations of the Graphviz team, if %require
830   "3.4" (or better) is specified, the option --graph generates a *.gv file
831   by default, instead of *.dot.
833 *** Diagnostics overhaul
835   Column numbers were wrong with multibyte characters, which would also
836   result in skewed diagnostics with carets.  Beside, because we were
837   indenting the quoted source with a single space, lines with tab characters
838   were incorrectly underlined.
840   To address these issues, and to be clearer, Bison now issues diagnostics
841   as GCC9 does.  For instance it used to display (there's a tab before the
842   opening brace):
844     foo.y:3.37-38: error: $2 of ‘expr’ has no declared type
845      expr: expr '+' "number"        { $$ = $1 + $2; }
846                                          ^~
847   It now reports
849     foo.y:3.37-38: error: $2 of ‘expr’ has no declared type
850         3 | expr: expr '+' "number" { $$ = $1 + $2; }
851           |                                     ^~
853   Other constructs now also have better locations, resulting in more precise
854   diagnostics.
856 *** Fix-it hints for %empty
858   Running Bison with -Wempty-rules and --update will remove incorrect %empty
859   annotations, and add the missing ones.
861 *** Generated reports
863   The format of the reports (parse.output) was improved for readability.
865 *** Better support for --no-line.
867   When --no-line is used, the generated files are now cleaner: no lines are
868   generated instead of empty lines.  Together with using api.header.include,
869   that should help people saving the generated files into version control
870   systems get smaller diffs.
872 ** Documentation
874   A new example in C shows an simple infix calculator with a hand-written
875   scanner (examples/c/calc).
877   A new example in C shows a reentrant parser (capable of recursive calls)
878   built with Flex and Bison (examples/c/reccalc).
880   There is a new section about the history of Yaccs and Bison.
882 ** Bug fixes
884   A few obscure bugs were fixed, including the second oldest (known) bug in
885   Bison: it was there when Bison was entered in the RCS version control
886   system, in December 1987.  See the NEWS of Bison 3.3 for the previous
887   oldest bug.
890 * Noteworthy changes in release 3.3.2 (2019-02-03) [stable]
892 ** Bug fixes
894   Bison 3.3 failed to generate parsers for grammars with unused nonterminal
895   symbols.
898 * Noteworthy changes in release 3.3.1 (2019-01-27) [stable]
900 ** Changes
902   The option -y/--yacc used to imply -Werror=yacc, which turns uses of Bison
903   extensions into errors.  It now makes them simple warnings (-Wyacc).
906 * Noteworthy changes in release 3.3 (2019-01-26) [stable]
908   A new mailing list was created, Bison Announce.  It is low traffic, and is
909   only about announcing new releases and important messages (e.g., polls
910   about major decisions to make).
912   https://lists.gnu.org/mailman/listinfo/bison-announce
914 ** Backward incompatible changes
916   Support for DJGPP, which has been unmaintained and untested for years, is
917   removed.
919 ** Deprecated features
921   A new feature, --update (see below) helps adjusting existing grammars to
922   deprecations.
924 *** Deprecated directives
926   The %error-verbose directive is deprecated in favor of '%define
927   parse.error verbose' since Bison 3.0, but no warning was issued.
929   The '%name-prefix "xx"' directive is deprecated in favor of '%define
930   api.prefix {xx}' since Bison 3.0, but no warning was issued.  These
931   directives are slightly different, you might need to adjust your code.
932   %name-prefix renames only symbols with external linkage, while api.prefix
933   also renames types and macros, including YYDEBUG, YYTOKENTYPE,
934   yytokentype, YYSTYPE, YYLTYPE, etc.
936   Users of Flex that move from '%name-prefix "xx"' to '%define api.prefix
937   {xx}' will typically have to update YY_DECL from
939     #define YY_DECL int xxlex (YYSTYPE *yylval, YYLTYPE *yylloc)
941   to
943     #define YY_DECL int xxlex (XXSTYPE *yylval, XXLTYPE *yylloc)
945 *** Deprecated %define variable names
947   The following variables, mostly related to parsers in Java, have been
948   renamed for consistency.  Backward compatibility is ensured, but upgrading
949   is recommended.
951     abstract           -> api.parser.abstract
952     annotations        -> api.parser.annotations
953     extends            -> api.parser.extends
954     final              -> api.parser.final
955     implements         -> api.parser.implements
956     parser_class_name  -> api.parser.class
957     public             -> api.parser.public
958     strictfp           -> api.parser.strictfp
960 ** New features
962 *** Generation of fix-its for IDEs/Editors
964   When given the new option -ffixit (aka -fdiagnostics-parseable-fixits),
965   bison now generates machine readable editing instructions to fix some
966   issues.  Currently, this is mostly limited to updating deprecated
967   directives and removing duplicates.  For instance:
969     $ cat foo.y
970     %error-verbose
971     %define parser_class_name "Parser"
972     %define api.parser.class "Parser"
973     %%
974     exp:;
976   See the "fix-it:" lines below:
978     $ bison -ffixit foo.y
979     foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated]
980      %error-verbose
981      ^~~~~~~~~~~~~~
982     fix-it:"foo.y":{1:1-1:15}:"%define parse.error verbose"
983     foo.y:2.1-34: warning: deprecated directive, use '%define api.parser.class {Parser}' [-Wdeprecated]
984      %define parser_class_name "Parser"
985      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
986     fix-it:"foo.y":{2:1-2:35}:"%define api.parser.class {Parser}"
987     foo.y:3.1-33: error: %define variable 'api.parser.class' redefined
988      %define api.parser.class "Parser"
989      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
990     foo.y:2.1-34:     previous definition
991      %define parser_class_name "Parser"
992      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
993     fix-it:"foo.y":{3:1-3:34}:""
994     foo.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
996   This uses the same output format as GCC and Clang.
998 *** Updating grammar files
1000   Fixes can be applied on the fly.  The previous example ends with the
1001   suggestion to re-run bison with the option -u/--update, which results in a
1002   cleaner grammar file.
1004     $ bison --update foo.y
1005     [...]
1006     bison: file 'foo.y' was updated (backup: 'foo.y~')
1008     $ cat foo.y
1009     %define parse.error verbose
1010     %define api.parser.class {Parser}
1011     %%
1012     exp:;
1014 *** Bison is now relocatable
1016   If you pass '--enable-relocatable' to 'configure', Bison is relocatable.
1018   A relocatable program can be moved or copied to a different location on
1019   the file system.  It can also be used through mount points for network
1020   sharing.  It is possible to make symbolic links to the installed and moved
1021   programs, and invoke them through the symbolic link.
1023 *** %expect and %expect-rr modifiers on individual rules
1025   One can now document (and check) which rules participate in shift/reduce
1026   and reduce/reduce conflicts.  This is particularly important GLR parsers,
1027   where conflicts are a normal occurrence.  For example,
1029       %glr-parser
1030       %expect 1
1031       %%
1033       ...
1035       argument_list:
1036         arguments %expect 1
1037       | arguments ','
1038       | %empty
1039       ;
1041       arguments:
1042         expression
1043       | argument_list ',' expression
1044       ;
1046       ...
1048   Looking at the output from -v, one can see that the shift/reduce conflict
1049   here is due to the fact that the parser does not know whether to reduce
1050   arguments to argument_list until it sees the token _after_ the following
1051   ','.  By marking the rule with %expect 1 (because there is a conflict in
1052   one state), we document the source of the 1 overall shift/reduce conflict.
1054   In GLR parsers, we can use %expect-rr in a rule for reduce/reduce
1055   conflicts.  In this case, we mark each of the conflicting rules.  For
1056   example,
1058       %glr-parser
1059       %expect-rr 1
1061       %%
1063       stmt:
1064         target_list '=' expr ';'
1065       | expr_list ';'
1066       ;
1068       target_list:
1069         target
1070       | target ',' target_list
1071       ;
1073       target:
1074         ID %expect-rr 1
1075       ;
1077       expr_list:
1078         expr
1079       | expr ',' expr_list
1080       ;
1082       expr:
1083         ID %expect-rr 1
1084       | ...
1085       ;
1087   In a statement such as
1089       x, y = 3, 4;
1091   the parser must reduce x to a target or an expr, but does not know which
1092   until it sees the '='.  So we notate the two possible reductions to
1093   indicate that each conflicts in one rule.
1095   This feature needs user feedback, and might evolve in the future.
1097 *** C++: Actual token constructors
1099   When variants and token constructors are enabled, in addition to the
1100   type-safe named token constructors (make_ID, make_INT, etc.), we now
1101   generate genuine constructors for symbol_type.
1103   For instance with these declarations
1105     %token           ':'
1106        <std::string> ID
1107        <int>         INT;
1109   you may use these constructors:
1111     symbol_type (int token, const std::string&);
1112     symbol_type (int token, const int&);
1113     symbol_type (int token);
1115   Correct matching between token types and value types is checked via
1116   'assert'; for instance, 'symbol_type (ID, 42)' would abort.  Named
1117   constructors are preferable, as they offer better type safety (for
1118   instance 'make_ID (42)' would not even compile), but symbol_type
1119   constructors may help when token types are discovered at run-time, e.g.,
1121      [a-z]+   {
1122                 if (auto i = lookup_keyword (yytext))
1123                   return yy::parser::symbol_type (i);
1124                 else
1125                   return yy::parser::make_ID (yytext);
1126               }
1128 *** C++: Variadic emplace
1130   If your application requires C++11 and you don't use symbol constructors,
1131   you may now use a variadic emplace for semantic values:
1133     %define api.value.type variant
1134     %token <std::pair<int, int>> PAIR
1136   in your scanner:
1138     int yylex (parser::semantic_type *lvalp)
1139     {
1140       lvalp->emplace <std::pair<int, int>> (1, 2);
1141       return parser::token::PAIR;
1142     }
1144 *** C++: Syntax error exceptions in GLR
1146   The glr.cc skeleton now supports syntax_error exceptions thrown from user
1147   actions, or from the scanner.
1149 *** More POSIX Yacc compatibility warnings
1151   More Bison specific directives are now reported with -y or -Wyacc.  This
1152   change was ready since the release of Bison 3.0 in September 2015.  It was
1153   delayed because Autoconf used to define YACC as `bison -y`, which resulted
1154   in numerous warnings for Bison users that use the GNU Build System.
1156   If you still experience that problem, either redefine YACC as `bison -o
1157   y.tab.c`, or pass -Wno-yacc to Bison.
1159 *** The tables yyrhs and yyphrs are back
1161   Because no Bison skeleton uses them, these tables were removed (no longer
1162   passed to the skeletons, not even computed) in 2008.  However, some users
1163   have expressed interest in being able to use them in their own skeletons.
1165 ** Bug fixes
1167 *** Incorrect number of reduce/reduce conflicts
1169   On a grammar such as
1171      exp: "num" | "num" | "num"
1173   bison used to report a single RR conflict, instead of two.  This is now
1174   fixed.  This was the oldest (known) bug in Bison: it was there when Bison
1175   was entered in the RCS version control system, in December 1987.
1177   Some grammar files might have to adjust their %expect-rr.
1179 *** Parser directives that were not careful enough
1181   Passing invalid arguments to %nterm, for instance character literals, used
1182   to result in unclear error messages.
1184 ** Documentation
1186   The examples/ directory (installed in .../share/doc/bison/examples) has
1187   been restructured per language for clarity.  The examples come with a
1188   README and a Makefile.  Not only can they be used to toy with Bison, they
1189   can also be starting points for your own grammars.
1191   There is now a Java example, and a simple example in C based on Flex and
1192   Bison (examples/c/lexcalc/).
1194 ** Changes
1196 *** Parsers in C++
1198   They now use noexcept and constexpr.  Please, report missing annotations.
1200 *** Symbol Declarations
1202   The syntax of the variation directives to declare symbols was overhauled
1203   for more consistency, and also better POSIX Yacc compliance (which, for
1204   instance, allows "%type" without actually providing a type).  The %nterm
1205   directive, supported by Bison since its inception, is now documented and
1206   officially supported.
1208   The syntax is now as follows:
1210     %token TAG? ( ID NUMBER? STRING? )+ ( TAG ( ID NUMBER? STRING? )+ )*
1211     %left  TAG? ( ID NUMBER? )+ ( TAG ( ID NUMBER? )+ )*
1212     %type  TAG? ( ID | CHAR | STRING )+ ( TAG ( ID | CHAR | STRING )+ )*
1213     %nterm TAG? ID+ ( TAG ID+ )*
1215   where TAG denotes a type tag such as ‘<ival>’, ID denotes an identifier
1216   such as ‘NUM’, NUMBER a decimal or hexadecimal integer such as ‘300’ or
1217   ‘0x12d’, CHAR a character literal such as ‘'+'’, and STRING a string
1218   literal such as ‘"number"’.  The post-fix quantifiers are ‘?’ (zero or
1219   one), ‘*’ (zero or more) and ‘+’ (one or more).
1222 * Noteworthy changes in release 3.2.4 (2018-12-24) [stable]
1224 ** Bug fixes
1226   Fix the move constructor of symbol_type.
1228   Always provide a copy constructor for symbol_type, even in modern C++.
1231 * Noteworthy changes in release 3.2.3 (2018-12-18) [stable]
1233 ** Bug fixes
1235   Properly support token constructors in C++ with types that include commas
1236   (e.g., std::pair<int, int>).  A regression introduced in Bison 3.2.
1239 * Noteworthy changes in release 3.2.2 (2018-11-21) [stable]
1241 ** Bug fixes
1243   C++ portability issues.
1246 * Noteworthy changes in release 3.2.1 (2018-11-09) [stable]
1248 ** Bug fixes
1250   Several portability issues have been fixed in the build system, in the
1251   test suite, and in the generated parsers in C++.
1254 * Noteworthy changes in release 3.2 (2018-10-29) [stable]
1256 ** Backward incompatible changes
1258   Support for DJGPP, which has been unmaintained and untested for years, is
1259   obsolete.  Unless there is activity to revive it, it will be removed.
1261 ** Changes
1263   %printers should use yyo rather than yyoutput to denote the output stream.
1265   Variant-based symbols in C++ should use emplace() rather than build().
1267   In C++ parsers, parser::operator() is now a synonym for the parser::parse.
1269 ** Documentation
1271   A new section, "A Simple C++ Example", is a tutorial for parsers in C++.
1273   A comment in the generated code now emphasizes that users should not
1274   depend upon non-documented implementation details, such as macros starting
1275   with YY_.
1277 ** New features
1279 *** C++: Support for move semantics (lalr1.cc)
1281   The lalr1.cc skeleton now fully supports C++ move semantics, while
1282   maintaining compatibility with C++98.  You may now store move-only types
1283   when using Bison's variants.  For instance:
1285     %code {
1286       #include <memory>
1287       #include <vector>
1288     }
1290     %skeleton "lalr1.cc"
1291     %define api.value.type variant
1293     %%
1295     %token <int> INT "int";
1296     %type <std::unique_ptr<int>> int;
1297     %type <std::vector<std::unique_ptr<int>>> list;
1299     list:
1300       %empty    {}
1301     | list int  { $$ = std::move($1); $$.emplace_back(std::move($2)); }
1303     int: "int"  { $$ = std::make_unique<int>($1); }
1305 *** C++: Implicit move of right-hand side values (lalr1.cc)
1307   In modern C++ (C++11 and later), you should always use 'std::move' with
1308   the values of the right-hand side symbols ($1, $2, etc.), as they will be
1309   popped from the stack anyway.  Using 'std::move' is mandatory for
1310   move-only types such as unique_ptr, and it provides a significant speedup
1311   for large types such as std::string, or std::vector, etc.
1313   If '%define api.value.automove' is set, every occurrence '$n' is replaced
1314   by 'std::move ($n)'.  The second rule in the previous grammar can be
1315   simplified to:
1317     list: list int  { $$ = $1; $$.emplace_back($2); }
1319   With automove enabled, the semantic values are no longer lvalues, so do
1320   not use the swap idiom:
1322     list: list int  { std::swap($$, $1); $$.emplace_back($2); }
1324   This idiom is anyway obsolete: it is preferable to move than to swap.
1326   A warning is issued when automove is enabled, and a value is used several
1327   times.
1329     input.yy:16.31-32: warning: multiple occurrences of $2 with api.value.automove enabled [-Wother]
1330     exp: "twice" exp   { $$ = $2 + $2; }
1331                                    ^^
1333   Enabling api.value.automove does not require support for modern C++.  The
1334   generated code is valid C++98/03, but will use copies instead of moves.
1336   The new examples/c++/variant-11.yy shows these features in action.
1338 *** C++: The implicit default semantic action is always run
1340   When variants are enabled, the default action was not run, so
1342     exp: "number"
1344   was equivalent to
1346     exp: "number"  {}
1348   It now behaves like in all the other cases, as
1350     exp: "number"  { $$ = $1; }
1352   possibly using std::move if automove is enabled.
1354   We do not expect backward compatibility issues.  However, beware of
1355   forward compatibility issues: if you rely on default actions with
1356   variants, be sure to '%require "3.2"' to avoid older versions of Bison to
1357   generate incorrect parsers.
1359 *** C++: Renaming location.hh
1361   When both %defines and %locations are enabled, Bison generates a
1362   location.hh file.  If you don't use locations outside of the parser, you
1363   may avoid its creation with:
1365     %define api.location.file none
1367   However this file is useful if, for instance, your parser builds an AST
1368   decorated with locations: you may use Bison's location independently of
1369   Bison's parser.  You can now give it another name, for instance:
1371     %define api.location.file "my-location.hh"
1373   This name can have directory components, and even be absolute.  The name
1374   under which the location file is included is controlled by
1375   api.location.include.
1377   This way it is possible to have several parsers share the same location
1378   file.
1380   For instance, in src/foo/parser.hh, generate the include/ast/loc.hh file:
1382     %locations
1383     %define api.namespace {foo}
1384     %define api.location.file "include/ast/loc.hh"
1385     %define api.location.include {<ast/loc.hh>}
1387   and use it in src/bar/parser.hh:
1389     %locations
1390     %define api.namespace {bar}
1391     %code requires {#include <ast/loc.hh>}
1392     %define api.location.type {bar::location}
1394   Absolute file names are supported, so in your Makefile, passing the flag
1395   -Dapi.location.file='"$(top_srcdir)/include/ast/location.hh"' to bison is
1396   safe.
1398 *** C++: stack.hh and position.hh are deprecated
1400   When asked to generate a header file (%defines), the lalr1.cc skeleton
1401   generates a stack.hh file.  This file had no interest for users; it is now
1402   made useless: its content is included in the parser definition.  It is
1403   still generated for backward compatibility.
1405   When in addition to %defines, location support is requested (%locations),
1406   the file position.hh is also generated.  It is now also useless: its
1407   content is now included in location.hh.
1409   These files are no longer generated when your grammar file requires at
1410   least Bison 3.2 (%require "3.2").
1412 ** Bug fixes
1414   Portability issues on MinGW and VS2015.
1416   Portability issues in the test suite.
1418   Portability/warning issues with Flex.
1421 * Noteworthy changes in release 3.1 (2018-08-27) [stable]
1423 ** Backward incompatible changes
1425   Compiling Bison now requires a C99 compiler---as announced during the
1426   release of Bison 3.0, five years ago.  Generated parsers do not require a
1427   C99 compiler.
1429   Support for DJGPP, which has been unmaintained and untested for years, is
1430   obsolete. Unless there is activity to revive it, the next release of Bison
1431   will have it removed.
1433 ** New features
1435 *** Typed midrule actions
1437   Because their type is unknown to Bison, the values of midrule actions are
1438   not treated like the others: they don't have %printer and %destructor
1439   support.  It also prevents C++ (Bison) variants to handle them properly.
1441   Typed midrule actions address these issues.  Instead of:
1443     exp: { $<ival>$ = 1; } { $<ival>$ = 2; }   { $$ = $<ival>1 + $<ival>2; }
1445   write:
1447     exp: <ival>{ $$ = 1; } <ival>{ $$ = 2; }   { $$ = $1 + $2; }
1449 *** Reports include the type of the symbols
1451   The sections about terminal and nonterminal symbols of the '*.output' file
1452   now specify their declared type.  For instance, for:
1454     %token <ival> NUM
1456   the report now shows '<ival>':
1458     Terminals, with rules where they appear
1460     NUM <ival> (258) 5
1462 *** Diagnostics about useless rules
1464   In the following grammar, the 'exp' nonterminal is trivially useless.  So,
1465   of course, its rules are useless too.
1467     %%
1468     input: '0' | exp
1469     exp: exp '+' exp | exp '-' exp | '(' exp ')'
1471   Previously all the useless rules were reported, including those whose
1472   left-hand side is the 'exp' nonterminal:
1474     warning: 1 nonterminal useless in grammar [-Wother]
1475     warning: 4 rules useless in grammar [-Wother]
1476     2.14-16: warning: nonterminal useless in grammar: exp [-Wother]
1477      input: '0' | exp
1478                   ^^^
1479     2.14-16: warning: rule useless in grammar [-Wother]
1480      input: '0' | exp
1481                   ^^^
1482     3.6-16: warning: rule useless in grammar [-Wother]
1483      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1484           ^^^^^^^^^^^
1485     3.20-30: warning: rule useless in grammar [-Wother]
1486      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1487                         ^^^^^^^^^^^
1488     3.34-44: warning: rule useless in grammar [-Wother]
1489      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1490                                       ^^^^^^^^^^^
1492   Now, rules whose left-hand side symbol is useless are no longer reported
1493   as useless.  The locations of the errors have also been adjusted to point
1494   to the first use of the nonterminal as a left-hand side of a rule:
1496     warning: 1 nonterminal useless in grammar [-Wother]
1497     warning: 4 rules useless in grammar [-Wother]
1498     3.1-3: warning: nonterminal useless in grammar: exp [-Wother]
1499      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1500      ^^^
1501     2.14-16: warning: rule useless in grammar [-Wother]
1502      input: '0' | exp
1503                   ^^^
1505 *** C++: Generated parsers can be compiled with -fno-exceptions (lalr1.cc)
1507   When compiled with exceptions disabled, the generated parsers no longer
1508   uses try/catch clauses.
1510   Currently only GCC and Clang are supported.
1512 ** Documentation
1514 *** A demonstration of variants
1516   A new example was added (installed in .../share/doc/bison/examples),
1517   'variant.yy', which shows how to use (Bison) variants in C++.
1519   The other examples were made nicer to read.
1521 *** Some features are no longer 'experimental'
1523   The following features, mature enough, are no longer flagged as
1524   experimental in the documentation: push parsers, default %printer and
1525   %destructor (typed: <*> and untyped: <>), %define api.value.type union and
1526   variant, Java parsers, XML output, LR family (lr, ielr, lalr), and
1527   semantic predicates (%?).
1529 ** Bug fixes
1531 *** GLR: Predicates support broken by #line directives
1533   Predicates (%?) in GLR such as
1535     widget:
1536       %? {new_syntax} 'w' id new_args
1537     | %?{!new_syntax} 'w' id old_args
1539   were issued with #lines in the middle of C code.
1541 *** Printer and destructor with broken #line directives
1543   The #line directives were not properly escaped when emitting the code for
1544   %printer/%destructor, which resulted in compiler errors if there are
1545   backslashes or double-quotes in the grammar file name.
1547 *** Portability on ICC
1549   The Intel compiler claims compatibility with GCC, yet rejects its _Pragma.
1550   Generated parsers now work around this.
1552 *** Various
1554   There were several small fixes in the test suite and in the build system,
1555   many warnings in bison and in the generated parsers were eliminated.  The
1556   documentation also received its share of minor improvements.
1558   Useless code was removed from C++ parsers, and some of the generated
1559   constructors are more 'natural'.
1562 * Noteworthy changes in release 3.0.5 (2018-05-27) [stable]
1564 ** Bug fixes
1566 *** C++: Fix support of 'syntax_error'
1568   One incorrect 'inline' resulted in linking errors about the constructor of
1569   the syntax_error exception.
1571 *** C++: Fix warnings
1573   GCC 7.3 (with -O1 or -O2 but not -O0 or -O3) issued null-dereference
1574   warnings about yyformat being possibly null.  It also warned about the
1575   deprecated implicit definition of copy constructors when there's a
1576   user-defined (copy) assignment operator.
1578 *** Location of errors
1580   In C++ parsers, out-of-bounds errors can happen when a rule with an empty
1581   ride-hand side raises a syntax error.  The behavior of the default parser
1582   (yacc.c) in such a condition was undefined.
1584   Now all the parsers match the behavior of glr.c: @$ is used as the
1585   location of the error.  This handles gracefully rules with and without
1586   rhs.
1588 *** Portability fixes in the test suite
1590   On some platforms, some Java and/or C++ tests were failing.
1593 * Noteworthy changes in release 3.0.4 (2015-01-23) [stable]
1595 ** Bug fixes
1597 *** C++ with Variants (lalr1.cc)
1599   Fix a compiler warning when no %destructor use $$.
1601 *** Test suites
1603   Several portability issues in tests were fixed.
1606 * Noteworthy changes in release 3.0.3 (2015-01-15) [stable]
1608 ** Bug fixes
1610 *** C++ with Variants (lalr1.cc)
1612   Problems with %destructor and '%define parse.assert' have been fixed.
1614 *** Named %union support (yacc.c, glr.c)
1616   Bison 3.0 introduced a regression on named %union such as
1618     %union foo { int ival; };
1620   The possibility to use a name was introduced "for Yacc compatibility".
1621   It is however not required by POSIX Yacc, and its usefulness is not clear.
1623 *** %define api.value.type union with %defines (yacc.c, glr.c)
1625   The C parsers were broken when %defines was used together with "%define
1626   api.value.type union".
1628 *** Redeclarations are reported in proper order
1630   On
1632     %token FOO "foo"
1633     %printer {} "foo"
1634     %printer {} FOO
1636   bison used to report:
1638     foo.yy:2.10-11: error: %printer redeclaration for FOO
1639      %printer {} "foo"
1640               ^^
1641     foo.yy:3.10-11:     previous declaration
1642      %printer {} FOO
1643               ^^
1645   Now, the "previous" declaration is always the first one.
1648 ** Documentation
1650   Bison now installs various files in its docdir (which defaults to
1651   '/usr/local/share/doc/bison'), including the three fully blown examples
1652   extracted from the documentation:
1654    - rpcalc
1655      Reverse Polish Calculator, a simple introductory example.
1656    - mfcalc
1657      Multi-function Calc, a calculator with memory and functions and located
1658      error messages.
1659    - calc++
1660      a calculator in C++ using variant support and token constructors.
1663 * Noteworthy changes in release 3.0.2 (2013-12-05) [stable]
1665 ** Bug fixes
1667 *** Generated source files when errors are reported
1669   When warnings are issued and -Werror is set, bison would still generate
1670   the source files (*.c, *.h...).  As a consequence, some runs of "make"
1671   could fail the first time, but not the second (as the files were generated
1672   anyway).
1674   This is fixed: bison no longer generates this source files, but, of
1675   course, still produces the various reports (*.output, *.xml, etc.).
1677 *** %empty is used in reports
1679   Empty right-hand sides are denoted by '%empty' in all the reports (text,
1680   dot, XML and formats derived from it).
1682 *** YYERROR and variants
1684   When C++ variant support is enabled, an error triggered via YYERROR, but
1685   not caught via error recovery, resulted in a double deletion.
1688 * Noteworthy changes in release 3.0.1 (2013-11-12) [stable]
1690 ** Bug fixes
1692 *** Errors in caret diagnostics
1694   On some platforms, some errors could result in endless diagnostics.
1696 *** Fixes of the -Werror option
1698   Options such as "-Werror -Wno-error=foo" were still turning "foo"
1699   diagnostics into errors instead of warnings.  This is fixed.
1701   Actually, for consistency with GCC, "-Wno-error=foo -Werror" now also
1702   leaves "foo" diagnostics as warnings.  Similarly, with "-Werror=foo
1703   -Wno-error", "foo" diagnostics are now errors.
1705 *** GLR Predicates
1707   As demonstrated in the documentation, one can now leave spaces between
1708   "%?" and its "{".
1710 *** Installation
1712   The yacc.1 man page is no longer installed if --disable-yacc was
1713   specified.
1715 *** Fixes in the test suite
1717   Bugs and portability issues.
1720 * Noteworthy changes in release 3.0 (2013-07-25) [stable]
1722 ** WARNING: Future backward-incompatibilities!
1724   Like other GNU packages, Bison will start using some of the C99 features
1725   for its own code, especially the definition of variables after statements.
1726   The generated C parsers still aim at C90.
1728 ** Backward incompatible changes
1730 *** Obsolete features
1732   Support for YYFAIL is removed (deprecated in Bison 2.4.2): use YYERROR.
1734   Support for yystype and yyltype is removed (deprecated in Bison 1.875):
1735   use YYSTYPE and YYLTYPE.
1737   Support for YYLEX_PARAM and YYPARSE_PARAM is removed (deprecated in Bison
1738   1.875): use %lex-param, %parse-param, or %param.
1740   Missing semicolons at the end of actions are no longer added (as announced
1741   in the release 2.5).
1743 *** Use of YACC='bison -y'
1745   TL;DR: With Autoconf <= 2.69, pass -Wno-yacc to (AM_)YFLAGS if you use
1746   Bison extensions.
1748   Traditional Yacc generates 'y.tab.c' whatever the name of the input file.
1749   Therefore Makefiles written for Yacc expect 'y.tab.c' (and possibly
1750   'y.tab.h' and 'y.output') to be generated from 'foo.y'.
1752   To this end, for ages, AC_PROG_YACC, Autoconf's macro to look for an
1753   implementation of Yacc, was using Bison as 'bison -y'.  While it does
1754   ensure compatible output file names, it also enables warnings for
1755   incompatibilities with POSIX Yacc.  In other words, 'bison -y' triggers
1756   warnings for Bison extensions.
1758   Autoconf 2.70+ fixes this incompatibility by using YACC='bison -o y.tab.c'
1759   (which also generates 'y.tab.h' and 'y.output' when needed).
1760   Alternatively, disable Yacc warnings by passing '-Wno-yacc' to your Yacc
1761   flags (YFLAGS, or AM_YFLAGS with Automake).
1763 ** Bug fixes
1765 *** The epilogue is no longer affected by internal #defines (glr.c)
1767   The glr.c skeleton uses defines such as #define yylval (yystackp->yyval) in
1768   generated code.  These weren't properly undefined before the inclusion of
1769   the user epilogue, so functions such as the following were butchered by the
1770   preprocessor expansion:
1772     int yylex (YYSTYPE *yylval);
1774   This is fixed: yylval, yynerrs, yychar, and yylloc are now valid
1775   identifiers for user-provided variables.
1777 *** stdio.h is no longer needed when locations are enabled (yacc.c)
1779   Changes in Bison 2.7 introduced a dependency on FILE and fprintf when
1780   locations are enabled.  This is fixed.
1782 *** Warnings about useless %pure-parser/%define api.pure are restored
1784 ** Diagnostics reported by Bison
1786   Most of these features were contributed by Théophile Ranquet and Victor
1787   Santet.
1789 *** Carets
1791   Version 2.7 introduced caret errors, for a prettier output.  These are now
1792   activated by default.  The old format can still be used by invoking Bison
1793   with -fno-caret (or -fnone).
1795   Some error messages that reproduced excerpts of the grammar are now using
1796   the caret information only.  For instance on:
1798     %%
1799     exp: 'a' | 'a';
1801   Bison 2.7 reports:
1803     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
1804     in.y:2.12-14: warning: rule useless in parser due to conflicts: exp: 'a' [-Wother]
1806   Now bison reports:
1808     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
1809     in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
1810      exp: 'a' | 'a';
1811                 ^^^
1813   and "bison -fno-caret" reports:
1815     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
1816     in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
1818 *** Enhancements of the -Werror option
1820   The -Werror=CATEGORY option is now recognized, and will treat specified
1821   warnings as errors. The warnings need not have been explicitly activated
1822   using the -W option, this is similar to what GCC 4.7 does.
1824   For example, given the following command line, Bison will treat both
1825   warnings related to POSIX Yacc incompatibilities and S/R conflicts as
1826   errors (and only those):
1828     $ bison -Werror=yacc,error=conflicts-sr input.y
1830   If no categories are specified, -Werror will make all active warnings into
1831   errors. For example, the following line does the same the previous example:
1833     $ bison -Werror -Wnone -Wyacc -Wconflicts-sr input.y
1835   (By default -Wconflicts-sr,conflicts-rr,deprecated,other is enabled.)
1837   Note that the categories in this -Werror option may not be prefixed with
1838   "no-". However, -Wno-error[=CATEGORY] is valid.
1840   Note that -y enables -Werror=yacc. Therefore it is now possible to require
1841   Yacc-like behavior (e.g., always generate y.tab.c), but to report
1842   incompatibilities as warnings: "-y -Wno-error=yacc".
1844 *** The display of warnings is now richer
1846   The option that controls a given warning is now displayed:
1848     foo.y:4.6: warning: type clash on default action: <foo> != <bar> [-Wother]
1850   In the case of warnings treated as errors, the prefix is changed from
1851   "warning: " to "error: ", and the suffix is displayed, in a manner similar
1852   to GCC, as [-Werror=CATEGORY].
1854   For instance, where the previous version of Bison would report (and exit
1855   with failure):
1857     bison: warnings being treated as errors
1858     input.y:1.1: warning: stray ',' treated as white space
1860   it now reports:
1862     input.y:1.1: error: stray ',' treated as white space [-Werror=other]
1864 *** Deprecated constructs
1866   The new 'deprecated' warning category flags obsolete constructs whose
1867   support will be discontinued.  It is enabled by default.  These warnings
1868   used to be reported as 'other' warnings.
1870 *** Useless semantic types
1872   Bison now warns about useless (uninhabited) semantic types.  Since
1873   semantic types are not declared to Bison (they are defined in the opaque
1874   %union structure), it is %printer/%destructor directives about useless
1875   types that trigger the warning:
1877     %token <type1> term
1878     %type  <type2> nterm
1879     %printer    {} <type1> <type3>
1880     %destructor {} <type2> <type4>
1881     %%
1882     nterm: term { $$ = $1; };
1884     3.28-34: warning: type <type3> is used, but is not associated to any symbol
1885     4.28-34: warning: type <type4> is used, but is not associated to any symbol
1887 *** Undefined but unused symbols
1889   Bison used to raise an error for undefined symbols that are not used in
1890   the grammar.  This is now only a warning.
1892     %printer    {} symbol1
1893     %destructor {} symbol2
1894     %type <type>   symbol3
1895     %%
1896     exp: "a";
1898 *** Useless destructors or printers
1900   Bison now warns about useless destructors or printers.  In the following
1901   example, the printer for <type1>, and the destructor for <type2> are
1902   useless: all symbols of <type1> (token1) already have a printer, and all
1903   symbols of type <type2> (token2) already have a destructor.
1905     %token <type1> token1
1906            <type2> token2
1907            <type3> token3
1908            <type4> token4
1909     %printer    {} token1 <type1> <type3>
1910     %destructor {} token2 <type2> <type4>
1912 *** Conflicts
1914   The warnings and error messages about shift/reduce and reduce/reduce
1915   conflicts have been normalized.  For instance on the following foo.y file:
1917     %glr-parser
1918     %%
1919     exp: exp '+' exp | '0' | '0';
1921   compare the previous version of bison:
1923     $ bison foo.y
1924     foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
1925     $ bison -Werror foo.y
1926     bison: warnings being treated as errors
1927     foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
1929   with the new behavior:
1931     $ bison foo.y
1932     foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
1933     foo.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
1934     $ bison -Werror foo.y
1935     foo.y: error: 1 shift/reduce conflict [-Werror=conflicts-sr]
1936     foo.y: error: 2 reduce/reduce conflicts [-Werror=conflicts-rr]
1938   When %expect or %expect-rr is used, such as with bar.y:
1940     %expect 0
1941     %glr-parser
1942     %%
1943     exp: exp '+' exp | '0' | '0';
1945   Former behavior:
1947     $ bison bar.y
1948     bar.y: conflicts: 1 shift/reduce, 2 reduce/reduce
1949     bar.y: expected 0 shift/reduce conflicts
1950     bar.y: expected 0 reduce/reduce conflicts
1952   New one:
1954     $ bison bar.y
1955     bar.y: error: shift/reduce conflicts: 1 found, 0 expected
1956     bar.y: error: reduce/reduce conflicts: 2 found, 0 expected
1958 ** Incompatibilities with POSIX Yacc
1960   The 'yacc' category is no longer part of '-Wall', enable it explicitly
1961   with '-Wyacc'.
1963 ** Additional yylex/yyparse arguments
1965   The new directive %param declares additional arguments to both yylex and
1966   yyparse.  The %lex-param, %parse-param, and %param directives support one
1967   or more arguments.  Instead of
1969     %lex-param   {arg1_type *arg1}
1970     %lex-param   {arg2_type *arg2}
1971     %parse-param {arg1_type *arg1}
1972     %parse-param {arg2_type *arg2}
1974   one may now declare
1976     %param {arg1_type *arg1} {arg2_type *arg2}
1978 ** Types of values for %define variables
1980   Bison used to make no difference between '%define foo bar' and '%define
1981   foo "bar"'.  The former is now called a 'keyword value', and the latter a
1982   'string value'.  A third kind was added: 'code values', such as '%define
1983   foo {bar}'.
1985   Keyword variables are used for fixed value sets, e.g.,
1987     %define lr.type lalr
1989   Code variables are used for value in the target language, e.g.,
1991     %define api.value.type {struct semantic_type}
1993   String variables are used remaining cases, e.g. file names.
1995 ** Variable api.token.prefix
1997   The variable api.token.prefix changes the way tokens are identified in
1998   the generated files.  This is especially useful to avoid collisions
1999   with identifiers in the target language.  For instance
2001     %token FILE for ERROR
2002     %define api.token.prefix {TOK_}
2003     %%
2004     start: FILE for ERROR;
2006   will generate the definition of the symbols TOK_FILE, TOK_for, and
2007   TOK_ERROR in the generated sources.  In particular, the scanner must
2008   use these prefixed token names, although the grammar itself still
2009   uses the short names (as in the sample rule given above).
2011 ** Variable api.value.type
2013   This new %define variable supersedes the #define macro YYSTYPE.  The use
2014   of YYSTYPE is discouraged.  In particular, #defining YYSTYPE *and* either
2015   using %union or %defining api.value.type results in undefined behavior.
2017   Either define api.value.type, or use "%union":
2019     %union
2020     {
2021       int ival;
2022       char *sval;
2023     }
2024     %token <ival> INT "integer"
2025     %token <sval> STRING "string"
2026     %printer { fprintf (yyo, "%d", $$); } <ival>
2027     %destructor { free ($$); } <sval>
2029     /* In yylex().  */
2030     yylval.ival = 42; return INT;
2031     yylval.sval = "42"; return STRING;
2033   The %define variable api.value.type supports both keyword and code values.
2035   The keyword value 'union' means that the user provides genuine types, not
2036   union member names such as "ival" and "sval" above (WARNING: will fail if
2037   -y/--yacc/%yacc is enabled).
2039     %define api.value.type union
2040     %token <int> INT "integer"
2041     %token <char *> STRING "string"
2042     %printer { fprintf (yyo, "%d", $$); } <int>
2043     %destructor { free ($$); } <char *>
2045     /* In yylex().  */
2046     yylval.INT = 42; return INT;
2047     yylval.STRING = "42"; return STRING;
2049   The keyword value variant is somewhat equivalent, but for C++ special
2050   provision is made to allow classes to be used (more about this below).
2052     %define api.value.type variant
2053     %token <int> INT "integer"
2054     %token <std::string> STRING "string"
2056   Code values (in braces) denote user defined types.  This is where YYSTYPE
2057   used to be used.
2059     %code requires
2060     {
2061       struct my_value
2062       {
2063         enum
2064         {
2065           is_int, is_string
2066         } kind;
2067         union
2068         {
2069           int ival;
2070           char *sval;
2071         } u;
2072       };
2073     }
2074     %define api.value.type {struct my_value}
2075     %token <u.ival> INT "integer"
2076     %token <u.sval> STRING "string"
2077     %printer { fprintf (yyo, "%d", $$); } <u.ival>
2078     %destructor { free ($$); } <u.sval>
2080     /* In yylex().  */
2081     yylval.u.ival = 42; return INT;
2082     yylval.u.sval = "42"; return STRING;
2084 ** Variable parse.error
2086   This variable controls the verbosity of error messages.  The use of the
2087   %error-verbose directive is deprecated in favor of "%define parse.error
2088   verbose".
2090 ** Deprecated %define variable names
2092   The following variables have been renamed for consistency.  Backward
2093   compatibility is ensured, but upgrading is recommended.
2095     lr.default-reductions      -> lr.default-reduction
2096     lr.keep-unreachable-states -> lr.keep-unreachable-state
2097     namespace                  -> api.namespace
2098     stype                      -> api.value.type
2100 ** Semantic predicates
2102   Contributed by Paul Hilfinger.
2104   The new, experimental, semantic-predicate feature allows actions of the
2105   form "%?{ BOOLEAN-EXPRESSION }", which cause syntax errors (as for
2106   YYERROR) if the expression evaluates to 0, and are evaluated immediately
2107   in GLR parsers, rather than being deferred.  The result is that they allow
2108   the programmer to prune possible parses based on the values of run-time
2109   expressions.
2111 ** The directive %expect-rr is now an error in non GLR mode
2113   It used to be an error only if used in non GLR mode, _and_ if there are
2114   reduce/reduce conflicts.
2116 ** Tokens are numbered in their order of appearance
2118   Contributed by Valentin Tolmer.
2120   With '%token A B', A had a number less than the one of B.  However,
2121   precedence declarations used to generate a reversed order.  This is now
2122   fixed, and introducing tokens with any of %token, %left, %right,
2123   %precedence, or %nonassoc yields the same result.
2125   When mixing declarations of tokens with a literal character (e.g., 'a') or
2126   with an identifier (e.g., B) in a precedence declaration, Bison numbered
2127   the literal characters first.  For example
2129     %right A B 'c' 'd'
2131   would lead to the tokens declared in this order: 'c' 'd' A B.  Again, the
2132   input order is now preserved.
2134   These changes were made so that one can remove useless precedence and
2135   associativity declarations (i.e., map %nonassoc, %left or %right to
2136   %precedence, or to %token) and get exactly the same output.
2138 ** Useless precedence and associativity
2140   Contributed by Valentin Tolmer.
2142   When developing and maintaining a grammar, useless associativity and
2143   precedence directives are common.  They can be a nuisance: new ambiguities
2144   arising are sometimes masked because their conflicts are resolved due to
2145   the extra precedence or associativity information.  Furthermore, it can
2146   hinder the comprehension of a new grammar: one will wonder about the role
2147   of a precedence, where in fact it is useless.  The following changes aim
2148   at detecting and reporting these extra directives.
2150 *** Precedence warning category
2152   A new category of warning, -Wprecedence, was introduced. It flags the
2153   useless precedence and associativity directives.
2155 *** Useless associativity
2157   Bison now warns about symbols with a declared associativity that is never
2158   used to resolve conflicts.  In that case, using %precedence is sufficient;
2159   the parsing tables will remain unchanged.  Solving these warnings may raise
2160   useless precedence warnings, as the symbols no longer have associativity.
2161   For example:
2163     %left '+'
2164     %left '*'
2165     %%
2166     exp:
2167       "number"
2168     | exp '+' "number"
2169     | exp '*' exp
2170     ;
2172   will produce a
2174     warning: useless associativity for '+', use %precedence [-Wprecedence]
2175      %left '+'
2176            ^^^
2178 *** Useless precedence
2180   Bison now warns about symbols with a declared precedence and no declared
2181   associativity (i.e., declared with %precedence), and whose precedence is
2182   never used.  In that case, the symbol can be safely declared with %token
2183   instead, without modifying the parsing tables.  For example:
2185     %precedence '='
2186     %%
2187     exp: "var" '=' "number";
2189   will produce a
2191     warning: useless precedence for '=' [-Wprecedence]
2192      %precedence '='
2193                  ^^^
2195 *** Useless precedence and associativity
2197   In case of both useless precedence and associativity, the issue is flagged
2198   as follows:
2200     %nonassoc '='
2201     %%
2202     exp: "var" '=' "number";
2204   The warning is:
2206     warning: useless precedence and associativity for '=' [-Wprecedence]
2207      %nonassoc '='
2208                ^^^
2210 ** Empty rules
2212   With help from Joel E. Denny and Gabriel Rassoul.
2214   Empty rules (i.e., with an empty right-hand side) can now be explicitly
2215   marked by the new %empty directive.  Using %empty on a non-empty rule is
2216   an error.  The new -Wempty-rule warning reports empty rules without
2217   %empty.  On the following grammar:
2219     %%
2220     s: a b c;
2221     a: ;
2222     b: %empty;
2223     c: 'a' %empty;
2225   bison reports:
2227     3.4-5: warning: empty rule without %empty [-Wempty-rule]
2228      a: {}
2229         ^^
2230     5.8-13: error: %empty on non-empty rule
2231      c: 'a' %empty {};
2232             ^^^^^^
2234 ** Java skeleton improvements
2236   The constants for token names were moved to the Lexer interface.  Also, it
2237   is possible to add code to the parser's constructors using "%code init"
2238   and "%define init_throws".
2239   Contributed by Paolo Bonzini.
2241   The Java skeleton now supports push parsing.
2242   Contributed by Dennis Heimbigner.
2244 ** C++ skeletons improvements
2246 *** The parser header is no longer mandatory (lalr1.cc, glr.cc)
2248   Using %defines is now optional.  Without it, the needed support classes
2249   are defined in the generated parser, instead of additional files (such as
2250   location.hh, position.hh and stack.hh).
2252 *** Locations are no longer mandatory (lalr1.cc, glr.cc)
2254   Both lalr1.cc and glr.cc no longer require %location.
2256 *** syntax_error exception (lalr1.cc)
2258   The C++ parser features a syntax_error exception, which can be
2259   thrown from the scanner or from user rules to raise syntax errors.
2260   This facilitates reporting errors caught in sub-functions (e.g.,
2261   rejecting too large integral literals from a conversion function
2262   used by the scanner, or rejecting invalid combinations from a
2263   factory invoked by the user actions).
2265 *** %define api.value.type variant
2267   This is based on a submission from Michiel De Wilde.  With help
2268   from Théophile Ranquet.
2270   In this mode, complex C++ objects can be used as semantic values.  For
2271   instance:
2273     %token <::std::string> TEXT;
2274     %token <int> NUMBER;
2275     %token SEMICOLON ";"
2276     %type <::std::string> item;
2277     %type <::std::list<std::string>> list;
2278     %%
2279     result:
2280       list  { std::cout << $1 << std::endl; }
2281     ;
2283     list:
2284       %empty        { /* Generates an empty string list. */ }
2285     | list item ";" { std::swap ($$, $1); $$.push_back ($2); }
2286     ;
2288     item:
2289       TEXT    { std::swap ($$, $1); }
2290     | NUMBER  { $$ = string_cast ($1); }
2291     ;
2293 *** %define api.token.constructor
2295   When variants are enabled, Bison can generate functions to build the
2296   tokens.  This guarantees that the token type (e.g., NUMBER) is consistent
2297   with the semantic value (e.g., int):
2299     parser::symbol_type yylex ()
2300     {
2301       parser::location_type loc = ...;
2302       ...
2303       return parser::make_TEXT ("Hello, world!", loc);
2304       ...
2305       return parser::make_NUMBER (42, loc);
2306       ...
2307       return parser::make_SEMICOLON (loc);
2308       ...
2309     }
2311 *** C++ locations
2313   There are operator- and operator-= for 'location'.  Negative line/column
2314   increments can no longer underflow the resulting value.
2317 * Noteworthy changes in release 2.7.1 (2013-04-15) [stable]
2319 ** Bug fixes
2321 *** Fix compiler attribute portability (yacc.c)
2323   With locations enabled, __attribute__ was used unprotected.
2325 *** Fix some compiler warnings (lalr1.cc)
2328 * Noteworthy changes in release 2.7 (2012-12-12) [stable]
2330 ** Bug fixes
2332   Warnings about uninitialized yylloc in yyparse have been fixed.
2334   Restored C90 compliance (yet no report was ever made).
2336 ** Diagnostics are improved
2338   Contributed by Théophile Ranquet.
2340 *** Changes in the format of error messages
2342   This used to be the format of many error reports:
2344     input.y:2.7-12: %type redeclaration for exp
2345     input.y:1.7-12: previous declaration
2347   It is now:
2349     input.y:2.7-12: error: %type redeclaration for exp
2350     input.y:1.7-12:     previous declaration
2352 *** New format for error reports: carets
2354   Caret errors have been added to Bison:
2356     input.y:2.7-12: error: %type redeclaration for exp
2357      %type <sval> exp
2358            ^^^^^^
2359     input.y:1.7-12:     previous declaration
2360      %type <ival> exp
2361            ^^^^^^
2363   or
2365     input.y:3.20-23: error: ambiguous reference: '$exp'
2366      exp: exp '+' exp { $exp = $1 + $3; };
2367                         ^^^^
2368     input.y:3.1-3:       refers to: $exp at $$
2369      exp: exp '+' exp { $exp = $1 + $3; };
2370      ^^^
2371     input.y:3.6-8:       refers to: $exp at $1
2372      exp: exp '+' exp { $exp = $1 + $3; };
2373           ^^^
2374     input.y:3.14-16:     refers to: $exp at $3
2375      exp: exp '+' exp { $exp = $1 + $3; };
2376                   ^^^
2378   The default behavior for now is still not to display these unless
2379   explicitly asked with -fcaret (or -fall). However, in a later release, it
2380   will be made the default behavior (but may still be deactivated with
2381   -fno-caret).
2383 ** New value for %define variable: api.pure full
2385   The %define variable api.pure requests a pure (reentrant) parser. However,
2386   for historical reasons, using it in a location-tracking Yacc parser
2387   resulted in a yyerror function that did not take a location as a
2388   parameter. With this new value, the user may request a better pure parser,
2389   where yyerror does take a location as a parameter (in location-tracking
2390   parsers).
2392   The use of "%define api.pure true" is deprecated in favor of this new
2393   "%define api.pure full".
2395 ** New %define variable: api.location.type (glr.cc, lalr1.cc, lalr1.java)
2397   The %define variable api.location.type defines the name of the type to use
2398   for locations.  When defined, Bison no longer generates the position.hh
2399   and location.hh files, nor does the parser will include them: the user is
2400   then responsible to define her type.
2402   This can be used in programs with several parsers to factor their location
2403   and position files: let one of them generate them, and the others just use
2404   them.
2406   This feature was actually introduced, but not documented, in Bison 2.5,
2407   under the name "location_type" (which is maintained for backward
2408   compatibility).
2410   For consistency, lalr1.java's %define variables location_type and
2411   position_type are deprecated in favor of api.location.type and
2412   api.position.type.
2414 ** Exception safety (lalr1.cc)
2416   The parse function now catches exceptions, uses the %destructors to
2417   release memory (the lookahead symbol and the symbols pushed on the stack)
2418   before re-throwing the exception.
2420   This feature is somewhat experimental.  User feedback would be
2421   appreciated.
2423 ** Graph improvements in DOT and XSLT
2425   Contributed by Théophile Ranquet.
2427   The graphical presentation of the states is more readable: their shape is
2428   now rectangular, the state number is clearly displayed, and the items are
2429   numbered and left-justified.
2431   The reductions are now explicitly represented as transitions to other
2432   diamond shaped nodes.
2434   These changes are present in both --graph output and xml2dot.xsl XSLT
2435   processing, with minor (documented) differences.
2437 ** %language is no longer an experimental feature.
2439   The introduction of this feature, in 2.4, was four years ago. The
2440   --language option and the %language directive are no longer experimental.
2442 ** Documentation
2444   The sections about shift/reduce and reduce/reduce conflicts resolution
2445   have been fixed and extended.
2447   Although introduced more than four years ago, XML and Graphviz reports
2448   were not properly documented.
2450   The translation of midrule actions is now described.
2453 * Noteworthy changes in release 2.6.5 (2012-11-07) [stable]
2455   We consider compiler warnings about Bison generated parsers to be bugs.
2456   Rather than working around them in your own project, please consider
2457   reporting them to us.
2459 ** Bug fixes
2461   Warnings about uninitialized yylval and/or yylloc for push parsers with a
2462   pure interface have been fixed for GCC 4.0 up to 4.8, and Clang 2.9 to
2463   3.2.
2465   Other issues in the test suite have been addressed.
2467   Null characters are correctly displayed in error messages.
2469   When possible, yylloc is correctly initialized before calling yylex.  It
2470   is no longer necessary to initialize it in the %initial-action.
2473 * Noteworthy changes in release 2.6.4 (2012-10-23) [stable]
2475   Bison 2.6.3's --version was incorrect.  This release fixes this issue.
2478 * Noteworthy changes in release 2.6.3 (2012-10-22) [stable]
2480 ** Bug fixes
2482   Bugs and portability issues in the test suite have been fixed.
2484   Some errors in translations have been addressed, and --help now directs
2485   users to the appropriate place to report them.
2487   Stray Info files shipped by accident are removed.
2489   Incorrect definitions of YY_, issued by yacc.c when no parser header is
2490   generated, are removed.
2492   All the generated headers are self-contained.
2494 ** Header guards (yacc.c, glr.c, glr.cc)
2496   In order to avoid collisions, the header guards are now
2497   YY_<PREFIX>_<FILE>_INCLUDED, instead of merely <PREFIX>_<FILE>.
2498   For instance the header generated from
2500     %define api.prefix "calc"
2501     %defines "lib/parse.h"
2503   will use YY_CALC_LIB_PARSE_H_INCLUDED as guard.
2505 ** Fix compiler warnings in the generated parser (yacc.c, glr.c)
2507   The compilation of pure parsers (%define api.pure) can trigger GCC
2508   warnings such as:
2510     input.c: In function 'yyparse':
2511     input.c:1503:12: warning: 'yylval' may be used uninitialized in this
2512                               function [-Wmaybe-uninitialized]
2513        *++yyvsp = yylval;
2514                 ^
2516   This is now fixed; pragmas to avoid these warnings are no longer needed.
2518   Warnings from clang ("equality comparison with extraneous parentheses" and
2519   "function declared 'noreturn' should not return") have also been
2520   addressed.
2523 * Noteworthy changes in release 2.6.2 (2012-08-03) [stable]
2525 ** Bug fixes
2527   Buffer overruns, complaints from Flex, and portability issues in the test
2528   suite have been fixed.
2530 ** Spaces in %lex- and %parse-param (lalr1.cc, glr.cc)
2532   Trailing end-of-lines in %parse-param or %lex-param would result in
2533   invalid C++.  This is fixed.
2535 ** Spurious spaces and end-of-lines
2537   The generated files no longer end (nor start) with empty lines.
2540 * Noteworthy changes in release 2.6.1 (2012-07-30) [stable]
2542  Bison no longer executes user-specified M4 code when processing a grammar.
2544 ** Future Changes
2546   In addition to the removal of the features announced in Bison 2.6, the
2547   next major release will remove the "Temporary hack for adding a semicolon
2548   to the user action", as announced in the release 2.5.  Instead of:
2550     exp: exp "+" exp { $$ = $1 + $3 };
2552   write:
2554     exp: exp "+" exp { $$ = $1 + $3; };
2556 ** Bug fixes
2558 *** Type names are now properly escaped.
2560 *** glr.cc: set_debug_level and debug_level work as expected.
2562 *** Stray @ or $ in actions
2564   While Bison used to warn about stray $ or @ in action rules, it did not
2565   for other actions such as printers, destructors, or initial actions.  It
2566   now does.
2568 ** Type names in actions
2570   For consistency with rule actions, it is now possible to qualify $$ by a
2571   type-name in destructors, printers, and initial actions.  For instance:
2573     %printer { fprintf (yyo, "(%d, %f)", $<ival>$, $<fval>$); } <*> <>;
2575   will display two values for each typed and untyped symbol (provided
2576   that YYSTYPE has both "ival" and "fval" fields).
2579 * Noteworthy changes in release 2.6 (2012-07-19) [stable]
2581 ** Future changes
2583   The next major release of Bison will drop support for the following
2584   deprecated features.  Please report disagreements to bug-bison@gnu.org.
2586 *** K&R C parsers
2588   Support for generating parsers in K&R C will be removed.  Parsers
2589   generated for C support ISO C90, and are tested with ISO C99 and ISO C11
2590   compilers.
2592 *** Features deprecated since Bison 1.875
2594   The definitions of yystype and yyltype will be removed; use YYSTYPE and
2595   YYLTYPE.
2597   YYPARSE_PARAM and YYLEX_PARAM, deprecated in favor of %parse-param and
2598   %lex-param, will no longer be supported.
2600   Support for the preprocessor symbol YYERROR_VERBOSE will be removed, use
2601   %error-verbose.
2603 *** The generated header will be included (yacc.c)
2605   Instead of duplicating the content of the generated header (definition of
2606   YYSTYPE, yyparse declaration etc.), the generated parser will include it,
2607   as is already the case for GLR or C++ parsers.  This change is deferred
2608   because existing versions of ylwrap (e.g., Automake 1.12.1) do not support
2609   it.
2611 ** Generated Parser Headers
2613 *** Guards (yacc.c, glr.c, glr.cc)
2615   The generated headers are now guarded, as is already the case for C++
2616   parsers (lalr1.cc).  For instance, with --defines=foo.h:
2618     #ifndef YY_FOO_H
2619     # define YY_FOO_H
2620     ...
2621     #endif /* !YY_FOO_H  */
2623 *** New declarations (yacc.c, glr.c)
2625   The generated header now declares yydebug and yyparse.  Both honor
2626   --name-prefix=bar_, and yield
2628     int bar_parse (void);
2630   rather than
2632     #define yyparse bar_parse
2633     int yyparse (void);
2635   in order to facilitate the inclusion of several parser headers inside a
2636   single compilation unit.
2638 *** Exported symbols in C++
2640   The symbols YYTOKEN_TABLE and YYERROR_VERBOSE, which were defined in the
2641   header, are removed, as they prevent the possibility of including several
2642   generated headers from a single compilation unit.
2644 *** YYLSP_NEEDED
2646   For the same reasons, the undocumented and unused macro YYLSP_NEEDED is no
2647   longer defined.
2649 ** New %define variable: api.prefix
2651   Now that the generated headers are more complete and properly protected
2652   against multiple inclusions, constant names, such as YYSTYPE are a
2653   problem.  While yyparse and others are properly renamed by %name-prefix,
2654   YYSTYPE, YYDEBUG and others have never been affected by it.  Because it
2655   would introduce backward compatibility issues in projects not expecting
2656   YYSTYPE to be renamed, instead of changing the behavior of %name-prefix,
2657   it is deprecated in favor of a new %define variable: api.prefix.
2659   The following examples compares both:
2661     %name-prefix "bar_"               | %define api.prefix "bar_"
2662     %token <ival> FOO                   %token <ival> FOO
2663     %union { int ival; }                %union { int ival; }
2664     %%                                  %%
2665     exp: 'a';                           exp: 'a';
2667   bison generates:
2669     #ifndef BAR_FOO_H                   #ifndef BAR_FOO_H
2670     # define BAR_FOO_H                  # define BAR_FOO_H
2672     /* Enabling traces.  */             /* Enabling traces.  */
2673     # ifndef YYDEBUG                  | # ifndef BAR_DEBUG
2674                                       > #  if defined YYDEBUG
2675                                       > #   if YYDEBUG
2676                                       > #    define BAR_DEBUG 1
2677                                       > #   else
2678                                       > #    define BAR_DEBUG 0
2679                                       > #   endif
2680                                       > #  else
2681     #  define YYDEBUG 0               | #   define BAR_DEBUG 0
2682                                       > #  endif
2683     # endif                           | # endif
2685     # if YYDEBUG                      | # if BAR_DEBUG
2686     extern int bar_debug;               extern int bar_debug;
2687     # endif                             # endif
2689     /* Tokens.  */                      /* Tokens.  */
2690     # ifndef YYTOKENTYPE              | # ifndef BAR_TOKENTYPE
2691     #  define YYTOKENTYPE             | #  define BAR_TOKENTYPE
2692        enum yytokentype {             |    enum bar_tokentype {
2693          FOO = 258                           FOO = 258
2694        };                                  };
2695     # endif                             # endif
2697     #if ! defined YYSTYPE \           | #if ! defined BAR_STYPE \
2698      && ! defined YYSTYPE_IS_DECLARED |  && ! defined BAR_STYPE_IS_DECLARED
2699     typedef union YYSTYPE             | typedef union BAR_STYPE
2700     {                                   {
2701      int ival;                           int ival;
2702     } YYSTYPE;                        | } BAR_STYPE;
2703     # define YYSTYPE_IS_DECLARED 1    | # define BAR_STYPE_IS_DECLARED 1
2704     #endif                              #endif
2706     extern YYSTYPE bar_lval;          | extern BAR_STYPE bar_lval;
2708     int bar_parse (void);               int bar_parse (void);
2710     #endif /* !BAR_FOO_H  */            #endif /* !BAR_FOO_H  */
2713 * Noteworthy changes in release 2.5.1 (2012-06-05) [stable]
2715 ** Future changes:
2717   The next major release will drop support for generating parsers in K&R C.
2719 ** yacc.c: YYBACKUP works as expected.
2721 ** glr.c improvements:
2723 *** Location support is eliminated when not requested:
2725   GLR parsers used to include location-related code even when locations were
2726   not requested, and therefore not even usable.
2728 *** __attribute__ is preserved:
2730   __attribute__ is no longer disabled when __STRICT_ANSI__ is defined (i.e.,
2731   when -std is passed to GCC).
2733 ** lalr1.java: several fixes:
2735   The Java parser no longer throws ArrayIndexOutOfBoundsException if the
2736   first token leads to a syntax error.  Some minor clean ups.
2738 ** Changes for C++:
2740 *** C++11 compatibility:
2742   C and C++ parsers use "nullptr" instead of "0" when __cplusplus is 201103L
2743   or higher.
2745 *** Header guards
2747   The header files such as "parser.hh", "location.hh", etc. used a constant
2748   name for preprocessor guards, for instance:
2750     #ifndef BISON_LOCATION_HH
2751     # define BISON_LOCATION_HH
2752     ...
2753     #endif // !BISON_LOCATION_HH
2755   The inclusion guard is now computed from "PREFIX/FILE-NAME", where lower
2756   case characters are converted to upper case, and series of
2757   non-alphanumerical characters are converted to an underscore.
2759   With "bison -o lang++/parser.cc", "location.hh" would now include:
2761     #ifndef YY_LANG_LOCATION_HH
2762     # define YY_LANG_LOCATION_HH
2763     ...
2764     #endif // !YY_LANG_LOCATION_HH
2766 *** C++ locations:
2768   The position and location constructors (and their initialize methods)
2769   accept new arguments for line and column.  Several issues in the
2770   documentation were fixed.
2772 ** liby is no longer asking for "rpl_fprintf" on some platforms.
2774 ** Changes in the manual:
2776 *** %printer is documented
2778   The "%printer" directive, supported since at least Bison 1.50, is finally
2779   documented.  The "mfcalc" example is extended to demonstrate it.
2781   For consistency with the C skeletons, the C++ parsers now also support
2782   "yyoutput" (as an alias to "debug_stream ()").
2784 *** Several improvements have been made:
2786   The layout for grammar excerpts was changed to a more compact scheme.
2787   Named references are motivated.  The description of the automaton
2788   description file (*.output) is updated to the current format.  Incorrect
2789   index entries were fixed.  Some other errors were fixed.
2791 ** Building bison:
2793 *** Conflicting prototypes with recent/modified Flex.
2795   Fixed build problems with the current, unreleased, version of Flex, and
2796   some modified versions of 2.5.35, which have modified function prototypes.
2798 *** Warnings during the build procedure have been eliminated.
2800 *** Several portability problems in the test suite have been fixed:
2802   This includes warnings with some compilers, unexpected behavior of tools
2803   such as diff, warning messages from the test suite itself, etc.
2805 *** The install-pdf target works properly:
2807   Running "make install-pdf" (or -dvi, -html, -info, and -ps) no longer
2808   halts in the middle of its course.
2811 * Noteworthy changes in release 2.5 (2011-05-14)
2813 ** Grammar symbol names can now contain non-initial dashes:
2815   Consistently with directives (such as %error-verbose) and with
2816   %define variables (e.g. push-pull), grammar symbol names may contain
2817   dashes in any position except the beginning.  This is a GNU
2818   extension over POSIX Yacc.  Thus, use of this extension is reported
2819   by -Wyacc and rejected in Yacc mode (--yacc).
2821 ** Named references:
2823   Historically, Yacc and Bison have supported positional references
2824   ($n, $$) to allow access to symbol values from inside of semantic
2825   actions code.
2827   Starting from this version, Bison can also accept named references.
2828   When no ambiguity is possible, original symbol names may be used
2829   as named references:
2831     if_stmt : "if" cond_expr "then" then_stmt ';'
2832     { $if_stmt = mk_if_stmt($cond_expr, $then_stmt); }
2834   In the more common case, explicit names may be declared:
2836     stmt[res] : "if" expr[cond] "then" stmt[then] "else" stmt[else] ';'
2837     { $res = mk_if_stmt($cond, $then, $else); }
2839   Location information is also accessible using @name syntax.  When
2840   accessing symbol names containing dots or dashes, explicit bracketing
2841   ($[sym.1]) must be used.
2843   These features are experimental in this version.  More user feedback
2844   will help to stabilize them.
2845   Contributed by Alex Rozenman.
2847 ** IELR(1) and canonical LR(1):
2849   IELR(1) is a minimal LR(1) parser table generation algorithm.  That
2850   is, given any context-free grammar, IELR(1) generates parser tables
2851   with the full language-recognition power of canonical LR(1) but with
2852   nearly the same number of parser states as LALR(1).  This reduction
2853   in parser states is often an order of magnitude.  More importantly,
2854   because canonical LR(1)'s extra parser states may contain duplicate
2855   conflicts in the case of non-LR(1) grammars, the number of conflicts
2856   for IELR(1) is often an order of magnitude less as well.  This can
2857   significantly reduce the complexity of developing of a grammar.
2859   Bison can now generate IELR(1) and canonical LR(1) parser tables in
2860   place of its traditional LALR(1) parser tables, which remain the
2861   default.  You can specify the type of parser tables in the grammar
2862   file with these directives:
2864     %define lr.type lalr
2865     %define lr.type ielr
2866     %define lr.type canonical-lr
2868   The default-reduction optimization in the parser tables can also be
2869   adjusted using "%define lr.default-reductions".  For details on both
2870   of these features, see the new section "Tuning LR" in the Bison
2871   manual.
2873   These features are experimental.  More user feedback will help to
2874   stabilize them.
2876 ** LAC (Lookahead Correction) for syntax error handling
2878   Contributed by Joel E. Denny.
2880   Canonical LR, IELR, and LALR can suffer from a couple of problems
2881   upon encountering a syntax error.  First, the parser might perform
2882   additional parser stack reductions before discovering the syntax
2883   error.  Such reductions can perform user semantic actions that are
2884   unexpected because they are based on an invalid token, and they
2885   cause error recovery to begin in a different syntactic context than
2886   the one in which the invalid token was encountered.  Second, when
2887   verbose error messages are enabled (with %error-verbose or the
2888   obsolete "#define YYERROR_VERBOSE"), the expected token list in the
2889   syntax error message can both contain invalid tokens and omit valid
2890   tokens.
2892   The culprits for the above problems are %nonassoc, default
2893   reductions in inconsistent states, and parser state merging.  Thus,
2894   IELR and LALR suffer the most.  Canonical LR can suffer only if
2895   %nonassoc is used or if default reductions are enabled for
2896   inconsistent states.
2898   LAC is a new mechanism within the parsing algorithm that solves
2899   these problems for canonical LR, IELR, and LALR without sacrificing
2900   %nonassoc, default reductions, or state merging.  When LAC is in
2901   use, canonical LR and IELR behave almost exactly the same for both
2902   syntactically acceptable and syntactically unacceptable input.
2903   While LALR still does not support the full language-recognition
2904   power of canonical LR and IELR, LAC at least enables LALR's syntax
2905   error handling to correctly reflect LALR's language-recognition
2906   power.
2908   Currently, LAC is only supported for deterministic parsers in C.
2909   You can enable LAC with the following directive:
2911     %define parse.lac full
2913   See the new section "LAC" in the Bison manual for additional
2914   details including a few caveats.
2916   LAC is an experimental feature.  More user feedback will help to
2917   stabilize it.
2919 ** %define improvements:
2921 *** Can now be invoked via the command line:
2923   Each of these command-line options
2925     -D NAME[=VALUE]
2926     --define=NAME[=VALUE]
2928     -F NAME[=VALUE]
2929     --force-define=NAME[=VALUE]
2931   is equivalent to this grammar file declaration
2933     %define NAME ["VALUE"]
2935   except that the manner in which Bison processes multiple definitions
2936   for the same NAME differs.  Most importantly, -F and --force-define
2937   quietly override %define, but -D and --define do not.  For further
2938   details, see the section "Bison Options" in the Bison manual.
2940 *** Variables renamed:
2942   The following %define variables
2944     api.push_pull
2945     lr.keep_unreachable_states
2947   have been renamed to
2949     api.push-pull
2950     lr.keep-unreachable-states
2952   The old names are now deprecated but will be maintained indefinitely
2953   for backward compatibility.
2955 *** Values no longer need to be quoted in the grammar file:
2957   If a %define value is an identifier, it no longer needs to be placed
2958   within quotations marks.  For example,
2960     %define api.push-pull "push"
2962   can be rewritten as
2964     %define api.push-pull push
2966 *** Unrecognized variables are now errors not warnings.
2968 *** Multiple invocations for any variable is now an error not a warning.
2970 ** Unrecognized %code qualifiers are now errors not warnings.
2972 ** Character literals not of length one:
2974   Previously, Bison quietly converted all character literals to length
2975   one.  For example, without warning, Bison interpreted the operators in
2976   the following grammar to be the same token:
2978     exp: exp '++'
2979        | exp '+' exp
2980        ;
2982   Bison now warns when a character literal is not of length one.  In
2983   some future release, Bison will start reporting an error instead.
2985 ** Destructor calls fixed for lookaheads altered in semantic actions:
2987   Previously for deterministic parsers in C, if a user semantic action
2988   altered yychar, the parser in some cases used the old yychar value to
2989   determine which destructor to call for the lookahead upon a syntax
2990   error or upon parser return.  This bug has been fixed.
2992 ** C++ parsers use YYRHSLOC:
2994   Similarly to the C parsers, the C++ parsers now define the YYRHSLOC
2995   macro and use it in the default YYLLOC_DEFAULT.  You are encouraged
2996   to use it.  If, for instance, your location structure has "first"
2997   and "last" members, instead of
2999     # define YYLLOC_DEFAULT(Current, Rhs, N)                             \
3000       do                                                                 \
3001         if (N)                                                           \
3002           {                                                              \
3003             (Current).first = (Rhs)[1].location.first;                   \
3004             (Current).last  = (Rhs)[N].location.last;                    \
3005           }                                                              \
3006         else                                                             \
3007           {                                                              \
3008             (Current).first = (Current).last = (Rhs)[0].location.last;   \
3009           }                                                              \
3010       while (false)
3012   use:
3014     # define YYLLOC_DEFAULT(Current, Rhs, N)                             \
3015       do                                                                 \
3016         if (N)                                                           \
3017           {                                                              \
3018             (Current).first = YYRHSLOC (Rhs, 1).first;                   \
3019             (Current).last  = YYRHSLOC (Rhs, N).last;                    \
3020           }                                                              \
3021         else                                                             \
3022           {                                                              \
3023             (Current).first = (Current).last = YYRHSLOC (Rhs, 0).last;   \
3024           }                                                              \
3025       while (false)
3027 ** YYLLOC_DEFAULT in C++:
3029   The default implementation of YYLLOC_DEFAULT used to be issued in
3030   the header file.  It is now output in the implementation file, after
3031   the user %code sections so that its #ifndef guard does not try to
3032   override the user's YYLLOC_DEFAULT if provided.
3034 ** YYFAIL now produces warnings and Java parsers no longer implement it:
3036   YYFAIL has existed for many years as an undocumented feature of
3037   deterministic parsers in C generated by Bison.  More recently, it was
3038   a documented feature of Bison's experimental Java parsers.  As
3039   promised in Bison 2.4.2's NEWS entry, any appearance of YYFAIL in a
3040   semantic action now produces a deprecation warning, and Java parsers
3041   no longer implement YYFAIL at all.  For further details, including a
3042   discussion of how to suppress C preprocessor warnings about YYFAIL
3043   being unused, see the Bison 2.4.2 NEWS entry.
3045 ** Temporary hack for adding a semicolon to the user action:
3047   Previously, Bison appended a semicolon to every user action for
3048   reductions when the output language defaulted to C (specifically, when
3049   neither %yacc, %language, %skeleton, or equivalent command-line
3050   options were specified).  This allowed actions such as
3052     exp: exp "+" exp { $$ = $1 + $3 };
3054   instead of
3056     exp: exp "+" exp { $$ = $1 + $3; };
3058   As a first step in removing this misfeature, Bison now issues a
3059   warning when it appends a semicolon.  Moreover, in cases where Bison
3060   cannot easily determine whether a semicolon is needed (for example, an
3061   action ending with a cpp directive or a braced compound initializer),
3062   it no longer appends one.  Thus, the C compiler might now complain
3063   about a missing semicolon where it did not before.  Future releases of
3064   Bison will cease to append semicolons entirely.
3066 ** Verbose syntax error message fixes:
3068   When %error-verbose or the obsolete "#define YYERROR_VERBOSE" is
3069   specified, syntax error messages produced by the generated parser
3070   include the unexpected token as well as a list of expected tokens.
3071   The effect of %nonassoc on these verbose messages has been corrected
3072   in two ways, but a more complete fix requires LAC, described above:
3074 *** When %nonassoc is used, there can exist parser states that accept no
3075     tokens, and so the parser does not always require a lookahead token
3076     in order to detect a syntax error.  Because no unexpected token or
3077     expected tokens can then be reported, the verbose syntax error
3078     message described above is suppressed, and the parser instead
3079     reports the simpler message, "syntax error".  Previously, this
3080     suppression was sometimes erroneously triggered by %nonassoc when a
3081     lookahead was actually required.  Now verbose messages are
3082     suppressed only when all previous lookaheads have already been
3083     shifted or discarded.
3085 *** Previously, the list of expected tokens erroneously included tokens
3086     that would actually induce a syntax error because conflicts for them
3087     were resolved with %nonassoc in the current parser state.  Such
3088     tokens are now properly omitted from the list.
3090 *** Expected token lists are still often wrong due to state merging
3091     (from LALR or IELR) and default reductions, which can both add
3092     invalid tokens and subtract valid tokens.  Canonical LR almost
3093     completely fixes this problem by eliminating state merging and
3094     default reductions.  However, there is one minor problem left even
3095     when using canonical LR and even after the fixes above.  That is,
3096     if the resolution of a conflict with %nonassoc appears in a later
3097     parser state than the one at which some syntax error is
3098     discovered, the conflicted token is still erroneously included in
3099     the expected token list.  Bison's new LAC implementation,
3100     described above, eliminates this problem and the need for
3101     canonical LR.  However, LAC is still experimental and is disabled
3102     by default.
3104 ** Java skeleton fixes:
3106 *** A location handling bug has been fixed.
3108 *** The top element of each of the value stack and location stack is now
3109     cleared when popped so that it can be garbage collected.
3111 *** Parser traces now print the top element of the stack.
3113 ** -W/--warnings fixes:
3115 *** Bison now properly recognizes the "no-" versions of categories:
3117   For example, given the following command line, Bison now enables all
3118   warnings except warnings for incompatibilities with POSIX Yacc:
3120     bison -Wall,no-yacc gram.y
3122 *** Bison now treats S/R and R/R conflicts like other warnings:
3124   Previously, conflict reports were independent of Bison's normal
3125   warning system.  Now, Bison recognizes the warning categories
3126   "conflicts-sr" and "conflicts-rr".  This change has important
3127   consequences for the -W and --warnings command-line options.  For
3128   example:
3130     bison -Wno-conflicts-sr gram.y  # S/R conflicts not reported
3131     bison -Wno-conflicts-rr gram.y  # R/R conflicts not reported
3132     bison -Wnone            gram.y  # no conflicts are reported
3133     bison -Werror           gram.y  # any conflict is an error
3135   However, as before, if the %expect or %expect-rr directive is
3136   specified, an unexpected number of conflicts is an error, and an
3137   expected number of conflicts is not reported, so -W and --warning
3138   then have no effect on the conflict report.
3140 *** The "none" category no longer disables a preceding "error":
3142   For example, for the following command line, Bison now reports
3143   errors instead of warnings for incompatibilities with POSIX Yacc:
3145     bison -Werror,none,yacc gram.y
3147 *** The "none" category now disables all Bison warnings:
3149   Previously, the "none" category disabled only Bison warnings for
3150   which there existed a specific -W/--warning category.  However,
3151   given the following command line, Bison is now guaranteed to
3152   suppress all warnings:
3154     bison -Wnone gram.y
3156 ** Precedence directives can now assign token number 0:
3158   Since Bison 2.3b, which restored the ability of precedence
3159   directives to assign token numbers, doing so for token number 0 has
3160   produced an assertion failure.  For example:
3162     %left END 0
3164   This bug has been fixed.
3167 * Noteworthy changes in release 2.4.3 (2010-08-05)
3169 ** Bison now obeys -Werror and --warnings=error for warnings about
3170    grammar rules that are useless in the parser due to conflicts.
3172 ** Problems with spawning M4 on at least FreeBSD 8 and FreeBSD 9 have
3173    been fixed.
3175 ** Failures in the test suite for GCC 4.5 have been fixed.
3177 ** Failures in the test suite for some versions of Sun Studio C++ have
3178    been fixed.
3180 ** Contrary to Bison 2.4.2's NEWS entry, it has been decided that
3181    warnings about undefined %prec identifiers will not be converted to
3182    errors in Bison 2.5.  They will remain warnings, which should be
3183    sufficient for POSIX while avoiding backward compatibility issues.
3185 ** Minor documentation fixes.
3188 * Noteworthy changes in release 2.4.2 (2010-03-20)
3190 ** Some portability problems that resulted in failures and livelocks
3191    in the test suite on some versions of at least Solaris, AIX, HP-UX,
3192    RHEL4, and Tru64 have been addressed.  As a result, fatal Bison
3193    errors should no longer cause M4 to report a broken pipe on the
3194    affected platforms.
3196 ** "%prec IDENTIFIER" requires IDENTIFIER to be defined separately.
3198   POSIX specifies that an error be reported for any identifier that does
3199   not appear on the LHS of a grammar rule and that is not defined by
3200   %token, %left, %right, or %nonassoc.  Bison 2.3b and later lost this
3201   error report for the case when an identifier appears only after a
3202   %prec directive.  It is now restored.  However, for backward
3203   compatibility with recent Bison releases, it is only a warning for
3204   now.  In Bison 2.5 and later, it will return to being an error.
3205   [Between the 2.4.2 and 2.4.3 releases, it was decided that this
3206   warning will not be converted to an error in Bison 2.5.]
3208 ** Detection of GNU M4 1.4.6 or newer during configure is improved.
3210 ** Warnings from gcc's -Wundef option about undefined YYENABLE_NLS,
3211    YYLTYPE_IS_TRIVIAL, and __STRICT_ANSI__ in C/C++ parsers are now
3212    avoided.
3214 ** %code is now a permanent feature.
3216   A traditional Yacc prologue directive is written in the form:
3218     %{CODE%}
3220   To provide a more flexible alternative, Bison 2.3b introduced the
3221   %code directive with the following forms for C/C++:
3223     %code          {CODE}
3224     %code requires {CODE}
3225     %code provides {CODE}
3226     %code top      {CODE}
3228   These forms are now considered permanent features of Bison.  See the
3229   %code entries in the section "Bison Declaration Summary" in the Bison
3230   manual for a summary of their functionality.  See the section
3231   "Prologue Alternatives" for a detailed discussion including the
3232   advantages of %code over the traditional Yacc prologue directive.
3234   Bison's Java feature as a whole including its current usage of %code
3235   is still considered experimental.
3237 ** YYFAIL is deprecated and will eventually be removed.
3239   YYFAIL has existed for many years as an undocumented feature of
3240   deterministic parsers in C generated by Bison.  Previously, it was
3241   documented for Bison's experimental Java parsers.  YYFAIL is no longer
3242   documented for Java parsers and is formally deprecated in both cases.
3243   Users are strongly encouraged to migrate to YYERROR, which is
3244   specified by POSIX.
3246   Like YYERROR, you can invoke YYFAIL from a semantic action in order to
3247   induce a syntax error.  The most obvious difference from YYERROR is
3248   that YYFAIL will automatically invoke yyerror to report the syntax
3249   error so that you don't have to.  However, there are several other
3250   subtle differences between YYERROR and YYFAIL, and YYFAIL suffers from
3251   inherent flaws when %error-verbose or "#define YYERROR_VERBOSE" is
3252   used.  For a more detailed discussion, see:
3254     http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html
3256   The upcoming Bison 2.5 will remove YYFAIL from Java parsers, but
3257   deterministic parsers in C will continue to implement it.  However,
3258   because YYFAIL is already flawed, it seems futile to try to make new
3259   Bison features compatible with it.  Thus, during parser generation,
3260   Bison 2.5 will produce a warning whenever it discovers YYFAIL in a
3261   rule action.  In a later release, YYFAIL will be disabled for
3262   %error-verbose and "#define YYERROR_VERBOSE".  Eventually, YYFAIL will
3263   be removed altogether.
3265   There exists at least one case where Bison 2.5's YYFAIL warning will
3266   be a false positive.  Some projects add phony uses of YYFAIL and other
3267   Bison-defined macros for the sole purpose of suppressing C
3268   preprocessor warnings (from GCC cpp's -Wunused-macros, for example).
3269   To avoid Bison's future warning, such YYFAIL uses can be moved to the
3270   epilogue (that is, after the second "%%") in the Bison input file.  In
3271   this release (2.4.2), Bison already generates its own code to suppress
3272   C preprocessor warnings for YYFAIL, so projects can remove their own
3273   phony uses of YYFAIL if compatibility with Bison releases prior to
3274   2.4.2 is not necessary.
3276 ** Internationalization.
3278   Fix a regression introduced in Bison 2.4: Under some circumstances,
3279   message translations were not installed although supported by the
3280   host system.
3283 * Noteworthy changes in release 2.4.1 (2008-12-11)
3285 ** In the GLR defines file, unexpanded M4 macros in the yylval and yylloc
3286    declarations have been fixed.
3288 ** Temporary hack for adding a semicolon to the user action.
3290   Bison used to prepend a trailing semicolon at the end of the user
3291   action for reductions.  This allowed actions such as
3293     exp: exp "+" exp { $$ = $1 + $3 };
3295   instead of
3297     exp: exp "+" exp { $$ = $1 + $3; };
3299   Some grammars still depend on this "feature".  Bison 2.4.1 restores
3300   the previous behavior in the case of C output (specifically, when
3301   neither %language or %skeleton or equivalent command-line options
3302   are used) to leave more time for grammars depending on the old
3303   behavior to be adjusted.  Future releases of Bison will disable this
3304   feature.
3306 ** A few minor improvements to the Bison manual.
3309 * Noteworthy changes in release 2.4 (2008-11-02)
3311 ** %language is an experimental feature.
3313   We first introduced this feature in test release 2.3b as a cleaner
3314   alternative to %skeleton.  Since then, we have discussed the possibility of
3315   modifying its effect on Bison's output file names.  Thus, in this release,
3316   we consider %language to be an experimental feature that will likely evolve
3317   in future releases.
3319 ** Forward compatibility with GNU M4 has been improved.
3321 ** Several bugs in the C++ skeleton and the experimental Java skeleton have been
3322   fixed.
3325 * Noteworthy changes in release 2.3b (2008-05-27)
3327 ** The quotes around NAME that used to be required in the following directive
3328   are now deprecated:
3330     %define NAME "VALUE"
3332 ** The directive "%pure-parser" is now deprecated in favor of:
3334     %define api.pure
3336   which has the same effect except that Bison is more careful to warn about
3337   unreasonable usage in the latter case.
3339 ** Push Parsing
3341   Bison can now generate an LALR(1) parser in C with a push interface.  That
3342   is, instead of invoking "yyparse", which pulls tokens from "yylex", you can
3343   push one token at a time to the parser using "yypush_parse", which will
3344   return to the caller after processing each token.  By default, the push
3345   interface is disabled.  Either of the following directives will enable it:
3347     %define api.push_pull "push" // Just push; does not require yylex.
3348     %define api.push_pull "both" // Push and pull; requires yylex.
3350   See the new section "A Push Parser" in the Bison manual for details.
3352   The current push parsing interface is experimental and may evolve.  More user
3353   feedback will help to stabilize it.
3355 ** The -g and --graph options now output graphs in Graphviz DOT format,
3356   not VCG format.  Like --graph, -g now also takes an optional FILE argument
3357   and thus cannot be bundled with other short options.
3359 ** Java
3361   Bison can now generate an LALR(1) parser in Java.  The skeleton is
3362   "data/lalr1.java".  Consider using the new %language directive instead of
3363   %skeleton to select it.
3365   See the new section "Java Parsers" in the Bison manual for details.
3367   The current Java interface is experimental and may evolve.  More user
3368   feedback will help to stabilize it.
3369   Contributed by Paolo Bonzini.
3371 ** %language
3373   This new directive specifies the programming language of the generated
3374   parser, which can be C (the default), C++, or Java.  Besides the skeleton
3375   that Bison uses, the directive affects the names of the generated files if
3376   the grammar file's name ends in ".y".
3378 ** XML Automaton Report
3380   Bison can now generate an XML report of the LALR(1) automaton using the new
3381   "--xml" option.  The current XML schema is experimental and may evolve.  More
3382   user feedback will help to stabilize it.
3383   Contributed by Wojciech Polak.
3385 ** The grammar file may now specify the name of the parser header file using
3386   %defines.  For example:
3388     %defines "parser.h"
3390 ** When reporting useless rules, useless nonterminals, and unused terminals,
3391   Bison now employs the terms "useless in grammar" instead of "useless",
3392   "useless in parser" instead of "never reduced", and "unused in grammar"
3393   instead of "unused".
3395 ** Unreachable State Removal
3397   Previously, Bison sometimes generated parser tables containing unreachable
3398   states.  A state can become unreachable during conflict resolution if Bison
3399   disables a shift action leading to it from a predecessor state.  Bison now:
3401     1. Removes unreachable states.
3403     2. Does not report any conflicts that appeared in unreachable states.
3404        WARNING: As a result, you may need to update %expect and %expect-rr
3405        directives in existing grammar files.
3407     3. For any rule used only in such states, Bison now reports the rule as
3408        "useless in parser due to conflicts".
3410   This feature can be disabled with the following directive:
3412     %define lr.keep_unreachable_states
3414   See the %define entry in the "Bison Declaration Summary" in the Bison manual
3415   for further discussion.
3417 ** Lookahead Set Correction in the ".output" Report
3419   When instructed to generate a ".output" file including lookahead sets
3420   (using "--report=lookahead", for example), Bison now prints each reduction's
3421   lookahead set only next to the associated state's one item that (1) is
3422   associated with the same rule as the reduction and (2) has its dot at the end
3423   of its RHS.  Previously, Bison also erroneously printed the lookahead set
3424   next to all of the state's other items associated with the same rule.  This
3425   bug affected only the ".output" file and not the generated parser source
3426   code.
3428 ** --report-file=FILE is a new option to override the default ".output" file
3429   name.
3431 ** The "=" that used to be required in the following directives is now
3432   deprecated:
3434     %file-prefix "parser"
3435     %name-prefix "c_"
3436     %output "parser.c"
3438 ** An Alternative to "%{...%}" -- "%code QUALIFIER {CODE}"
3440   Bison 2.3a provided a new set of directives as a more flexible alternative to
3441   the traditional Yacc prologue blocks.  Those have now been consolidated into
3442   a single %code directive with an optional qualifier field, which identifies
3443   the purpose of the code and thus the location(s) where Bison should generate
3444   it:
3446     1. "%code          {CODE}" replaces "%after-header  {CODE}"
3447     2. "%code requires {CODE}" replaces "%start-header  {CODE}"
3448     3. "%code provides {CODE}" replaces "%end-header    {CODE}"
3449     4. "%code top      {CODE}" replaces "%before-header {CODE}"
3451   See the %code entries in section "Bison Declaration Summary" in the Bison
3452   manual for a summary of the new functionality.  See the new section "Prologue
3453   Alternatives" for a detailed discussion including the advantages of %code
3454   over the traditional Yacc prologues.
3456   The prologue alternatives are experimental.  More user feedback will help to
3457   determine whether they should become permanent features.
3459 ** Revised warning: unset or unused midrule values
3461   Since Bison 2.2, Bison has warned about midrule values that are set but not
3462   used within any of the actions of the parent rule.  For example, Bison warns
3463   about unused $2 in:
3465     exp: '1' { $$ = 1; } '+' exp { $$ = $1 + $4; };
3467   Now, Bison also warns about midrule values that are used but not set.  For
3468   example, Bison warns about unset $$ in the midrule action in:
3470     exp: '1' { $1 = 1; } '+' exp { $$ = $2 + $4; };
3472   However, Bison now disables both of these warnings by default since they
3473   sometimes prove to be false alarms in existing grammars employing the Yacc
3474   constructs $0 or $-N (where N is some positive integer).
3476   To enable these warnings, specify the option "--warnings=midrule-values" or
3477   "-W", which is a synonym for "--warnings=all".
3479 ** Default %destructor or %printer with "<*>" or "<>"
3481   Bison now recognizes two separate kinds of default %destructor's and
3482   %printer's:
3484     1. Place "<*>" in a %destructor/%printer symbol list to define a default
3485        %destructor/%printer for all grammar symbols for which you have formally
3486        declared semantic type tags.
3488     2. Place "<>" in a %destructor/%printer symbol list to define a default
3489        %destructor/%printer for all grammar symbols without declared semantic
3490        type tags.
3492   Bison no longer supports the "%symbol-default" notation from Bison 2.3a.
3493   "<*>" and "<>" combined achieve the same effect with one exception: Bison no
3494   longer applies any %destructor to a midrule value if that midrule value is
3495   not actually ever referenced using either $$ or $n in a semantic action.
3497   The default %destructor's and %printer's are experimental.  More user
3498   feedback will help to determine whether they should become permanent
3499   features.
3501   See the section "Freeing Discarded Symbols" in the Bison manual for further
3502   details.
3504 ** %left, %right, and %nonassoc can now declare token numbers.  This is required
3505   by POSIX.  However, see the end of section "Operator Precedence" in the Bison
3506   manual for a caveat concerning the treatment of literal strings.
3508 ** The nonfunctional --no-parser, -n, and %no-parser options have been
3509   completely removed from Bison.
3512 * Noteworthy changes in release 2.3a (2006-09-13)
3514 ** Instead of %union, you can define and use your own union type
3515   YYSTYPE if your grammar contains at least one <type> tag.
3516   Your YYSTYPE need not be a macro; it can be a typedef.
3517   This change is for compatibility with other Yacc implementations,
3518   and is required by POSIX.
3520 ** Locations columns and lines start at 1.
3521   In accordance with the GNU Coding Standards and Emacs.
3523 ** You may now declare per-type and default %destructor's and %printer's:
3525   For example:
3527     %union { char *string; }
3528     %token <string> STRING1
3529     %token <string> STRING2
3530     %type  <string> string1
3531     %type  <string> string2
3532     %union { char character; }
3533     %token <character> CHR
3534     %type  <character> chr
3535     %destructor { free ($$); } %symbol-default
3536     %destructor { free ($$); printf ("%d", @$.first_line); } STRING1 string1
3537     %destructor { } <character>
3539   guarantees that, when the parser discards any user-defined symbol that has a
3540   semantic type tag other than "<character>", it passes its semantic value to
3541   "free".  However, when the parser discards a "STRING1" or a "string1", it
3542   also prints its line number to "stdout".  It performs only the second
3543   "%destructor" in this case, so it invokes "free" only once.
3545   [Although we failed to mention this here in the 2.3a release, the default
3546   %destructor's and %printer's were experimental, and they were rewritten in
3547   future versions.]
3549 ** Except for LALR(1) parsers in C with POSIX Yacc emulation enabled (with "-y",
3550   "--yacc", or "%yacc"), Bison no longer generates #define statements for
3551   associating token numbers with token names.  Removing the #define statements
3552   helps to sanitize the global namespace during preprocessing, but POSIX Yacc
3553   requires them.  Bison still generates an enum for token names in all cases.
3555 ** Handling of traditional Yacc prologue blocks is now more consistent but
3556   potentially incompatible with previous releases of Bison.
3558   As before, you declare prologue blocks in your grammar file with the
3559   "%{ ... %}" syntax.  To generate the pre-prologue, Bison concatenates all
3560   prologue blocks that you've declared before the first %union.  To generate
3561   the post-prologue, Bison concatenates all prologue blocks that you've
3562   declared after the first %union.
3564   Previous releases of Bison inserted the pre-prologue into both the header
3565   file and the code file in all cases except for LALR(1) parsers in C.  In the
3566   latter case, Bison inserted it only into the code file.  For parsers in C++,
3567   the point of insertion was before any token definitions (which associate
3568   token numbers with names).  For parsers in C, the point of insertion was
3569   after the token definitions.
3571   Now, Bison never inserts the pre-prologue into the header file.  In the code
3572   file, it always inserts it before the token definitions.
3574 ** Bison now provides a more flexible alternative to the traditional Yacc
3575   prologue blocks: %before-header, %start-header, %end-header, and
3576   %after-header.
3578   For example, the following declaration order in the grammar file reflects the
3579   order in which Bison will output these code blocks.  However, you are free to
3580   declare these code blocks in your grammar file in whatever order is most
3581   convenient for you:
3583     %before-header {
3584       /* Bison treats this block like a pre-prologue block: it inserts it into
3585        * the code file before the contents of the header file.  It does *not*
3586        * insert it into the header file.  This is a good place to put
3587        * #include's that you want at the top of your code file.  A common
3588        * example is '#include "system.h"'.  */
3589     }
3590     %start-header {
3591       /* Bison inserts this block into both the header file and the code file.
3592        * In both files, the point of insertion is before any Bison-generated
3593        * token, semantic type, location type, and class definitions.  This is a
3594        * good place to define %union dependencies, for example.  */
3595     }
3596     %union {
3597       /* Unlike the traditional Yacc prologue blocks, the output order for the
3598        * new %*-header blocks is not affected by their declaration position
3599        * relative to any %union in the grammar file.  */
3600     }
3601     %end-header {
3602       /* Bison inserts this block into both the header file and the code file.
3603        * In both files, the point of insertion is after the Bison-generated
3604        * definitions.  This is a good place to declare or define public
3605        * functions or data structures that depend on the Bison-generated
3606        * definitions.  */
3607     }
3608     %after-header {
3609       /* Bison treats this block like a post-prologue block: it inserts it into
3610        * the code file after the contents of the header file.  It does *not*
3611        * insert it into the header file.  This is a good place to declare or
3612        * define internal functions or data structures that depend on the
3613        * Bison-generated definitions.  */
3614     }
3616   If you have multiple occurrences of any one of the above declarations, Bison
3617   will concatenate the contents in declaration order.
3619   [Although we failed to mention this here in the 2.3a release, the prologue
3620   alternatives were experimental, and they were rewritten in future versions.]
3622 ** The option "--report=look-ahead" has been changed to "--report=lookahead".
3623   The old spelling still works, but is not documented and may be removed
3624   in a future release.
3627 * Noteworthy changes in release 2.3 (2006-06-05)
3629 ** GLR grammars should now use "YYRECOVERING ()" instead of "YYRECOVERING",
3630   for compatibility with LALR(1) grammars.
3632 ** It is now documented that any definition of YYSTYPE or YYLTYPE should
3633   be to a type name that does not contain parentheses or brackets.
3636 * Noteworthy changes in release 2.2 (2006-05-19)
3638 ** The distribution terms for all Bison-generated parsers now permit
3639   using the parsers in nonfree programs.  Previously, this permission
3640   was granted only for Bison-generated LALR(1) parsers in C.
3642 ** %name-prefix changes the namespace name in C++ outputs.
3644 ** The C++ parsers export their token_type.
3646 ** Bison now allows multiple %union declarations, and concatenates
3647   their contents together.
3649 ** New warning: unused values
3650   Right-hand side symbols whose values are not used are reported,
3651   if the symbols have destructors.  For instance:
3653      exp: exp "?" exp ":" exp { $1 ? $1 : $3; }
3654         | exp "+" exp
3655         ;
3657   will trigger a warning about $$ and $5 in the first rule, and $3 in
3658   the second ($1 is copied to $$ by the default rule).  This example
3659   most likely contains three errors, and could be rewritten as:
3661      exp: exp "?" exp ":" exp
3662             { $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); }
3663         | exp "+" exp
3664             { $$ = $1 ? $1 : $3; if ($1) free ($3); }
3665         ;
3667   However, if the original actions were really intended, memory leaks
3668   and all, the warnings can be suppressed by letting Bison believe the
3669   values are used, e.g.:
3671      exp: exp "?" exp ":" exp { $1 ? $1 : $3; (void) ($$, $5); }
3672         | exp "+" exp         { $$ = $1; (void) $3; }
3673         ;
3675   If there are midrule actions, the warning is issued if no action
3676   uses it.  The following triggers no warning: $1 and $3 are used.
3678      exp: exp { push ($1); } '+' exp { push ($3); sum (); };
3680   The warning is intended to help catching lost values and memory leaks.
3681   If a value is ignored, its associated memory typically is not reclaimed.
3683 ** %destructor vs. YYABORT, YYACCEPT, and YYERROR.
3684   Destructors are now called when user code invokes YYABORT, YYACCEPT,
3685   and YYERROR, for all objects on the stack, other than objects
3686   corresponding to the right-hand side of the current rule.
3688 ** %expect, %expect-rr
3689   Incorrect numbers of expected conflicts are now actual errors,
3690   instead of warnings.
3692 ** GLR, YACC parsers.
3693   The %parse-params are available in the destructors (and the
3694   experimental printers) as per the documentation.
3696 ** Bison now warns if it finds a stray "$" or "@" in an action.
3698 ** %require "VERSION"
3699   This specifies that the grammar file depends on features implemented
3700   in Bison version VERSION or higher.
3702 ** lalr1.cc: The token and value types are now class members.
3703   The tokens were defined as free form enums and cpp macros.  YYSTYPE
3704   was defined as a free form union.  They are now class members:
3705   tokens are enumerations of the "yy::parser::token" struct, and the
3706   semantic values have the "yy::parser::semantic_type" type.
3708   If you do not want or can update to this scheme, the directive
3709   '%define "global_tokens_and_yystype" "1"' triggers the global
3710   definition of tokens and YYSTYPE.  This change is suitable both
3711   for previous releases of Bison, and this one.
3713   If you wish to update, then make sure older version of Bison will
3714   fail using '%require "2.2"'.
3716 ** DJGPP support added.
3719 * Noteworthy changes in release 2.1 (2005-09-16)
3721 ** The C++ lalr1.cc skeleton supports %lex-param.
3723 ** Bison-generated parsers now support the translation of diagnostics like
3724   "syntax error" into languages other than English.  The default
3725   language is still English.  For details, please see the new
3726   Internationalization section of the Bison manual.  Software
3727   distributors should also see the new PACKAGING file.  Thanks to
3728   Bruno Haible for this new feature.
3730 ** Wording in the Bison-generated parsers has been changed slightly to
3731   simplify translation.  In particular, the message "memory exhausted"
3732   has replaced "parser stack overflow", as the old message was not
3733   always accurate for modern Bison-generated parsers.
3735 ** Destructors are now called when the parser aborts, for all symbols left
3736   behind on the stack.  Also, the start symbol is now destroyed after a
3737   successful parse.  In both cases, the behavior was formerly inconsistent.
3739 ** When generating verbose diagnostics, Bison-generated parsers no longer
3740   quote the literal strings associated with tokens.  For example, for
3741   a syntax error associated with '%token NUM "number"' they might
3742   print 'syntax error, unexpected number' instead of 'syntax error,
3743   unexpected "number"'.
3746 * Noteworthy changes in release 2.0 (2004-12-25)
3748 ** Possibly-incompatible changes
3750   - Bison-generated parsers no longer default to using the alloca function
3751     (when available) to extend the parser stack, due to widespread
3752     problems in unchecked stack-overflow detection.  You can "#define
3753     YYSTACK_USE_ALLOCA 1" to require the use of alloca, but please read
3754     the manual to determine safe values for YYMAXDEPTH in that case.
3756   - Error token location.
3757     During error recovery, the location of the syntax error is updated
3758     to cover the whole sequence covered by the error token: it includes
3759     the shifted symbols thrown away during the first part of the error
3760     recovery, and the lookahead rejected during the second part.
3762   - Semicolon changes:
3763     . Stray semicolons are no longer allowed at the start of a grammar.
3764     . Semicolons are now required after in-grammar declarations.
3766   - Unescaped newlines are no longer allowed in character constants or
3767     string literals.  They were never portable, and GCC 3.4.0 has
3768     dropped support for them.  Better diagnostics are now generated if
3769     forget a closing quote.
3771   - NUL bytes are no longer allowed in Bison string literals, unfortunately.
3773 ** New features
3775   - GLR grammars now support locations.
3777   - New directive: %initial-action.
3778     This directive allows the user to run arbitrary code (including
3779     initializing @$) from yyparse before parsing starts.
3781   - A new directive "%expect-rr N" specifies the expected number of
3782     reduce/reduce conflicts in GLR parsers.
3784   - %token numbers can now be hexadecimal integers, e.g., "%token FOO 0x12d".
3785     This is a GNU extension.
3787   - The option "--report=lookahead" was changed to "--report=look-ahead".
3788     [However, this was changed back after 2.3.]
3790   - Experimental %destructor support has been added to lalr1.cc.
3792   - New configure option --disable-yacc, to disable installation of the
3793     yacc command and -ly library introduced in 1.875 for POSIX conformance.
3795 ** Bug fixes
3797   - For now, %expect-count violations are now just warnings, not errors.
3798     This is for compatibility with Bison 1.75 and earlier (when there are
3799     reduce/reduce conflicts) and with Bison 1.30 and earlier (when there
3800     are too many or too few shift/reduce conflicts).  However, in future
3801     versions of Bison we plan to improve the %expect machinery so that
3802     these violations will become errors again.
3804   - Within Bison itself, numbers (e.g., goto numbers) are no longer
3805     arbitrarily limited to 16-bit counts.
3807   - Semicolons are now allowed before "|" in grammar rules, as POSIX requires.
3810 * Noteworthy changes in release 1.875 (2003-01-01)
3812 ** The documentation license has been upgraded to version 1.2
3813   of the GNU Free Documentation License.
3815 ** syntax error processing
3817   - In Yacc-style parsers YYLLOC_DEFAULT is now used to compute error
3818     locations too.  This fixes bugs in error-location computation.
3820   - %destructor
3821     It is now possible to reclaim the memory associated to symbols
3822     discarded during error recovery.  This feature is still experimental.
3824   - %error-verbose
3825     This new directive is preferred over YYERROR_VERBOSE.
3827   - #defining yyerror to steal internal variables is discouraged.
3828     It is not guaranteed to work forever.
3830 ** POSIX conformance
3832   - Semicolons are once again optional at the end of grammar rules.
3833     This reverts to the behavior of Bison 1.33 and earlier, and improves
3834     compatibility with Yacc.
3836   - "parse error" -> "syntax error"
3837     Bison now uniformly uses the term "syntax error"; formerly, the code
3838     and manual sometimes used the term "parse error" instead.  POSIX
3839     requires "syntax error" in diagnostics, and it was thought better to
3840     be consistent.
3842   - The documentation now emphasizes that yylex and yyerror must be
3843     declared before use.  C99 requires this.
3845   - Bison now parses C99 lexical constructs like UCNs and
3846     backslash-newline within C escape sequences, as POSIX 1003.1-2001 requires.
3848   - File names are properly escaped in C output.  E.g., foo\bar.y is
3849     output as "foo\\bar.y".
3851   - Yacc command and library now available
3852     The Bison distribution now installs a "yacc" command, as POSIX requires.
3853     Also, Bison now installs a small library liby.a containing
3854     implementations of Yacc-compatible yyerror and main functions.
3855     This library is normally not useful, but POSIX requires it.
3857   - Type clashes now generate warnings, not errors.
3859   - If the user does not define YYSTYPE as a macro, Bison now declares it
3860     using typedef instead of defining it as a macro.
3861     For consistency, YYLTYPE is also declared instead of defined.
3863 ** Other compatibility issues
3865   - %union directives can now have a tag before the "{", e.g., the
3866     directive "%union foo {...}" now generates the C code
3867     "typedef union foo { ... } YYSTYPE;"; this is for Yacc compatibility.
3868     The default union tag is "YYSTYPE", for compatibility with Solaris 9 Yacc.
3869     For consistency, YYLTYPE's struct tag is now "YYLTYPE" not "yyltype".
3870     This is for compatibility with both Yacc and Bison 1.35.
3872   - ";" is output before the terminating "}" of an action, for
3873     compatibility with Bison 1.35.
3875   - Bison now uses a Yacc-style format for conflict reports, e.g.,
3876     "conflicts: 2 shift/reduce, 1 reduce/reduce".
3878   - "yystype" and "yyltype" are now obsolescent macros instead of being
3879     typedefs or tags; they are no longer documented and are planned to be
3880     withdrawn in a future release.
3882 ** GLR parser notes
3884   - GLR and inline
3885     Users of Bison have to decide how they handle the portability of the
3886     C keyword "inline".
3888   - "parsing stack overflow..." -> "parser stack overflow"
3889     GLR parsers now report "parser stack overflow" as per the Bison manual.
3891 ** %parse-param and %lex-param
3892   The macros YYPARSE_PARAM and YYLEX_PARAM provide a means to pass
3893   additional context to yyparse and yylex.  They suffer from several
3894   shortcomings:
3896   - a single argument only can be added,
3897   - their types are weak (void *),
3898   - this context is not passed to ancillary functions such as yyerror,
3899   - only yacc.c parsers support them.
3901   The new %parse-param/%lex-param directives provide a more precise control.
3902   For instance:
3904     %parse-param {int *nastiness}
3905     %lex-param   {int *nastiness}
3906     %parse-param {int *randomness}
3908   results in the following signatures:
3910     int yylex   (int *nastiness);
3911     int yyparse (int *nastiness, int *randomness);
3913   or, if both %pure-parser and %locations are used:
3915     int yylex   (YYSTYPE *lvalp, YYLTYPE *llocp, int *nastiness);
3916     int yyparse (int *nastiness, int *randomness);
3918 ** Bison now warns if it detects conflicting outputs to the same file,
3919   e.g., it generates a warning for "bison -d -o foo.h foo.y" since
3920   that command outputs both code and header to foo.h.
3922 ** #line in output files
3923   - --no-line works properly.
3925 ** Bison can no longer be built by a K&R C compiler; it requires C89 or
3926   later to be built.  This change originally took place a few versions
3927   ago, but nobody noticed until we recently asked someone to try
3928   building Bison with a K&R C compiler.
3931 * Noteworthy changes in release 1.75 (2002-10-14)
3933 ** Bison should now work on 64-bit hosts.
3935 ** Indonesian translation thanks to Tedi Heriyanto.
3937 ** GLR parsers
3938   Fix spurious parse errors.
3940 ** Pure parsers
3941   Some people redefine yyerror to steal yyparse' private variables.
3942   Reenable this trick until an official feature replaces it.
3944 ** Type Clashes
3945   In agreement with POSIX and with other Yaccs, leaving a default
3946   action is valid when $$ is untyped, and $1 typed:
3948         untyped: ... typed;
3950   but the converse remains an error:
3952         typed: ... untyped;
3954 ** Values of midrule actions
3955   The following code:
3957         foo: { ... } { $$ = $1; } ...
3959   was incorrectly rejected: $1 is defined in the second midrule
3960   action, and is equal to the $$ of the first midrule action.
3963 * Noteworthy changes in release 1.50 (2002-10-04)
3965 ** GLR parsing
3966   The declaration
3967      %glr-parser
3968   causes Bison to produce a Generalized LR (GLR) parser, capable of handling
3969   almost any context-free grammar, ambiguous or not.  The new declarations
3970   %dprec and %merge on grammar rules allow parse-time resolution of
3971   ambiguities.  Contributed by Paul Hilfinger.
3973   Unfortunately Bison 1.50 does not work properly on 64-bit hosts
3974   like the Alpha, so please stick to 32-bit hosts for now.
3976 ** Output Directory
3977   When not in Yacc compatibility mode, when the output file was not
3978   specified, running "bison foo/bar.y" created "foo/bar.c".  It
3979   now creates "bar.c".
3981 ** Undefined token
3982   The undefined token was systematically mapped to 2 which prevented
3983   the use of 2 by the user.  This is no longer the case.
3985 ** Unknown token numbers
3986   If yylex returned an out of range value, yyparse could die.  This is
3987   no longer the case.
3989 ** Error token
3990   According to POSIX, the error token must be 256.
3991   Bison extends this requirement by making it a preference: *if* the
3992   user specified that one of her tokens is numbered 256, then error
3993   will be mapped onto another number.
3995 ** Verbose error messages
3996   They no longer report "..., expecting error or..." for states where
3997   error recovery is possible.
3999 ** End token
4000   Defaults to "$end" instead of "$".
4002 ** Error recovery now conforms to documentation and to POSIX
4003   When a Bison-generated parser encounters a syntax error, it now pops
4004   the stack until it finds a state that allows shifting the error
4005   token.  Formerly, it popped the stack until it found a state that
4006   allowed some non-error action other than a default reduction on the
4007   error token.  The new behavior has long been the documented behavior,
4008   and has long been required by POSIX.  For more details, please see
4009   Paul Eggert, "Reductions during Bison error handling" (2002-05-20)
4010   <http://lists.gnu.org/archive/html/bug-bison/2002-05/msg00038.html>.
4012 ** Traces
4013   Popped tokens and nonterminals are now reported.
4015 ** Larger grammars
4016   Larger grammars are now supported (larger token numbers, larger grammar
4017   size (= sum of the LHS and RHS lengths), larger LALR tables).
4018   Formerly, many of these numbers ran afoul of 16-bit limits;
4019   now these limits are 32 bits on most hosts.
4021 ** Explicit initial rule
4022   Bison used to play hacks with the initial rule, which the user does
4023   not write.  It is now explicit, and visible in the reports and
4024   graphs as rule 0.
4026 ** Useless rules
4027   Before, Bison reported the useless rules, but, although not used,
4028   included them in the parsers.  They are now actually removed.
4030 ** Useless rules, useless nonterminals
4031   They are now reported, as a warning, with their locations.
4033 ** Rules never reduced
4034   Rules that can never be reduced because of conflicts are now
4035   reported.
4037 ** Incorrect "Token not used"
4038   On a grammar such as
4040     %token useless useful
4041     %%
4042     exp: '0' %prec useful;
4044   where a token was used to set the precedence of the last rule,
4045   bison reported both "useful" and "useless" as useless tokens.
4047 ** Revert the C++ namespace changes introduced in 1.31
4048   as they caused too many portability hassles.
4050 ** Default locations
4051   By an accident of design, the default computation of @$ was
4052   performed after another default computation was performed: @$ = @1.
4053   The latter is now removed: YYLLOC_DEFAULT is fully responsible of
4054   the computation of @$.
4056 ** Token end-of-file
4057   The token end of file may be specified by the user, in which case,
4058   the user symbol is used in the reports, the graphs, and the verbose
4059   error messages instead of "$end", which remains being the default.
4060   For instance
4061     %token MYEOF 0
4062   or
4063     %token MYEOF 0 "end of file"
4065 ** Semantic parser
4066   This old option, which has been broken for ages, is removed.
4068 ** New translations
4069   Brazilian Portuguese, thanks to Alexandre Folle de Menezes.
4070   Croatian, thanks to Denis Lackovic.
4072 ** Incorrect token definitions
4073   When given
4074     %token 'a' "A"
4075   bison used to output
4076     #define 'a' 65
4078 ** Token definitions as enums
4079   Tokens are output both as the traditional #define's, and, provided
4080   the compiler supports ANSI C or is a C++ compiler, as enums.
4081   This lets debuggers display names instead of integers.
4083 ** Reports
4084   In addition to --verbose, bison supports --report=THINGS, which
4085   produces additional information:
4086   - itemset
4087     complete the core item sets with their closure
4088   - lookahead [changed to "look-ahead" in 1.875e through 2.3, but changed back]
4089     explicitly associate lookahead tokens to items
4090   - solved
4091     describe shift/reduce conflicts solving.
4092     Bison used to systematically output this information on top of
4093     the report.  Solved conflicts are now attached to their states.
4095 ** Type clashes
4096   Previous versions don't complain when there is a type clash on
4097   the default action if the rule has a midrule action, such as in:
4099     %type <foo> bar
4100     %%
4101     bar: '0' {} '0';
4103   This is fixed.
4105 ** GNU M4 is now required when using Bison.
4108 * Noteworthy changes in release 1.35 (2002-03-25)
4110 ** C Skeleton
4111   Some projects use Bison's C parser with C++ compilers, and define
4112   YYSTYPE as a class.  The recent adjustment of C parsers for data
4113   alignment and 64 bit architectures made this impossible.
4115   Because for the time being no real solution for C++ parser
4116   generation exists, kludges were implemented in the parser to
4117   maintain this use.  In the future, when Bison has C++ parsers, this
4118   kludge will be disabled.
4120   This kludge also addresses some C++ problems when the stack was
4121   extended.
4124 * Noteworthy changes in release 1.34 (2002-03-12)
4126 ** File name clashes are detected
4127   $ bison foo.y -d -o foo.x
4128   fatal error: header and parser would both be named "foo.x"
4130 ** A missing ";" at the end of a rule triggers a warning
4131   In accordance with POSIX, and in agreement with other
4132   Yacc implementations, Bison will mandate this semicolon in the near
4133   future.  This eases the implementation of a Bison parser of Bison
4134   grammars by making this grammar LALR(1) instead of LR(2).  To
4135   facilitate the transition, this release introduces a warning.
4137 ** Revert the C++ namespace changes introduced in 1.31, as they caused too
4138   many portability hassles.
4140 ** DJGPP support added.
4142 ** Fix test suite portability problems.
4145 * Noteworthy changes in release 1.33 (2002-02-07)
4147 ** Fix C++ issues
4148   Groff could not be compiled for the definition of size_t was lacking
4149   under some conditions.
4151 ** Catch invalid @n
4152   As is done with $n.
4155 * Noteworthy changes in release 1.32 (2002-01-23)
4157 ** Fix Yacc output file names
4159 ** Portability fixes
4161 ** Italian, Dutch translations
4164 * Noteworthy changes in release 1.31 (2002-01-14)
4166 ** Many Bug Fixes
4168 ** GNU Gettext and %expect
4169   GNU Gettext asserts 10 s/r conflicts, but there are 7.  Now that
4170   Bison dies on incorrect %expectations, we fear there will be
4171   too many bug reports for Gettext, so _for the time being_, %expect
4172   does not trigger an error when the input file is named "plural.y".
4174 ** Use of alloca in parsers
4175   If YYSTACK_USE_ALLOCA is defined to 0, then the parsers will use
4176   malloc exclusively.  Since 1.29, but was not NEWS'ed.
4178   alloca is used only when compiled with GCC, to avoid portability
4179   problems as on AIX.
4181 ** yyparse now returns 2 if memory is exhausted; formerly it dumped core.
4183 ** When the generated parser lacks debugging code, YYDEBUG is now 0
4184   (as POSIX requires) instead of being undefined.
4186 ** User Actions
4187   Bison has always permitted actions such as { $$ = $1 }: it adds the
4188   ending semicolon.  Now if in Yacc compatibility mode, the semicolon
4189   is no longer output: one has to write { $$ = $1; }.
4191 ** Better C++ compliance
4192   The output parsers try to respect C++ namespaces.
4193   [This turned out to be a failed experiment, and it was reverted later.]
4195 ** Reduced Grammars
4196   Fixed bugs when reporting useless nonterminals.
4198 ** 64 bit hosts
4199   The parsers work properly on 64 bit hosts.
4201 ** Error messages
4202   Some calls to strerror resulted in scrambled or missing error messages.
4204 ** %expect
4205   When the number of shift/reduce conflicts is correct, don't issue
4206   any warning.
4208 ** The verbose report includes the rule line numbers.
4210 ** Rule line numbers are fixed in traces.
4212 ** Swedish translation
4214 ** Parse errors
4215   Verbose parse error messages from the parsers are better looking.
4216   Before: parse error: unexpected `'/'', expecting `"number"' or `'-'' or `'(''
4217      Now: parse error: unexpected '/', expecting "number" or '-' or '('
4219 ** Fixed parser memory leaks.
4220   When the generated parser was using malloc to extend its stacks, the
4221   previous allocations were not freed.
4223 ** Fixed verbose output file.
4224   Some newlines were missing.
4225   Some conflicts in state descriptions were missing.
4227 ** Fixed conflict report.
4228   Option -v was needed to get the result.
4230 ** %expect
4231   Was not used.
4232   Mismatches are errors, not warnings.
4234 ** Fixed incorrect processing of some invalid input.
4236 ** Fixed CPP guards: 9foo.h uses BISON_9FOO_H instead of 9FOO_H.
4238 ** Fixed some typos in the documentation.
4240 ** %token MY_EOF 0 is supported.
4241   Before, MY_EOF was silently renumbered as 257.
4243 ** doc/refcard.tex is updated.
4245 ** %output, %file-prefix, %name-prefix.
4246   New.
4248 ** --output
4249   New, aliasing "--output-file".
4252 * Noteworthy changes in release 1.30 (2001-10-26)
4254 ** "--defines" and "--graph" have now an optional argument which is the
4255   output file name. "-d" and "-g" do not change; they do not take any
4256   argument.
4258 ** "%source_extension" and "%header_extension" are removed, failed
4259   experiment.
4261 ** Portability fixes.
4264 * Noteworthy changes in release 1.29 (2001-09-07)
4266 ** The output file does not define const, as this caused problems when used
4267   with common autoconfiguration schemes.  If you still use ancient compilers
4268   that lack const, compile with the equivalent of the C compiler option
4269   "-Dconst=".  Autoconf's AC_C_CONST macro provides one way to do this.
4271 ** Added "-g" and "--graph".
4273 ** The Bison manual is now distributed under the terms of the GNU FDL.
4275 ** The input and the output files has automatically a similar extension.
4277 ** Russian translation added.
4279 ** NLS support updated; should hopefully be less troublesome.
4281 ** Added the old Bison reference card.
4283 ** Added "--locations" and "%locations".
4285 ** Added "-S" and "--skeleton".
4287 ** "%raw", "-r", "--raw" is disabled.
4289 ** Special characters are escaped when output.  This solves the problems
4290   of the #line lines with path names including backslashes.
4292 ** New directives.
4293   "%yacc", "%fixed_output_files", "%defines", "%no_parser", "%verbose",
4294   "%debug", "%source_extension" and "%header_extension".
4296 ** @$
4297   Automatic location tracking.
4300 * Noteworthy changes in release 1.28 (1999-07-06)
4302 ** Should compile better now with K&R compilers.
4304 ** Added NLS.
4306 ** Fixed a problem with escaping the double quote character.
4308 ** There is now a FAQ.
4311 * Noteworthy changes in release 1.27
4313 ** The make rule which prevented bison.simple from being created on
4314   some systems has been fixed.
4317 * Noteworthy changes in release 1.26
4319 ** Bison now uses Automake.
4321 ** New mailing lists: <bug-bison@gnu.org> and <help-bison@gnu.org>.
4323 ** Token numbers now start at 257 as previously documented, not 258.
4325 ** Bison honors the TMPDIR environment variable.
4327 ** A couple of buffer overruns have been fixed.
4329 ** Problems when closing files should now be reported.
4331 ** Generated parsers should now work even on operating systems which do
4332   not provide alloca().
4335 * Noteworthy changes in release 1.25 (1995-10-16)
4337 ** Errors in the input grammar are not fatal; Bison keeps reading
4338 the grammar file, and reports all the errors found in it.
4340 ** Tokens can now be specified as multiple-character strings: for
4341 example, you could use "<=" for a token which looks like <=, instead
4342 of choosing a name like LESSEQ.
4344 ** The %token_table declaration says to write a table of tokens (names
4345 and numbers) into the parser file.  The yylex function can use this
4346 table to recognize multiple-character string tokens, or for other
4347 purposes.
4349 ** The %no_lines declaration says not to generate any #line preprocessor
4350 directives in the parser file.
4352 ** The %raw declaration says to use internal Bison token numbers, not
4353 Yacc-compatible token numbers, when token names are defined as macros.
4355 ** The --no-parser option produces the parser tables without including
4356 the parser engine; a project can now use its own parser engine.
4357 The actions go into a separate file called NAME.act, in the form of
4358 a switch statement body.
4361 * Noteworthy changes in release 1.23
4363 The user can define YYPARSE_PARAM as the name of an argument to be
4364 passed into yyparse.  The argument should have type void *.  It should
4365 actually point to an object.  Grammar actions can access the variable
4366 by casting it to the proper pointer type.
4368 Line numbers in output file corrected.
4371 * Noteworthy changes in release 1.22
4373 --help option added.
4376 * Noteworthy changes in release 1.20
4378 Output file does not redefine const for C++.
4380 -----
4382 LocalWords:  yacc YYBACKUP glr GCC lalr ArrayIndexOutOfBoundsException nullptr
4383 LocalWords:  cplusplus liby rpl fprintf mfcalc Wyacc stmt cond expr mk sym lr
4384 LocalWords:  IELR ielr Lookahead YYERROR nonassoc LALR's api lookaheads yychar
4385 LocalWords:  destructor lookahead YYRHSLOC YYLLOC Rhs ifndef YYFAIL cpp sr rr
4386 LocalWords:  preprocessor initializer Wno Wnone Werror FreeBSD prec livelocks
4387 LocalWords:  Solaris AIX UX RHEL Tru LHS gcc's Wundef YYENABLE NLS YYLTYPE VCG
4388 LocalWords:  yyerror cpp's Wunused yylval yylloc prepend yyparse yylex yypush
4389 LocalWords:  Graphviz xml nonterminals midrule destructor's YYSTYPE typedef ly
4390 LocalWords:  CHR chr printf stdout namespace preprocessing enum pre include's
4391 LocalWords:  YYRECOVERING nonfree destructors YYABORT YYACCEPT params enums de
4392 LocalWords:  struct yystype DJGPP lex param Haible NUM alloca YYSTACK NUL goto
4393 LocalWords:  YYMAXDEPTH Unescaped UCNs YYLTYPE's yyltype typedefs inline Yaccs
4394 LocalWords:  Heriyanto Reenable dprec Hilfinger Eggert MYEOF Folle Menezes EOF
4395 LocalWords:  Lackovic define's itemset Groff Gettext malloc NEWS'ed YYDEBUG YY
4396 LocalWords:  namespaces strerror const autoconfiguration Dconst Autoconf's FDL
4397 LocalWords:  Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
4398 LocalWords:  extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
4399 LocalWords:  lang yyoutput dvi html ps POSIX lvalp llocp Wother nterm arg init
4400 LocalWords:  TOK calc yyo fval Wconflicts parsers yystackp yyval yynerrs
4401 LocalWords:  Théophile Ranquet Santet fno fnone stype associativity Tolmer
4402 LocalWords:  Wprecedence Rassoul Wempty Paolo Bonzini parser's Michiel loc
4403 LocalWords:  redeclaration sval fcaret reentrant XSLT xsl Wmaybe yyvsp Tedi
4404 LocalWords:  pragmas noreturn untyped Rozenman unexpanded Wojciech Polak
4405 LocalWords:  Alexandre MERCHANTABILITY yytype emplace ptr automove lvalues
4406 LocalWords:  nonterminal yy args Pragma dereference yyformat rhs docdir bw
4407 LocalWords:  Redeclarations rpcalc Autoconf YFLAGS Makefiles PROG DECL num
4408 LocalWords:  Heimbigner AST src ast Makefile srcdir MinGW xxlex XXSTYPE
4409 LocalWords:  XXLTYPE strictfp IDEs ffixit fdiagnostics parseable fixits
4410 LocalWords:  Wdeprecated yytext Variadic variadic yyrhs yyphrs RCS README
4411 LocalWords:  noexcept constexpr ispell american deprecations backend Teoh
4412 LocalWords:  YYPRINT Mangold Bonzini's Wdangling exVal baz checkable gcc
4413 LocalWords:  fsanitize Vogelsgesang lis redeclared stdint automata yytname
4414 LocalWords:  yysymbol yytnamerr yyreport ctx ARGMAX yysyntax stderr LPAREN
4415 LocalWords:  symrec yypcontext TOKENMAX yyexpected YYEMPTY yypstate YYEOF
4416 LocalWords:  autocompletion bistromathic submessages Cayuela lexcalc hoc
4417 LocalWords:  yytoken YYUNDEF YYerror basename Automake's UTF ifdef ffile
4418 LocalWords:  gotos readline Imbimbo Wcounterexamples
4420 Local Variables:
4421 ispell-dictionary: "american"
4422 mode: outline
4423 fill-column: 76
4424 End:
4426 Copyright (C) 1995-2015, 2018-2020 Free Software Foundation, Inc.
4428 This file is part of Bison, the GNU Parser Generator.
4430 Permission is granted to copy, distribute and/or modify this document
4431 under the terms of the GNU Free Documentation License, Version 1.3 or
4432 any later version published by the Free Software Foundation; with no
4433 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
4434 Texts.  A copy of the license is included in the "GNU Free
4435 Documentation License" file as part of this distribution.