doc: factor ifnottex/iftex examples
[bison.git] / NEWS
blobe388c519b439314ede8de1669061365b8abc8463
1 GNU Bison NEWS
3 * Noteworthy changes in release ?.? (????-??-??) [?]
6 * Noteworthy changes in release 3.7 (2020-07-23) [stable]
8 ** Deprecated features
10   The YYPRINT macro, which works only with yacc.c and only for tokens, was
11   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
12   It is deprecated and its support will be removed eventually.
14   In conformance with the recommendations of the Graphviz team, in the next
15   version Bison the option `--graph` will generate a *.gv file by default,
16   instead of *.dot.  A transition started in Bison 3.4.
18 ** New features
20 *** Counterexample Generation
22   Contributed by Vincent Imbimbo.
24   When given `-Wcounterexamples`/`-Wcex`, bison will now output
25   counterexamples for conflicts.
27 **** Unifying Counterexamples
29   Unifying counterexamples are strings which can be parsed in two ways due
30   to the conflict.  For example on a grammar that contains the usual
31   "dangling else" ambiguity:
33     $ bison else.y
34     else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
35     else.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
37     $ bison else.y -Wcex
38     else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
39     else.y: warning: shift/reduce conflict on token "else" [-Wcounterexamples]
40       Example: "if" exp "then" "if" exp "then" exp • "else" exp
41       Shift derivation
42         exp
43         ↳ "if" exp "then" exp
44                           ↳ "if" exp "then" exp • "else" exp
45       Example: "if" exp "then" "if" exp "then" exp • "else" exp
46       Reduce derivation
47         exp
48         ↳ "if" exp "then" exp                     "else" exp
49                           ↳ "if" exp "then" exp •
51   When text styling is enabled, colors are used in the examples and the
52   derivations to highlight the structure of both analyses.  In this case,
54     "if" exp "then" [ "if" exp "then" exp • ] "else" exp
56   vs.
58     "if" exp "then" [ "if" exp "then" exp • "else" exp ]
61   The counterexamples are "focused", in two different ways.  First, they do
62   not clutter the output with all the derivations from the start symbol,
63   rather they start on the "conflicted nonterminal". They go straight to the
64   point.  Second, they don't "expand" nonterminal symbols uselessly.
66 **** Nonunifying Counterexamples
68   In the case of the dangling else, Bison found an example that can be
69   parsed in two ways (therefore proving that the grammar is ambiguous).
70   When it cannot find such an example, it instead generates two examples
71   that are the same up until the dot:
73     $ bison foo.y
74     foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
75     foo.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
76     foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
77         4 | a: expr
78           |    ^~~~
80     $ bison -Wcex foo.y
81     foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
82     foo.y: warning: shift/reduce conflict on token ID [-Wcounterexamples]
83       First example: expr • ID ',' ID $end
84       Shift derivation
85         $accept
86         ↳ s                      $end
87           ↳ a                 ID
88             ↳ expr
89               ↳ expr • ID ','
90       Second example: expr • ID $end
91       Reduce derivation
92         $accept
93         ↳ s             $end
94           ↳ a        ID
95             ↳ expr •
96     foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
97         4 | a: expr
98           |    ^~~~
100   In these cases, the parser usually doesn't have enough lookahead to
101   differentiate the two given examples.
103 **** Reports
105   Counterexamples are also included in the report when given
106   `--report=counterexamples`/`-rcex` (or `--report=all`), with more
107   technical details:
109     State 7
111       1 exp: "if" exp "then" exp •  [$end, "then", "else"]
112       2    | "if" exp "then" exp • "else" exp
114       "else"  shift, and go to state 8
116       "else"    [reduce using rule 1 (exp)]
117       $default  reduce using rule 1 (exp)
119       shift/reduce conflict on token "else":
120           1 exp: "if" exp "then" exp •
121           2 exp: "if" exp "then" exp • "else" exp
122         Example: "if" exp "then" "if" exp "then" exp • "else" exp
123         Shift derivation
124           exp
125           ↳ "if" exp "then" exp
126                             ↳ "if" exp "then" exp • "else" exp
127         Example: "if" exp "then" "if" exp "then" exp • "else" exp
128         Reduce derivation
129           exp
130           ↳ "if" exp "then" exp                     "else" exp
131                             ↳ "if" exp "then" exp •
133 *** File prefix mapping
135   Contributed by Joshua Watt.
137   Bison learned a new argument, `--file-prefix-map OLD=NEW`.  Any file path
138   in the output (specifically `#line` directives and `#ifdef` header guards)
139   that begins with the prefix OLD will have it replaced with the prefix NEW,
140   similar to the `-ffile-prefix-map` in GCC.  This option can be used to
141   make bison output reproducible.
143 ** Changes
145 *** Diagnostics
147   When text styling is enabled and the terminal supports it, the warnings
148   now include hyperlinks to the documentation.
150 *** Relocatable installation
152   When installed to be relocatable (via `configure --enable-relocatable`),
153   bison will now also look for a relocated m4.
155 *** C++ file names
157   The `filename_type` %define variable was renamed `api.filename.type`.
158   Instead of
160     %define filename_type "symbol"
162   write
164     %define api.filename.type {symbol}
166   (Or let `bison --update` do it for you).
168   It now defaults to `const std::string` instead of `std::string`.
170 *** Deprecated %define variable names
172   The following variables have been renamed for consistency.  Backward
173   compatibility is ensured, but upgrading is recommended.
175     filename_type       -> api.filename.type
176     package             -> api.package
178 *** Push parsers no longer clear their state when parsing is finished
180   Previously push-parsers cleared their state when parsing was finished (on
181   success and on failure).  This made it impossible to check if there were
182   parse errors, since `yynerrs` was also reset.  This can be especially
183   troublesome when used in autocompletion, since a parser with error
184   recovery would suggest (irrelevant) expected tokens even if there were
185   failure.
187   Now the parser state can be examined when parsing is finished.  The parser
188   state is reset when starting a new parse.
190 ** Documentation
192 *** Examples
194   The bistromathic demonstrates %param and how to quote sources in the error
195   messages:
197     > 123 456
198     1.5-7: syntax error: expected end of file or + or - or * or / or ^ before number
199         1 | 123 456
200           |     ^~~
202 ** Bug fixes
204 *** Include the generated header (yacc.c)
206   Historically, when --defines was used, bison generated a header and pasted
207   an exact copy of it into the generated parser implementation file.  Since
208   Bison 3.4 it is possible to specify that the header should be `#include`d,
209   and how.  For instance
211     %define api.header.include {"parse.h"}
213   or
215     %define api.header.include {<parser/parse.h>}
217   Now api.header.include defaults to `"header-basename"`, as was intended in
218   Bison 3.4, where `header-basename` is the basename of the generated
219   header.  This is disabled when the generated header is `y.tab.h`, to
220   comply with Automake's ylwrap.
222 *** String aliases are faithfully propagated
224   Bison used to interpret user strings (i.e., decoding backslash escapes)
225   when reading them, and to escape them (i.e., issue non-printable
226   characters as backslash escapes, taking the locale into account) when
227   outputting them.  As a consequence non-ASCII strings (say in UTF-8) ended
228   up "ciphered" as sequences of backslash escapes.  This happened not only
229   in the generated sources (where the compiler will reinterpret them), but
230   also in all the generated reports (text, xml, html, dot, etc.).  Reports
231   were therefore not readable when string aliases were not pure ASCII.
232   Worse yet: the output depended on the user's locale.
234   Now Bison faithfully treats the string aliases exactly the way the user
235   spelled them.  This fixes all the aforementioned problems.  However, now,
236   string aliases semantically equivalent but syntactically different (e.g.,
237   "A", "\x41", "\101") are considered to be different.
239 *** Crash when generating IELR
241   An old, well hidden, bug in the generation of IELR parsers was fixed.
244 * Noteworthy changes in release 3.6.4 (2020-06-15) [stable]
246 ** Bug fixes
248   In glr.cc some internal macros leaked in the user's code, and could damage
249   access to the token kinds.
252 * Noteworthy changes in release 3.6.3 (2020-06-03) [stable]
254 ** Bug fixes
256   Incorrect comments in the generated parsers.
258   Warnings in push parsers (yacc.c).
260   Incorrect display of gotos in LAC traces (lalr1.cc).
263 * Noteworthy changes in release 3.6.2 (2020-05-17) [stable]
265 ** Bug fixes
267   Some tests were fixed.
269   When token aliases contain comment delimiters:
271     %token FOO "/* foo */"
273   bison used to emit "nested" comments, which is invalid C.
276 * Noteworthy changes in release 3.6.1 (2020-05-10) [stable]
278 ** Bug fixes
280   Restored ANSI-C compliance in yacc.c.
282   GNU readline portability issues.
284   In C++, yy::parser::symbol_name is now a public member, as was intended.
286 ** New features
288   In C++, yy::parser::symbol_type now has a public name() member function.
291 * Noteworthy changes in release 3.6 (2020-05-08) [stable]
293 ** Backward incompatible changes
295   TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose".
297   The YYERROR_VERBOSE macro is no longer supported; the parsers that still
298   depend on it will now produce Yacc-like error messages (just "syntax
299   error").  It was superseded by the "%error-verbose" directive in Bison
300   1.875 (2003-01-01).  Bison 2.6 (2012-07-19) clearly announced that support
301   for YYERROR_VERBOSE would be removed.  Note that since Bison 3.0
302   (2013-07-25), "%error-verbose" is deprecated in favor of "%define
303   parse.error verbose".
305 ** Deprecated features
307   The YYPRINT macro, which works only with yacc.c and only for tokens, was
308   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
309   It is deprecated and its support will be removed eventually.
311 ** New features
313 *** Improved syntax error messages
315   Two new values for the %define parse.error variable offer more control to
316   the user.  Available in all the skeletons (C, C++, Java).
318 **** %define parse.error detailed
320   The behavior of "%define parse.error detailed" is closely resembling that
321   of "%define parse.error verbose" with a few exceptions.  First, it is safe
322   to use non-ASCII characters in token aliases (with 'verbose', the result
323   depends on the locale with which bison was run).  Second, a yysymbol_name
324   function is exposed to the user, instead of the yytnamerr function and the
325   yytname table.  Third, token internationalization is supported (see
326   below).
328 **** %define parse.error custom
330   With this directive, the user forges and emits the syntax error message
331   herself by defining the yyreport_syntax_error function.  A new type,
332   yypcontext_t, captures the circumstances of the error, and provides the
333   user with functions to get details, such as yypcontext_expected_tokens to
334   get the list of expected token kinds.
336   A possible implementation of yyreport_syntax_error is:
338     int
339     yyreport_syntax_error (const yypcontext_t *ctx)
340     {
341       int res = 0;
342       YY_LOCATION_PRINT (stderr, *yypcontext_location (ctx));
343       fprintf (stderr, ": syntax error");
344       // Report the tokens expected at this point.
345       {
346         enum { TOKENMAX = 10 };
347         yysymbol_kind_t expected[TOKENMAX];
348         int n = yypcontext_expected_tokens (ctx, expected, TOKENMAX);
349         if (n < 0)
350           // Forward errors to yyparse.
351           res = n;
352         else
353           for (int i = 0; i < n; ++i)
354             fprintf (stderr, "%s %s",
355                      i == 0 ? ": expected" : " or", yysymbol_name (expected[i]));
356       }
357       // Report the unexpected token.
358       {
359         yysymbol_kind_t lookahead = yypcontext_token (ctx);
360         if (lookahead != YYSYMBOL_YYEMPTY)
361           fprintf (stderr, " before %s", yysymbol_name (lookahead));
362       }
363       fprintf (stderr, "\n");
364       return res;
365     }
367 **** Token aliases internationalization
369   When the %define variable parse.error is set to `custom` or `detailed`,
370   one may specify which token aliases are to be translated using _().  For
371   instance
373     %token
374         PLUS   "+"
375         MINUS  "-"
376       <double>
377         NUM _("number")
378       <symrec*>
379         FUN _("function")
380         VAR _("variable")
382   In that case the user must define _() and N_(), and yysymbol_name returns
383   the translated symbol (i.e., it returns '_("variable")' rather that
384   '"variable"').  In Java, the user must provide an i18n() function.
386 *** List of expected tokens (yacc.c)
388   Push parsers may invoke yypstate_expected_tokens at any point during
389   parsing (including even before submitting the first token) to get the list
390   of possible tokens.  This feature can be used to propose autocompletion
391   (see below the "bistromathic" example).
393   It makes little sense to use this feature without enabling LAC (lookahead
394   correction).
396 *** Returning the error token
398   When the scanner returns an invalid token or the undefined token
399   (YYUNDEF), the parser generates an error message and enters error
400   recovery.  Because of that error message, most scanners that find lexical
401   errors generate an error message, and then ignore the invalid input
402   without entering the error-recovery.
404   The scanners may now return YYerror, the error token, to enter the
405   error-recovery mode without triggering an additional error message.  See
406   the bistromathic for an example.
408 *** Deep overhaul of the symbol and token kinds
410   To avoid the confusion with types in programming languages, we now refer
411   to token and symbol "kinds" instead of token and symbol "types".  The
412   documentation and error messages have been revised.
414   All the skeletons have been updated to use dedicated enum types rather
415   than integral types.  Special symbols are now regular citizens, instead of
416   being declared in ad hoc ways.
418 **** Token kinds
420   The "token kind" is what is returned by the scanner, e.g., PLUS, NUMBER,
421   LPAREN, etc.  While backward compatibility is of course ensured, users are
422   nonetheless invited to replace their uses of "enum yytokentype" by
423   "yytoken_kind_t".
425   This type now also includes tokens that were previously hidden: YYEOF (end
426   of input), YYUNDEF (undefined token), and YYerror (error token).  They
427   now have string aliases, internationalized when internationalization is
428   enabled.  Therefore, by default, error messages now refer to "end of file"
429   (internationalized) rather than the cryptic "$end", or to "invalid token"
430   rather than "$undefined".
432   Therefore in most cases it is now useless to define the end-of-line token
433   as follows:
435     %token T_EOF 0 "end of file"
437   Rather simply use "YYEOF" in your scanner.
439 **** Symbol kinds
441   The "symbol kinds" is what the parser actually uses.  (Unless the
442   api.token.raw %define variable is used, the symbol kind of a terminal
443   differs from the corresponding token kind.)
445   They are now exposed as a enum, "yysymbol_kind_t".
447   This allows users to tailor the error messages the way they want, or to
448   process some symbols in a specific way in autocompletion (see the
449   bistromathic example below).
451 *** Modernize display of explanatory statements in diagnostics
453   Since Bison 2.7, output was indented four spaces for explanatory
454   statements.  For example:
456     input.y:2.7-13: error: %type redeclaration for exp
457     input.y:1.7-11:     previous declaration
459   Since the introduction of caret-diagnostics, it became less clear.  This
460   indentation has been removed and submessages are displayed similarly as in
461   GCC:
463     input.y:2.7-13: error: %type redeclaration for exp
464         2 | %type <float> exp
465           |       ^~~~~~~
466     input.y:1.7-11: note: previous declaration
467         1 | %type <int> exp
468           |       ^~~~~
470   Contributed by Victor Morales Cayuela.
472 *** C++
474   The token and symbol kinds are yy::parser::token_kind_type and
475   yy::parser::symbol_kind_type.
477   The symbol_type::kind() member function allows to get the kind of a
478   symbol.  This can be used to write unit tests for scanners, e.g.,
480     yy::parser::symbol_type t = make_NUMBER ("123");
481     assert (t.kind () == yy::parser::symbol_kind::S_NUMBER);
482     assert (t.value.as<int> () == 123);
484 ** Documentation
486 *** User Manual
488   In order to avoid ambiguities with "type" as in "typing", we now refer to
489   the "token kind" (e.g., `PLUS`, `NUMBER`, etc.) rather than the "token
490   type".  We now also refer to the "symbol type" (e.g., `PLUS`, `expr`,
491   etc.).
493 *** Examples
495   There are now examples/java: a very simple calculator, and a more complete
496   one (push-parser, location tracking, and debug traces).
498   The lexcalc example (a simple example in C based on Flex and Bison) now
499   also demonstrates location tracking.
502   A new C example, bistromathic, is a fully featured interactive calculator
503   using many Bison features: pure interface, push parser, autocompletion
504   based on the current parser state (using yypstate_expected_tokens),
505   location tracking, internationalized custom error messages, lookahead
506   correction, rich debug traces, etc.
508   It shows how to depend on the symbol kinds to tailor autocompletion.  For
509   instance it recognizes the symbol kind "VARIABLE" to propose
510   autocompletion on the existing variables, rather than of the word
511   "variable".
514 * Noteworthy changes in release 3.5.4 (2020-04-05) [stable]
516 ** WARNING: Future backward-incompatibilities!
518   TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose".
520   Bison 3.6 will no longer support the YYERROR_VERBOSE macro; the parsers
521   that still depend on it will produce Yacc-like error messages (just
522   "syntax error").  It was superseded by the "%error-verbose" directive in
523   Bison 1.875 (2003-01-01).  Bison 2.6 (2012-07-19) clearly announced that
524   support for YYERROR_VERBOSE would be removed.  Note that since Bison 3.0
525   (2013-07-25), "%error-verbose" is deprecated in favor of "%define
526   parse.error verbose".
528 ** Bug fixes
530   Fix portability issues of the package itself on old compilers.
532   Fix api.token.raw support in Java.
535 * Noteworthy changes in release 3.5.3 (2020-03-08) [stable]
537 ** Bug fixes
539   Error messages could quote lines containing zero-width characters (such as
540   \005) with incorrect styling.  Fixes for similar issues with unexpectedly
541   short lines (e.g., the file was changed between parsing and diagnosing).
543   Several unlikely crashes found by fuzzing have been fixed.
546 * Noteworthy changes in release 3.5.2 (2020-02-13) [stable]
548 ** Bug fixes
550   Portability issues and minor cosmetic issues.
552   The lalr1.cc skeleton properly rejects unsupported values for parse.lac
553   (as yacc.c does).
556 * Noteworthy changes in release 3.5.1 (2020-01-19) [stable]
558 ** Bug fixes
560   Portability fixes.
562   Fix compiler warnings.
565 * Noteworthy changes in release 3.5 (2019-12-11) [stable]
567 ** Backward incompatible changes
569   Lone carriage-return characters (aka \r or ^M) in the grammar files are no
570   longer treated as end-of-lines.  This changes the diagnostics, and in
571   particular their locations.
573   In C++, line numbers and columns are now represented as 'int' not
574   'unsigned', so that integer overflow on positions is easily checkable via
575   'gcc -fsanitize=undefined' and the like.  This affects the API for
576   positions.  The default position and location classes now expose
577   'counter_type' (int), used to define line and column numbers.
579 ** Deprecated features
581   The YYPRINT macro, which works only with yacc.c and only for tokens, was
582   obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
583   It is deprecated and its support will be removed eventually.
585 ** New features
587 *** Lookahead correction in C++
589   Contributed by Adrian Vogelsgesang.
591   The C++ deterministic skeleton (lalr1.cc) now supports LAC, via the
592   %define variable parse.lac.
594 *** Variable api.token.raw: Optimized token numbers (all skeletons)
596   In the generated parsers, tokens have two numbers: the "external" token
597   number as returned by yylex (which starts at 257), and the "internal"
598   symbol number (which starts at 3).  Each time yylex is called, a table
599   lookup maps the external token number to the internal symbol number.
601   When the %define variable api.token.raw is set, tokens are assigned their
602   internal number, which saves one table lookup per token, and also saves
603   the generation of the mapping table.
605   The gain is typically moderate, but in extreme cases (very simple user
606   actions), a 10% improvement can be observed.
608 *** Generated parsers use better types for states
610   Stacks now use the best integral type for state numbers, instead of always
611   using 15 bits.  As a result "small" parsers now have a smaller memory
612   footprint (they use 8 bits), and there is support for large automata (16
613   bits), and extra large (using int, i.e., typically 31 bits).
615 *** Generated parsers prefer signed integer types
617   Bison skeletons now prefer signed to unsigned integer types when either
618   will do, as the signed types are less error-prone and allow for better
619   checking with 'gcc -fsanitize=undefined'.  Also, the types chosen are now
620   portable to unusual machines where char, short and int are all the same
621   width.  On non-GNU platforms this may entail including <limits.h> and (if
622   available) <stdint.h> to define integer types and constants.
624 *** A skeleton for the D programming language
626   For the last few releases, Bison has shipped a stealth experimental
627   skeleton: lalr1.d.  It was first contributed by Oliver Mangold, based on
628   Paolo Bonzini's lalr1.java, and was cleaned and improved thanks to
629   H. S. Teoh.
631   However, because nobody has committed to improving, testing, and
632   documenting this skeleton, it is not clear that it will be supported in
633   the future.
635   The lalr1.d skeleton *is functional*, and works well, as demonstrated in
636   examples/d/calc.d.  Please try it, enjoy it, and... commit to support it.
638 *** Debug traces in Java
640   The Java backend no longer emits code and data for parser tracing if the
641   %define variable parse.trace is not defined.
643 ** Diagnostics
645 *** New diagnostic: -Wdangling-alias
647   String literals, which allow for better error messages, are (too)
648   liberally accepted by Bison, which might result in silent errors.  For
649   instance
651     %type <exVal> cond "condition"
653   does not define "condition" as a string alias to 'cond' (nonterminal
654   symbols do not have string aliases).  It is rather equivalent to
656     %nterm <exVal> cond
657     %token <exVal> "condition"
659   i.e., it gives the type 'exVal' to the "condition" token, which was
660   clearly not the intention.
662   Also, because string aliases need not be defined, typos such as "baz"
663   instead of "bar" will be not reported.
665   The option -Wdangling-alias catches these situations.  On
667     %token BAR "bar"
668     %type <ival> foo "foo"
669     %%
670     foo: "baz" {}
672   bison -Wdangling-alias reports
674     warning: string literal not attached to a symbol
675           | %type <ival> foo "foo"
676           |                  ^~~~~
677     warning: string literal not attached to a symbol
678           | foo: "baz" {}
679           |      ^~~~~
681    The -Wall option does not (yet?) include -Wdangling-alias.
683 *** Better POSIX Yacc compatibility diagnostics
685   POSIX Yacc restricts %type to nonterminals.  This is now diagnosed by
686   -Wyacc.
688     %token TOKEN1
689     %type  <ival> TOKEN1 TOKEN2 't'
690     %token TOKEN2
691     %%
692     expr:
694   gives with -Wyacc
696     input.y:2.15-20: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
697         2 | %type  <ival> TOKEN1 TOKEN2 't'
698           |               ^~~~~~
699     input.y:2.29-31: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
700         2 | %type  <ival> TOKEN1 TOKEN2 't'
701           |                             ^~~
702     input.y:2.22-27: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
703         2 | %type  <ival> TOKEN1 TOKEN2 't'
704           |                      ^~~~~~
706 *** Diagnostics with insertion
708   The diagnostics now display the suggestion below the underlined source.
709   Replacement for undeclared symbols are now also suggested.
711     $ cat /tmp/foo.y
712     %%
713     list: lis '.' |
715     $ bison -Wall foo.y
716     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'?
717         2 | list: lis '.' |
718           |       ^~~
719           |       list
720     foo.y:2.16: warning: empty rule without %empty [-Wempty-rule]
721         2 | list: lis '.' |
722           |                ^
723           |                %empty
724     foo.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
726 *** Diagnostics about long lines
728   Quoted sources may now be truncated to fit the screen.  For instance, on a
729   30-column wide terminal:
731     $ cat foo.y
732     %token FOO                       FOO                         FOO
733     %%
734     exp: FOO
735     $ bison foo.y
736     foo.y:1.34-36: warning: symbol FOO redeclared [-Wother]
737         1 | …         FOO                  …
738           |           ^~~
739     foo.y:1.8-10:      previous declaration
740         1 | %token FOO                     …
741           |        ^~~
742     foo.y:1.62-64: warning: symbol FOO redeclared [-Wother]
743         1 | …         FOO
744           |           ^~~
745     foo.y:1.8-10:      previous declaration
746         1 | %token FOO                     …
747           |        ^~~
749 ** Changes
751 *** Debugging glr.c and glr.cc
753   The glr.c skeleton always had asserts to check its own behavior (not the
754   user's).  These assertions are now under the control of the parse.assert
755   %define variable (disabled by default).
757 *** Clean up
759   Several new compiler warnings in the generated output have been avoided.
760   Some unused features are no longer emitted.  Cleaner generated code in
761   general.
763 ** Bug Fixes
765   Portability issues in the test suite.
767   In theory, parsers using %nonassoc could crash when reporting verbose
768   error messages. This unlikely bug has been fixed.
770   In Java, %define api.prefix was ignored.  It now behaves as expected.
773 * Noteworthy changes in release 3.4.2 (2019-09-12) [stable]
775 ** Bug fixes
777   In some cases, when warnings are disabled, bison could emit tons of white
778   spaces as diagnostics.
780   When running out of memory, bison could crash (found by fuzzing).
782   When defining twice the EOF token, bison would crash.
784   New warnings from recent compilers have been addressed in the generated
785   parsers (yacc.c, glr.c, glr.cc).
787   When lone carriage-return characters appeared in the input file,
788   diagnostics could hang forever.
791 * Noteworthy changes in release 3.4.1 (2019-05-22) [stable]
793 ** Bug fixes
795   Portability fixes.
798 * Noteworthy changes in release 3.4 (2019-05-19) [stable]
800 ** Deprecated features
802   The %pure-parser directive is deprecated in favor of '%define api.pure'
803   since Bison 2.3b (2008-05-27), but no warning was issued; there is one
804   now.  Note that since Bison 2.7 you are strongly encouraged to use
805   '%define api.pure full' instead of '%define api.pure'.
807 ** New features
809 *** Colored diagnostics
811   As an experimental feature, diagnostics are now colored, controlled by the
812   new options --color and --style.
814   To use them, install the libtextstyle library before configuring Bison.
815   It is available from
817     https://alpha.gnu.org/gnu/gettext/
819   for instance
821     https://alpha.gnu.org/gnu/gettext/libtextstyle-0.8.tar.gz
823   The option --color supports the following arguments:
824     - always, yes: Enable colors.
825     - never, no: Disable colors.
826     - auto, tty (default): Enable colors if the output device is a tty.
828   To customize the styles, create a CSS file similar to
830     /* bison-bw.css */
831     .warning   { }
832     .error     { font-weight: 800; text-decoration: underline; }
833     .note      { }
835   then invoke bison with --style=bison-bw.css, or set the BISON_STYLE
836   environment variable to "bison-bw.css".
838 *** Disabling output
840   When given -fsyntax-only, the diagnostics are reported, but no output is
841   generated.
843   The name of this option is somewhat misleading as bison does more than
844   just checking the syntax: every stage is run (including checking for
845   conflicts for instance), except the generation of the output files.
847 *** Include the generated header (yacc.c)
849   Before, when --defines is used, bison generated a header, and pasted an
850   exact copy of it into the generated parser implementation file.  If the
851   header name is not "y.tab.h", it is now #included instead of being
852   duplicated.
854   To use an '#include' even if the header name is "y.tab.h" (which is what
855   happens with --yacc, or when using the Autotools' ylwrap), define
856   api.header.include to the exact argument to pass to #include.  For
857   instance:
859     %define api.header.include {"parse.h"}
861   or
863     %define api.header.include {<parser/parse.h>}
865 *** api.location.type is now supported in C (yacc.c, glr.c)
867   The %define variable api.location.type defines the name of the type to use
868   for locations.  When defined, Bison no longer defines YYLTYPE.
870   This can be used in programs with several parsers to factor their
871   definition of locations: let one of them generate them, and the others
872   just use them.
874 ** Changes
876 *** Graphviz output
878   In conformance with the recommendations of the Graphviz team, if %require
879   "3.4" (or better) is specified, the option --graph generates a *.gv file
880   by default, instead of *.dot.
882 *** Diagnostics overhaul
884   Column numbers were wrong with multibyte characters, which would also
885   result in skewed diagnostics with carets.  Beside, because we were
886   indenting the quoted source with a single space, lines with tab characters
887   were incorrectly underlined.
889   To address these issues, and to be clearer, Bison now issues diagnostics
890   as GCC9 does.  For instance it used to display (there's a tab before the
891   opening brace):
893     foo.y:3.37-38: error: $2 of ‘expr’ has no declared type
894      expr: expr '+' "number"        { $$ = $1 + $2; }
895                                          ^~
896   It now reports
898     foo.y:3.37-38: error: $2 of ‘expr’ has no declared type
899         3 | expr: expr '+' "number" { $$ = $1 + $2; }
900           |                                     ^~
902   Other constructs now also have better locations, resulting in more precise
903   diagnostics.
905 *** Fix-it hints for %empty
907   Running Bison with -Wempty-rules and --update will remove incorrect %empty
908   annotations, and add the missing ones.
910 *** Generated reports
912   The format of the reports (parse.output) was improved for readability.
914 *** Better support for --no-line.
916   When --no-line is used, the generated files are now cleaner: no lines are
917   generated instead of empty lines.  Together with using api.header.include,
918   that should help people saving the generated files into version control
919   systems get smaller diffs.
921 ** Documentation
923   A new example in C shows an simple infix calculator with a hand-written
924   scanner (examples/c/calc).
926   A new example in C shows a reentrant parser (capable of recursive calls)
927   built with Flex and Bison (examples/c/reccalc).
929   There is a new section about the history of Yaccs and Bison.
931 ** Bug fixes
933   A few obscure bugs were fixed, including the second oldest (known) bug in
934   Bison: it was there when Bison was entered in the RCS version control
935   system, in December 1987.  See the NEWS of Bison 3.3 for the previous
936   oldest bug.
939 * Noteworthy changes in release 3.3.2 (2019-02-03) [stable]
941 ** Bug fixes
943   Bison 3.3 failed to generate parsers for grammars with unused nonterminal
944   symbols.
947 * Noteworthy changes in release 3.3.1 (2019-01-27) [stable]
949 ** Changes
951   The option -y/--yacc used to imply -Werror=yacc, which turns uses of Bison
952   extensions into errors.  It now makes them simple warnings (-Wyacc).
955 * Noteworthy changes in release 3.3 (2019-01-26) [stable]
957   A new mailing list was created, Bison Announce.  It is low traffic, and is
958   only about announcing new releases and important messages (e.g., polls
959   about major decisions to make).
961   https://lists.gnu.org/mailman/listinfo/bison-announce
963 ** Backward incompatible changes
965   Support for DJGPP, which has been unmaintained and untested for years, is
966   removed.
968 ** Deprecated features
970   A new feature, --update (see below) helps adjusting existing grammars to
971   deprecations.
973 *** Deprecated directives
975   The %error-verbose directive is deprecated in favor of '%define
976   parse.error verbose' since Bison 3.0, but no warning was issued.
978   The '%name-prefix "xx"' directive is deprecated in favor of '%define
979   api.prefix {xx}' since Bison 3.0, but no warning was issued.  These
980   directives are slightly different, you might need to adjust your code.
981   %name-prefix renames only symbols with external linkage, while api.prefix
982   also renames types and macros, including YYDEBUG, YYTOKENTYPE,
983   yytokentype, YYSTYPE, YYLTYPE, etc.
985   Users of Flex that move from '%name-prefix "xx"' to '%define api.prefix
986   {xx}' will typically have to update YY_DECL from
988     #define YY_DECL int xxlex (YYSTYPE *yylval, YYLTYPE *yylloc)
990   to
992     #define YY_DECL int xxlex (XXSTYPE *yylval, XXLTYPE *yylloc)
994 *** Deprecated %define variable names
996   The following variables, mostly related to parsers in Java, have been
997   renamed for consistency.  Backward compatibility is ensured, but upgrading
998   is recommended.
1000     abstract           -> api.parser.abstract
1001     annotations        -> api.parser.annotations
1002     extends            -> api.parser.extends
1003     final              -> api.parser.final
1004     implements         -> api.parser.implements
1005     parser_class_name  -> api.parser.class
1006     public             -> api.parser.public
1007     strictfp           -> api.parser.strictfp
1009 ** New features
1011 *** Generation of fix-its for IDEs/Editors
1013   When given the new option -ffixit (aka -fdiagnostics-parseable-fixits),
1014   bison now generates machine readable editing instructions to fix some
1015   issues.  Currently, this is mostly limited to updating deprecated
1016   directives and removing duplicates.  For instance:
1018     $ cat foo.y
1019     %error-verbose
1020     %define parser_class_name "Parser"
1021     %define api.parser.class "Parser"
1022     %%
1023     exp:;
1025   See the "fix-it:" lines below:
1027     $ bison -ffixit foo.y
1028     foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated]
1029      %error-verbose
1030      ^~~~~~~~~~~~~~
1031     fix-it:"foo.y":{1:1-1:15}:"%define parse.error verbose"
1032     foo.y:2.1-34: warning: deprecated directive, use '%define api.parser.class {Parser}' [-Wdeprecated]
1033      %define parser_class_name "Parser"
1034      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1035     fix-it:"foo.y":{2:1-2:35}:"%define api.parser.class {Parser}"
1036     foo.y:3.1-33: error: %define variable 'api.parser.class' redefined
1037      %define api.parser.class "Parser"
1038      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1039     foo.y:2.1-34:     previous definition
1040      %define parser_class_name "Parser"
1041      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1042     fix-it:"foo.y":{3:1-3:34}:""
1043     foo.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
1045   This uses the same output format as GCC and Clang.
1047 *** Updating grammar files
1049   Fixes can be applied on the fly.  The previous example ends with the
1050   suggestion to re-run bison with the option -u/--update, which results in a
1051   cleaner grammar file.
1053     $ bison --update foo.y
1054     [...]
1055     bison: file 'foo.y' was updated (backup: 'foo.y~')
1057     $ cat foo.y
1058     %define parse.error verbose
1059     %define api.parser.class {Parser}
1060     %%
1061     exp:;
1063 *** Bison is now relocatable
1065   If you pass '--enable-relocatable' to 'configure', Bison is relocatable.
1067   A relocatable program can be moved or copied to a different location on
1068   the file system.  It can also be used through mount points for network
1069   sharing.  It is possible to make symbolic links to the installed and moved
1070   programs, and invoke them through the symbolic link.
1072 *** %expect and %expect-rr modifiers on individual rules
1074   One can now document (and check) which rules participate in shift/reduce
1075   and reduce/reduce conflicts.  This is particularly important GLR parsers,
1076   where conflicts are a normal occurrence.  For example,
1078       %glr-parser
1079       %expect 1
1080       %%
1082       ...
1084       argument_list:
1085         arguments %expect 1
1086       | arguments ','
1087       | %empty
1088       ;
1090       arguments:
1091         expression
1092       | argument_list ',' expression
1093       ;
1095       ...
1097   Looking at the output from -v, one can see that the shift/reduce conflict
1098   here is due to the fact that the parser does not know whether to reduce
1099   arguments to argument_list until it sees the token _after_ the following
1100   ','.  By marking the rule with %expect 1 (because there is a conflict in
1101   one state), we document the source of the 1 overall shift/reduce conflict.
1103   In GLR parsers, we can use %expect-rr in a rule for reduce/reduce
1104   conflicts.  In this case, we mark each of the conflicting rules.  For
1105   example,
1107       %glr-parser
1108       %expect-rr 1
1110       %%
1112       stmt:
1113         target_list '=' expr ';'
1114       | expr_list ';'
1115       ;
1117       target_list:
1118         target
1119       | target ',' target_list
1120       ;
1122       target:
1123         ID %expect-rr 1
1124       ;
1126       expr_list:
1127         expr
1128       | expr ',' expr_list
1129       ;
1131       expr:
1132         ID %expect-rr 1
1133       | ...
1134       ;
1136   In a statement such as
1138       x, y = 3, 4;
1140   the parser must reduce x to a target or an expr, but does not know which
1141   until it sees the '='.  So we notate the two possible reductions to
1142   indicate that each conflicts in one rule.
1144   This feature needs user feedback, and might evolve in the future.
1146 *** C++: Actual token constructors
1148   When variants and token constructors are enabled, in addition to the
1149   type-safe named token constructors (make_ID, make_INT, etc.), we now
1150   generate genuine constructors for symbol_type.
1152   For instance with these declarations
1154     %token           ':'
1155        <std::string> ID
1156        <int>         INT;
1158   you may use these constructors:
1160     symbol_type (int token, const std::string&);
1161     symbol_type (int token, const int&);
1162     symbol_type (int token);
1164   Correct matching between token types and value types is checked via
1165   'assert'; for instance, 'symbol_type (ID, 42)' would abort.  Named
1166   constructors are preferable, as they offer better type safety (for
1167   instance 'make_ID (42)' would not even compile), but symbol_type
1168   constructors may help when token types are discovered at run-time, e.g.,
1170      [a-z]+   {
1171                 if (auto i = lookup_keyword (yytext))
1172                   return yy::parser::symbol_type (i);
1173                 else
1174                   return yy::parser::make_ID (yytext);
1175               }
1177 *** C++: Variadic emplace
1179   If your application requires C++11 and you don't use symbol constructors,
1180   you may now use a variadic emplace for semantic values:
1182     %define api.value.type variant
1183     %token <std::pair<int, int>> PAIR
1185   in your scanner:
1187     int yylex (parser::semantic_type *lvalp)
1188     {
1189       lvalp->emplace <std::pair<int, int>> (1, 2);
1190       return parser::token::PAIR;
1191     }
1193 *** C++: Syntax error exceptions in GLR
1195   The glr.cc skeleton now supports syntax_error exceptions thrown from user
1196   actions, or from the scanner.
1198 *** More POSIX Yacc compatibility warnings
1200   More Bison specific directives are now reported with -y or -Wyacc.  This
1201   change was ready since the release of Bison 3.0 in September 2015.  It was
1202   delayed because Autoconf used to define YACC as `bison -y`, which resulted
1203   in numerous warnings for Bison users that use the GNU Build System.
1205   If you still experience that problem, either redefine YACC as `bison -o
1206   y.tab.c`, or pass -Wno-yacc to Bison.
1208 *** The tables yyrhs and yyphrs are back
1210   Because no Bison skeleton uses them, these tables were removed (no longer
1211   passed to the skeletons, not even computed) in 2008.  However, some users
1212   have expressed interest in being able to use them in their own skeletons.
1214 ** Bug fixes
1216 *** Incorrect number of reduce/reduce conflicts
1218   On a grammar such as
1220      exp: "num" | "num" | "num"
1222   bison used to report a single RR conflict, instead of two.  This is now
1223   fixed.  This was the oldest (known) bug in Bison: it was there when Bison
1224   was entered in the RCS version control system, in December 1987.
1226   Some grammar files might have to adjust their %expect-rr.
1228 *** Parser directives that were not careful enough
1230   Passing invalid arguments to %nterm, for instance character literals, used
1231   to result in unclear error messages.
1233 ** Documentation
1235   The examples/ directory (installed in .../share/doc/bison/examples) has
1236   been restructured per language for clarity.  The examples come with a
1237   README and a Makefile.  Not only can they be used to toy with Bison, they
1238   can also be starting points for your own grammars.
1240   There is now a Java example, and a simple example in C based on Flex and
1241   Bison (examples/c/lexcalc/).
1243 ** Changes
1245 *** Parsers in C++
1247   They now use noexcept and constexpr.  Please, report missing annotations.
1249 *** Symbol Declarations
1251   The syntax of the variation directives to declare symbols was overhauled
1252   for more consistency, and also better POSIX Yacc compliance (which, for
1253   instance, allows "%type" without actually providing a type).  The %nterm
1254   directive, supported by Bison since its inception, is now documented and
1255   officially supported.
1257   The syntax is now as follows:
1259     %token TAG? ( ID NUMBER? STRING? )+ ( TAG ( ID NUMBER? STRING? )+ )*
1260     %left  TAG? ( ID NUMBER? )+ ( TAG ( ID NUMBER? )+ )*
1261     %type  TAG? ( ID | CHAR | STRING )+ ( TAG ( ID | CHAR | STRING )+ )*
1262     %nterm TAG? ID+ ( TAG ID+ )*
1264   where TAG denotes a type tag such as ‘<ival>’, ID denotes an identifier
1265   such as ‘NUM’, NUMBER a decimal or hexadecimal integer such as ‘300’ or
1266   ‘0x12d’, CHAR a character literal such as ‘'+'’, and STRING a string
1267   literal such as ‘"number"’.  The post-fix quantifiers are ‘?’ (zero or
1268   one), ‘*’ (zero or more) and ‘+’ (one or more).
1271 * Noteworthy changes in release 3.2.4 (2018-12-24) [stable]
1273 ** Bug fixes
1275   Fix the move constructor of symbol_type.
1277   Always provide a copy constructor for symbol_type, even in modern C++.
1280 * Noteworthy changes in release 3.2.3 (2018-12-18) [stable]
1282 ** Bug fixes
1284   Properly support token constructors in C++ with types that include commas
1285   (e.g., std::pair<int, int>).  A regression introduced in Bison 3.2.
1288 * Noteworthy changes in release 3.2.2 (2018-11-21) [stable]
1290 ** Bug fixes
1292   C++ portability issues.
1295 * Noteworthy changes in release 3.2.1 (2018-11-09) [stable]
1297 ** Bug fixes
1299   Several portability issues have been fixed in the build system, in the
1300   test suite, and in the generated parsers in C++.
1303 * Noteworthy changes in release 3.2 (2018-10-29) [stable]
1305 ** Backward incompatible changes
1307   Support for DJGPP, which has been unmaintained and untested for years, is
1308   obsolete.  Unless there is activity to revive it, it will be removed.
1310 ** Changes
1312   %printers should use yyo rather than yyoutput to denote the output stream.
1314   Variant-based symbols in C++ should use emplace() rather than build().
1316   In C++ parsers, parser::operator() is now a synonym for the parser::parse.
1318 ** Documentation
1320   A new section, "A Simple C++ Example", is a tutorial for parsers in C++.
1322   A comment in the generated code now emphasizes that users should not
1323   depend upon non-documented implementation details, such as macros starting
1324   with YY_.
1326 ** New features
1328 *** C++: Support for move semantics (lalr1.cc)
1330   The lalr1.cc skeleton now fully supports C++ move semantics, while
1331   maintaining compatibility with C++98.  You may now store move-only types
1332   when using Bison's variants.  For instance:
1334     %code {
1335       #include <memory>
1336       #include <vector>
1337     }
1339     %skeleton "lalr1.cc"
1340     %define api.value.type variant
1342     %%
1344     %token <int> INT "int";
1345     %type <std::unique_ptr<int>> int;
1346     %type <std::vector<std::unique_ptr<int>>> list;
1348     list:
1349       %empty    {}
1350     | list int  { $$ = std::move($1); $$.emplace_back(std::move($2)); }
1352     int: "int"  { $$ = std::make_unique<int>($1); }
1354 *** C++: Implicit move of right-hand side values (lalr1.cc)
1356   In modern C++ (C++11 and later), you should always use 'std::move' with
1357   the values of the right-hand side symbols ($1, $2, etc.), as they will be
1358   popped from the stack anyway.  Using 'std::move' is mandatory for
1359   move-only types such as unique_ptr, and it provides a significant speedup
1360   for large types such as std::string, or std::vector, etc.
1362   If '%define api.value.automove' is set, every occurrence '$n' is replaced
1363   by 'std::move ($n)'.  The second rule in the previous grammar can be
1364   simplified to:
1366     list: list int  { $$ = $1; $$.emplace_back($2); }
1368   With automove enabled, the semantic values are no longer lvalues, so do
1369   not use the swap idiom:
1371     list: list int  { std::swap($$, $1); $$.emplace_back($2); }
1373   This idiom is anyway obsolete: it is preferable to move than to swap.
1375   A warning is issued when automove is enabled, and a value is used several
1376   times.
1378     input.yy:16.31-32: warning: multiple occurrences of $2 with api.value.automove enabled [-Wother]
1379     exp: "twice" exp   { $$ = $2 + $2; }
1380                                    ^^
1382   Enabling api.value.automove does not require support for modern C++.  The
1383   generated code is valid C++98/03, but will use copies instead of moves.
1385   The new examples/c++/variant-11.yy shows these features in action.
1387 *** C++: The implicit default semantic action is always run
1389   When variants are enabled, the default action was not run, so
1391     exp: "number"
1393   was equivalent to
1395     exp: "number"  {}
1397   It now behaves like in all the other cases, as
1399     exp: "number"  { $$ = $1; }
1401   possibly using std::move if automove is enabled.
1403   We do not expect backward compatibility issues.  However, beware of
1404   forward compatibility issues: if you rely on default actions with
1405   variants, be sure to '%require "3.2"' to avoid older versions of Bison to
1406   generate incorrect parsers.
1408 *** C++: Renaming location.hh
1410   When both %defines and %locations are enabled, Bison generates a
1411   location.hh file.  If you don't use locations outside of the parser, you
1412   may avoid its creation with:
1414     %define api.location.file none
1416   However this file is useful if, for instance, your parser builds an AST
1417   decorated with locations: you may use Bison's location independently of
1418   Bison's parser.  You can now give it another name, for instance:
1420     %define api.location.file "my-location.hh"
1422   This name can have directory components, and even be absolute.  The name
1423   under which the location file is included is controlled by
1424   api.location.include.
1426   This way it is possible to have several parsers share the same location
1427   file.
1429   For instance, in src/foo/parser.hh, generate the include/ast/loc.hh file:
1431     %locations
1432     %define api.namespace {foo}
1433     %define api.location.file "include/ast/loc.hh"
1434     %define api.location.include {<ast/loc.hh>}
1436   and use it in src/bar/parser.hh:
1438     %locations
1439     %define api.namespace {bar}
1440     %code requires {#include <ast/loc.hh>}
1441     %define api.location.type {bar::location}
1443   Absolute file names are supported, so in your Makefile, passing the flag
1444   -Dapi.location.file='"$(top_srcdir)/include/ast/location.hh"' to bison is
1445   safe.
1447 *** C++: stack.hh and position.hh are deprecated
1449   When asked to generate a header file (%defines), the lalr1.cc skeleton
1450   generates a stack.hh file.  This file had no interest for users; it is now
1451   made useless: its content is included in the parser definition.  It is
1452   still generated for backward compatibility.
1454   When in addition to %defines, location support is requested (%locations),
1455   the file position.hh is also generated.  It is now also useless: its
1456   content is now included in location.hh.
1458   These files are no longer generated when your grammar file requires at
1459   least Bison 3.2 (%require "3.2").
1461 ** Bug fixes
1463   Portability issues on MinGW and VS2015.
1465   Portability issues in the test suite.
1467   Portability/warning issues with Flex.
1470 * Noteworthy changes in release 3.1 (2018-08-27) [stable]
1472 ** Backward incompatible changes
1474   Compiling Bison now requires a C99 compiler---as announced during the
1475   release of Bison 3.0, five years ago.  Generated parsers do not require a
1476   C99 compiler.
1478   Support for DJGPP, which has been unmaintained and untested for years, is
1479   obsolete. Unless there is activity to revive it, the next release of Bison
1480   will have it removed.
1482 ** New features
1484 *** Typed midrule actions
1486   Because their type is unknown to Bison, the values of midrule actions are
1487   not treated like the others: they don't have %printer and %destructor
1488   support.  It also prevents C++ (Bison) variants to handle them properly.
1490   Typed midrule actions address these issues.  Instead of:
1492     exp: { $<ival>$ = 1; } { $<ival>$ = 2; }   { $$ = $<ival>1 + $<ival>2; }
1494   write:
1496     exp: <ival>{ $$ = 1; } <ival>{ $$ = 2; }   { $$ = $1 + $2; }
1498 *** Reports include the type of the symbols
1500   The sections about terminal and nonterminal symbols of the '*.output' file
1501   now specify their declared type.  For instance, for:
1503     %token <ival> NUM
1505   the report now shows '<ival>':
1507     Terminals, with rules where they appear
1509     NUM <ival> (258) 5
1511 *** Diagnostics about useless rules
1513   In the following grammar, the 'exp' nonterminal is trivially useless.  So,
1514   of course, its rules are useless too.
1516     %%
1517     input: '0' | exp
1518     exp: exp '+' exp | exp '-' exp | '(' exp ')'
1520   Previously all the useless rules were reported, including those whose
1521   left-hand side is the 'exp' nonterminal:
1523     warning: 1 nonterminal useless in grammar [-Wother]
1524     warning: 4 rules useless in grammar [-Wother]
1525     2.14-16: warning: nonterminal useless in grammar: exp [-Wother]
1526      input: '0' | exp
1527                   ^^^
1528     2.14-16: warning: rule useless in grammar [-Wother]
1529      input: '0' | exp
1530                   ^^^
1531     3.6-16: warning: rule useless in grammar [-Wother]
1532      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1533           ^^^^^^^^^^^
1534     3.20-30: warning: rule useless in grammar [-Wother]
1535      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1536                         ^^^^^^^^^^^
1537     3.34-44: warning: rule useless in grammar [-Wother]
1538      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1539                                       ^^^^^^^^^^^
1541   Now, rules whose left-hand side symbol is useless are no longer reported
1542   as useless.  The locations of the errors have also been adjusted to point
1543   to the first use of the nonterminal as a left-hand side of a rule:
1545     warning: 1 nonterminal useless in grammar [-Wother]
1546     warning: 4 rules useless in grammar [-Wother]
1547     3.1-3: warning: nonterminal useless in grammar: exp [-Wother]
1548      exp: exp '+' exp | exp '-' exp | '(' exp ')'
1549      ^^^
1550     2.14-16: warning: rule useless in grammar [-Wother]
1551      input: '0' | exp
1552                   ^^^
1554 *** C++: Generated parsers can be compiled with -fno-exceptions (lalr1.cc)
1556   When compiled with exceptions disabled, the generated parsers no longer
1557   uses try/catch clauses.
1559   Currently only GCC and Clang are supported.
1561 ** Documentation
1563 *** A demonstration of variants
1565   A new example was added (installed in .../share/doc/bison/examples),
1566   'variant.yy', which shows how to use (Bison) variants in C++.
1568   The other examples were made nicer to read.
1570 *** Some features are no longer 'experimental'
1572   The following features, mature enough, are no longer flagged as
1573   experimental in the documentation: push parsers, default %printer and
1574   %destructor (typed: <*> and untyped: <>), %define api.value.type union and
1575   variant, Java parsers, XML output, LR family (lr, ielr, lalr), and
1576   semantic predicates (%?).
1578 ** Bug fixes
1580 *** GLR: Predicates support broken by #line directives
1582   Predicates (%?) in GLR such as
1584     widget:
1585       %? {new_syntax} 'w' id new_args
1586     | %?{!new_syntax} 'w' id old_args
1588   were issued with #lines in the middle of C code.
1590 *** Printer and destructor with broken #line directives
1592   The #line directives were not properly escaped when emitting the code for
1593   %printer/%destructor, which resulted in compiler errors if there are
1594   backslashes or double-quotes in the grammar file name.
1596 *** Portability on ICC
1598   The Intel compiler claims compatibility with GCC, yet rejects its _Pragma.
1599   Generated parsers now work around this.
1601 *** Various
1603   There were several small fixes in the test suite and in the build system,
1604   many warnings in bison and in the generated parsers were eliminated.  The
1605   documentation also received its share of minor improvements.
1607   Useless code was removed from C++ parsers, and some of the generated
1608   constructors are more 'natural'.
1611 * Noteworthy changes in release 3.0.5 (2018-05-27) [stable]
1613 ** Bug fixes
1615 *** C++: Fix support of 'syntax_error'
1617   One incorrect 'inline' resulted in linking errors about the constructor of
1618   the syntax_error exception.
1620 *** C++: Fix warnings
1622   GCC 7.3 (with -O1 or -O2 but not -O0 or -O3) issued null-dereference
1623   warnings about yyformat being possibly null.  It also warned about the
1624   deprecated implicit definition of copy constructors when there's a
1625   user-defined (copy) assignment operator.
1627 *** Location of errors
1629   In C++ parsers, out-of-bounds errors can happen when a rule with an empty
1630   ride-hand side raises a syntax error.  The behavior of the default parser
1631   (yacc.c) in such a condition was undefined.
1633   Now all the parsers match the behavior of glr.c: @$ is used as the
1634   location of the error.  This handles gracefully rules with and without
1635   rhs.
1637 *** Portability fixes in the test suite
1639   On some platforms, some Java and/or C++ tests were failing.
1642 * Noteworthy changes in release 3.0.4 (2015-01-23) [stable]
1644 ** Bug fixes
1646 *** C++ with Variants (lalr1.cc)
1648   Fix a compiler warning when no %destructor use $$.
1650 *** Test suites
1652   Several portability issues in tests were fixed.
1655 * Noteworthy changes in release 3.0.3 (2015-01-15) [stable]
1657 ** Bug fixes
1659 *** C++ with Variants (lalr1.cc)
1661   Problems with %destructor and '%define parse.assert' have been fixed.
1663 *** Named %union support (yacc.c, glr.c)
1665   Bison 3.0 introduced a regression on named %union such as
1667     %union foo { int ival; };
1669   The possibility to use a name was introduced "for Yacc compatibility".
1670   It is however not required by POSIX Yacc, and its usefulness is not clear.
1672 *** %define api.value.type union with %defines (yacc.c, glr.c)
1674   The C parsers were broken when %defines was used together with "%define
1675   api.value.type union".
1677 *** Redeclarations are reported in proper order
1679   On
1681     %token FOO "foo"
1682     %printer {} "foo"
1683     %printer {} FOO
1685   bison used to report:
1687     foo.yy:2.10-11: error: %printer redeclaration for FOO
1688      %printer {} "foo"
1689               ^^
1690     foo.yy:3.10-11:     previous declaration
1691      %printer {} FOO
1692               ^^
1694   Now, the "previous" declaration is always the first one.
1697 ** Documentation
1699   Bison now installs various files in its docdir (which defaults to
1700   '/usr/local/share/doc/bison'), including the three fully blown examples
1701   extracted from the documentation:
1703    - rpcalc
1704      Reverse Polish Calculator, a simple introductory example.
1705    - mfcalc
1706      Multi-function Calc, a calculator with memory and functions and located
1707      error messages.
1708    - calc++
1709      a calculator in C++ using variant support and token constructors.
1712 * Noteworthy changes in release 3.0.2 (2013-12-05) [stable]
1714 ** Bug fixes
1716 *** Generated source files when errors are reported
1718   When warnings are issued and -Werror is set, bison would still generate
1719   the source files (*.c, *.h...).  As a consequence, some runs of "make"
1720   could fail the first time, but not the second (as the files were generated
1721   anyway).
1723   This is fixed: bison no longer generates this source files, but, of
1724   course, still produces the various reports (*.output, *.xml, etc.).
1726 *** %empty is used in reports
1728   Empty right-hand sides are denoted by '%empty' in all the reports (text,
1729   dot, XML and formats derived from it).
1731 *** YYERROR and variants
1733   When C++ variant support is enabled, an error triggered via YYERROR, but
1734   not caught via error recovery, resulted in a double deletion.
1737 * Noteworthy changes in release 3.0.1 (2013-11-12) [stable]
1739 ** Bug fixes
1741 *** Errors in caret diagnostics
1743   On some platforms, some errors could result in endless diagnostics.
1745 *** Fixes of the -Werror option
1747   Options such as "-Werror -Wno-error=foo" were still turning "foo"
1748   diagnostics into errors instead of warnings.  This is fixed.
1750   Actually, for consistency with GCC, "-Wno-error=foo -Werror" now also
1751   leaves "foo" diagnostics as warnings.  Similarly, with "-Werror=foo
1752   -Wno-error", "foo" diagnostics are now errors.
1754 *** GLR Predicates
1756   As demonstrated in the documentation, one can now leave spaces between
1757   "%?" and its "{".
1759 *** Installation
1761   The yacc.1 man page is no longer installed if --disable-yacc was
1762   specified.
1764 *** Fixes in the test suite
1766   Bugs and portability issues.
1769 * Noteworthy changes in release 3.0 (2013-07-25) [stable]
1771 ** WARNING: Future backward-incompatibilities!
1773   Like other GNU packages, Bison will start using some of the C99 features
1774   for its own code, especially the definition of variables after statements.
1775   The generated C parsers still aim at C90.
1777 ** Backward incompatible changes
1779 *** Obsolete features
1781   Support for YYFAIL is removed (deprecated in Bison 2.4.2): use YYERROR.
1783   Support for yystype and yyltype is removed (deprecated in Bison 1.875):
1784   use YYSTYPE and YYLTYPE.
1786   Support for YYLEX_PARAM and YYPARSE_PARAM is removed (deprecated in Bison
1787   1.875): use %lex-param, %parse-param, or %param.
1789   Missing semicolons at the end of actions are no longer added (as announced
1790   in the release 2.5).
1792 *** Use of YACC='bison -y'
1794   TL;DR: With Autoconf <= 2.69, pass -Wno-yacc to (AM_)YFLAGS if you use
1795   Bison extensions.
1797   Traditional Yacc generates 'y.tab.c' whatever the name of the input file.
1798   Therefore Makefiles written for Yacc expect 'y.tab.c' (and possibly
1799   'y.tab.h' and 'y.output') to be generated from 'foo.y'.
1801   To this end, for ages, AC_PROG_YACC, Autoconf's macro to look for an
1802   implementation of Yacc, was using Bison as 'bison -y'.  While it does
1803   ensure compatible output file names, it also enables warnings for
1804   incompatibilities with POSIX Yacc.  In other words, 'bison -y' triggers
1805   warnings for Bison extensions.
1807   Autoconf 2.70+ fixes this incompatibility by using YACC='bison -o y.tab.c'
1808   (which also generates 'y.tab.h' and 'y.output' when needed).
1809   Alternatively, disable Yacc warnings by passing '-Wno-yacc' to your Yacc
1810   flags (YFLAGS, or AM_YFLAGS with Automake).
1812 ** Bug fixes
1814 *** The epilogue is no longer affected by internal #defines (glr.c)
1816   The glr.c skeleton uses defines such as #define yylval (yystackp->yyval) in
1817   generated code.  These weren't properly undefined before the inclusion of
1818   the user epilogue, so functions such as the following were butchered by the
1819   preprocessor expansion:
1821     int yylex (YYSTYPE *yylval);
1823   This is fixed: yylval, yynerrs, yychar, and yylloc are now valid
1824   identifiers for user-provided variables.
1826 *** stdio.h is no longer needed when locations are enabled (yacc.c)
1828   Changes in Bison 2.7 introduced a dependency on FILE and fprintf when
1829   locations are enabled.  This is fixed.
1831 *** Warnings about useless %pure-parser/%define api.pure are restored
1833 ** Diagnostics reported by Bison
1835   Most of these features were contributed by Théophile Ranquet and Victor
1836   Santet.
1838 *** Carets
1840   Version 2.7 introduced caret errors, for a prettier output.  These are now
1841   activated by default.  The old format can still be used by invoking Bison
1842   with -fno-caret (or -fnone).
1844   Some error messages that reproduced excerpts of the grammar are now using
1845   the caret information only.  For instance on:
1847     %%
1848     exp: 'a' | 'a';
1850   Bison 2.7 reports:
1852     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
1853     in.y:2.12-14: warning: rule useless in parser due to conflicts: exp: 'a' [-Wother]
1855   Now bison reports:
1857     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
1858     in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
1859      exp: 'a' | 'a';
1860                 ^^^
1862   and "bison -fno-caret" reports:
1864     in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
1865     in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
1867 *** Enhancements of the -Werror option
1869   The -Werror=CATEGORY option is now recognized, and will treat specified
1870   warnings as errors. The warnings need not have been explicitly activated
1871   using the -W option, this is similar to what GCC 4.7 does.
1873   For example, given the following command line, Bison will treat both
1874   warnings related to POSIX Yacc incompatibilities and S/R conflicts as
1875   errors (and only those):
1877     $ bison -Werror=yacc,error=conflicts-sr input.y
1879   If no categories are specified, -Werror will make all active warnings into
1880   errors. For example, the following line does the same the previous example:
1882     $ bison -Werror -Wnone -Wyacc -Wconflicts-sr input.y
1884   (By default -Wconflicts-sr,conflicts-rr,deprecated,other is enabled.)
1886   Note that the categories in this -Werror option may not be prefixed with
1887   "no-". However, -Wno-error[=CATEGORY] is valid.
1889   Note that -y enables -Werror=yacc. Therefore it is now possible to require
1890   Yacc-like behavior (e.g., always generate y.tab.c), but to report
1891   incompatibilities as warnings: "-y -Wno-error=yacc".
1893 *** The display of warnings is now richer
1895   The option that controls a given warning is now displayed:
1897     foo.y:4.6: warning: type clash on default action: <foo> != <bar> [-Wother]
1899   In the case of warnings treated as errors, the prefix is changed from
1900   "warning: " to "error: ", and the suffix is displayed, in a manner similar
1901   to GCC, as [-Werror=CATEGORY].
1903   For instance, where the previous version of Bison would report (and exit
1904   with failure):
1906     bison: warnings being treated as errors
1907     input.y:1.1: warning: stray ',' treated as white space
1909   it now reports:
1911     input.y:1.1: error: stray ',' treated as white space [-Werror=other]
1913 *** Deprecated constructs
1915   The new 'deprecated' warning category flags obsolete constructs whose
1916   support will be discontinued.  It is enabled by default.  These warnings
1917   used to be reported as 'other' warnings.
1919 *** Useless semantic types
1921   Bison now warns about useless (uninhabited) semantic types.  Since
1922   semantic types are not declared to Bison (they are defined in the opaque
1923   %union structure), it is %printer/%destructor directives about useless
1924   types that trigger the warning:
1926     %token <type1> term
1927     %type  <type2> nterm
1928     %printer    {} <type1> <type3>
1929     %destructor {} <type2> <type4>
1930     %%
1931     nterm: term { $$ = $1; };
1933     3.28-34: warning: type <type3> is used, but is not associated to any symbol
1934     4.28-34: warning: type <type4> is used, but is not associated to any symbol
1936 *** Undefined but unused symbols
1938   Bison used to raise an error for undefined symbols that are not used in
1939   the grammar.  This is now only a warning.
1941     %printer    {} symbol1
1942     %destructor {} symbol2
1943     %type <type>   symbol3
1944     %%
1945     exp: "a";
1947 *** Useless destructors or printers
1949   Bison now warns about useless destructors or printers.  In the following
1950   example, the printer for <type1>, and the destructor for <type2> are
1951   useless: all symbols of <type1> (token1) already have a printer, and all
1952   symbols of type <type2> (token2) already have a destructor.
1954     %token <type1> token1
1955            <type2> token2
1956            <type3> token3
1957            <type4> token4
1958     %printer    {} token1 <type1> <type3>
1959     %destructor {} token2 <type2> <type4>
1961 *** Conflicts
1963   The warnings and error messages about shift/reduce and reduce/reduce
1964   conflicts have been normalized.  For instance on the following foo.y file:
1966     %glr-parser
1967     %%
1968     exp: exp '+' exp | '0' | '0';
1970   compare the previous version of bison:
1972     $ bison foo.y
1973     foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
1974     $ bison -Werror foo.y
1975     bison: warnings being treated as errors
1976     foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
1978   with the new behavior:
1980     $ bison foo.y
1981     foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
1982     foo.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
1983     $ bison -Werror foo.y
1984     foo.y: error: 1 shift/reduce conflict [-Werror=conflicts-sr]
1985     foo.y: error: 2 reduce/reduce conflicts [-Werror=conflicts-rr]
1987   When %expect or %expect-rr is used, such as with bar.y:
1989     %expect 0
1990     %glr-parser
1991     %%
1992     exp: exp '+' exp | '0' | '0';
1994   Former behavior:
1996     $ bison bar.y
1997     bar.y: conflicts: 1 shift/reduce, 2 reduce/reduce
1998     bar.y: expected 0 shift/reduce conflicts
1999     bar.y: expected 0 reduce/reduce conflicts
2001   New one:
2003     $ bison bar.y
2004     bar.y: error: shift/reduce conflicts: 1 found, 0 expected
2005     bar.y: error: reduce/reduce conflicts: 2 found, 0 expected
2007 ** Incompatibilities with POSIX Yacc
2009   The 'yacc' category is no longer part of '-Wall', enable it explicitly
2010   with '-Wyacc'.
2012 ** Additional yylex/yyparse arguments
2014   The new directive %param declares additional arguments to both yylex and
2015   yyparse.  The %lex-param, %parse-param, and %param directives support one
2016   or more arguments.  Instead of
2018     %lex-param   {arg1_type *arg1}
2019     %lex-param   {arg2_type *arg2}
2020     %parse-param {arg1_type *arg1}
2021     %parse-param {arg2_type *arg2}
2023   one may now declare
2025     %param {arg1_type *arg1} {arg2_type *arg2}
2027 ** Types of values for %define variables
2029   Bison used to make no difference between '%define foo bar' and '%define
2030   foo "bar"'.  The former is now called a 'keyword value', and the latter a
2031   'string value'.  A third kind was added: 'code values', such as '%define
2032   foo {bar}'.
2034   Keyword variables are used for fixed value sets, e.g.,
2036     %define lr.type lalr
2038   Code variables are used for value in the target language, e.g.,
2040     %define api.value.type {struct semantic_type}
2042   String variables are used remaining cases, e.g. file names.
2044 ** Variable api.token.prefix
2046   The variable api.token.prefix changes the way tokens are identified in
2047   the generated files.  This is especially useful to avoid collisions
2048   with identifiers in the target language.  For instance
2050     %token FILE for ERROR
2051     %define api.token.prefix {TOK_}
2052     %%
2053     start: FILE for ERROR;
2055   will generate the definition of the symbols TOK_FILE, TOK_for, and
2056   TOK_ERROR in the generated sources.  In particular, the scanner must
2057   use these prefixed token names, although the grammar itself still
2058   uses the short names (as in the sample rule given above).
2060 ** Variable api.value.type
2062   This new %define variable supersedes the #define macro YYSTYPE.  The use
2063   of YYSTYPE is discouraged.  In particular, #defining YYSTYPE *and* either
2064   using %union or %defining api.value.type results in undefined behavior.
2066   Either define api.value.type, or use "%union":
2068     %union
2069     {
2070       int ival;
2071       char *sval;
2072     }
2073     %token <ival> INT "integer"
2074     %token <sval> STRING "string"
2075     %printer { fprintf (yyo, "%d", $$); } <ival>
2076     %destructor { free ($$); } <sval>
2078     /* In yylex().  */
2079     yylval.ival = 42; return INT;
2080     yylval.sval = "42"; return STRING;
2082   The %define variable api.value.type supports both keyword and code values.
2084   The keyword value 'union' means that the user provides genuine types, not
2085   union member names such as "ival" and "sval" above (WARNING: will fail if
2086   -y/--yacc/%yacc is enabled).
2088     %define api.value.type union
2089     %token <int> INT "integer"
2090     %token <char *> STRING "string"
2091     %printer { fprintf (yyo, "%d", $$); } <int>
2092     %destructor { free ($$); } <char *>
2094     /* In yylex().  */
2095     yylval.INT = 42; return INT;
2096     yylval.STRING = "42"; return STRING;
2098   The keyword value variant is somewhat equivalent, but for C++ special
2099   provision is made to allow classes to be used (more about this below).
2101     %define api.value.type variant
2102     %token <int> INT "integer"
2103     %token <std::string> STRING "string"
2105   Code values (in braces) denote user defined types.  This is where YYSTYPE
2106   used to be used.
2108     %code requires
2109     {
2110       struct my_value
2111       {
2112         enum
2113         {
2114           is_int, is_string
2115         } kind;
2116         union
2117         {
2118           int ival;
2119           char *sval;
2120         } u;
2121       };
2122     }
2123     %define api.value.type {struct my_value}
2124     %token <u.ival> INT "integer"
2125     %token <u.sval> STRING "string"
2126     %printer { fprintf (yyo, "%d", $$); } <u.ival>
2127     %destructor { free ($$); } <u.sval>
2129     /* In yylex().  */
2130     yylval.u.ival = 42; return INT;
2131     yylval.u.sval = "42"; return STRING;
2133 ** Variable parse.error
2135   This variable controls the verbosity of error messages.  The use of the
2136   %error-verbose directive is deprecated in favor of "%define parse.error
2137   verbose".
2139 ** Deprecated %define variable names
2141   The following variables have been renamed for consistency.  Backward
2142   compatibility is ensured, but upgrading is recommended.
2144     lr.default-reductions      -> lr.default-reduction
2145     lr.keep-unreachable-states -> lr.keep-unreachable-state
2146     namespace                  -> api.namespace
2147     stype                      -> api.value.type
2149 ** Semantic predicates
2151   Contributed by Paul Hilfinger.
2153   The new, experimental, semantic-predicate feature allows actions of the
2154   form "%?{ BOOLEAN-EXPRESSION }", which cause syntax errors (as for
2155   YYERROR) if the expression evaluates to 0, and are evaluated immediately
2156   in GLR parsers, rather than being deferred.  The result is that they allow
2157   the programmer to prune possible parses based on the values of run-time
2158   expressions.
2160 ** The directive %expect-rr is now an error in non GLR mode
2162   It used to be an error only if used in non GLR mode, _and_ if there are
2163   reduce/reduce conflicts.
2165 ** Tokens are numbered in their order of appearance
2167   Contributed by Valentin Tolmer.
2169   With '%token A B', A had a number less than the one of B.  However,
2170   precedence declarations used to generate a reversed order.  This is now
2171   fixed, and introducing tokens with any of %token, %left, %right,
2172   %precedence, or %nonassoc yields the same result.
2174   When mixing declarations of tokens with a literal character (e.g., 'a') or
2175   with an identifier (e.g., B) in a precedence declaration, Bison numbered
2176   the literal characters first.  For example
2178     %right A B 'c' 'd'
2180   would lead to the tokens declared in this order: 'c' 'd' A B.  Again, the
2181   input order is now preserved.
2183   These changes were made so that one can remove useless precedence and
2184   associativity declarations (i.e., map %nonassoc, %left or %right to
2185   %precedence, or to %token) and get exactly the same output.
2187 ** Useless precedence and associativity
2189   Contributed by Valentin Tolmer.
2191   When developing and maintaining a grammar, useless associativity and
2192   precedence directives are common.  They can be a nuisance: new ambiguities
2193   arising are sometimes masked because their conflicts are resolved due to
2194   the extra precedence or associativity information.  Furthermore, it can
2195   hinder the comprehension of a new grammar: one will wonder about the role
2196   of a precedence, where in fact it is useless.  The following changes aim
2197   at detecting and reporting these extra directives.
2199 *** Precedence warning category
2201   A new category of warning, -Wprecedence, was introduced. It flags the
2202   useless precedence and associativity directives.
2204 *** Useless associativity
2206   Bison now warns about symbols with a declared associativity that is never
2207   used to resolve conflicts.  In that case, using %precedence is sufficient;
2208   the parsing tables will remain unchanged.  Solving these warnings may raise
2209   useless precedence warnings, as the symbols no longer have associativity.
2210   For example:
2212     %left '+'
2213     %left '*'
2214     %%
2215     exp:
2216       "number"
2217     | exp '+' "number"
2218     | exp '*' exp
2219     ;
2221   will produce a
2223     warning: useless associativity for '+', use %precedence [-Wprecedence]
2224      %left '+'
2225            ^^^
2227 *** Useless precedence
2229   Bison now warns about symbols with a declared precedence and no declared
2230   associativity (i.e., declared with %precedence), and whose precedence is
2231   never used.  In that case, the symbol can be safely declared with %token
2232   instead, without modifying the parsing tables.  For example:
2234     %precedence '='
2235     %%
2236     exp: "var" '=' "number";
2238   will produce a
2240     warning: useless precedence for '=' [-Wprecedence]
2241      %precedence '='
2242                  ^^^
2244 *** Useless precedence and associativity
2246   In case of both useless precedence and associativity, the issue is flagged
2247   as follows:
2249     %nonassoc '='
2250     %%
2251     exp: "var" '=' "number";
2253   The warning is:
2255     warning: useless precedence and associativity for '=' [-Wprecedence]
2256      %nonassoc '='
2257                ^^^
2259 ** Empty rules
2261   With help from Joel E. Denny and Gabriel Rassoul.
2263   Empty rules (i.e., with an empty right-hand side) can now be explicitly
2264   marked by the new %empty directive.  Using %empty on a non-empty rule is
2265   an error.  The new -Wempty-rule warning reports empty rules without
2266   %empty.  On the following grammar:
2268     %%
2269     s: a b c;
2270     a: ;
2271     b: %empty;
2272     c: 'a' %empty;
2274   bison reports:
2276     3.4-5: warning: empty rule without %empty [-Wempty-rule]
2277      a: {}
2278         ^^
2279     5.8-13: error: %empty on non-empty rule
2280      c: 'a' %empty {};
2281             ^^^^^^
2283 ** Java skeleton improvements
2285   The constants for token names were moved to the Lexer interface.  Also, it
2286   is possible to add code to the parser's constructors using "%code init"
2287   and "%define init_throws".
2288   Contributed by Paolo Bonzini.
2290   The Java skeleton now supports push parsing.
2291   Contributed by Dennis Heimbigner.
2293 ** C++ skeletons improvements
2295 *** The parser header is no longer mandatory (lalr1.cc, glr.cc)
2297   Using %defines is now optional.  Without it, the needed support classes
2298   are defined in the generated parser, instead of additional files (such as
2299   location.hh, position.hh and stack.hh).
2301 *** Locations are no longer mandatory (lalr1.cc, glr.cc)
2303   Both lalr1.cc and glr.cc no longer require %location.
2305 *** syntax_error exception (lalr1.cc)
2307   The C++ parser features a syntax_error exception, which can be
2308   thrown from the scanner or from user rules to raise syntax errors.
2309   This facilitates reporting errors caught in sub-functions (e.g.,
2310   rejecting too large integral literals from a conversion function
2311   used by the scanner, or rejecting invalid combinations from a
2312   factory invoked by the user actions).
2314 *** %define api.value.type variant
2316   This is based on a submission from Michiel De Wilde.  With help
2317   from Théophile Ranquet.
2319   In this mode, complex C++ objects can be used as semantic values.  For
2320   instance:
2322     %token <::std::string> TEXT;
2323     %token <int> NUMBER;
2324     %token SEMICOLON ";"
2325     %type <::std::string> item;
2326     %type <::std::list<std::string>> list;
2327     %%
2328     result:
2329       list  { std::cout << $1 << std::endl; }
2330     ;
2332     list:
2333       %empty        { /* Generates an empty string list. */ }
2334     | list item ";" { std::swap ($$, $1); $$.push_back ($2); }
2335     ;
2337     item:
2338       TEXT    { std::swap ($$, $1); }
2339     | NUMBER  { $$ = string_cast ($1); }
2340     ;
2342 *** %define api.token.constructor
2344   When variants are enabled, Bison can generate functions to build the
2345   tokens.  This guarantees that the token type (e.g., NUMBER) is consistent
2346   with the semantic value (e.g., int):
2348     parser::symbol_type yylex ()
2349     {
2350       parser::location_type loc = ...;
2351       ...
2352       return parser::make_TEXT ("Hello, world!", loc);
2353       ...
2354       return parser::make_NUMBER (42, loc);
2355       ...
2356       return parser::make_SEMICOLON (loc);
2357       ...
2358     }
2360 *** C++ locations
2362   There are operator- and operator-= for 'location'.  Negative line/column
2363   increments can no longer underflow the resulting value.
2366 * Noteworthy changes in release 2.7.1 (2013-04-15) [stable]
2368 ** Bug fixes
2370 *** Fix compiler attribute portability (yacc.c)
2372   With locations enabled, __attribute__ was used unprotected.
2374 *** Fix some compiler warnings (lalr1.cc)
2377 * Noteworthy changes in release 2.7 (2012-12-12) [stable]
2379 ** Bug fixes
2381   Warnings about uninitialized yylloc in yyparse have been fixed.
2383   Restored C90 compliance (yet no report was ever made).
2385 ** Diagnostics are improved
2387   Contributed by Théophile Ranquet.
2389 *** Changes in the format of error messages
2391   This used to be the format of many error reports:
2393     input.y:2.7-12: %type redeclaration for exp
2394     input.y:1.7-12: previous declaration
2396   It is now:
2398     input.y:2.7-12: error: %type redeclaration for exp
2399     input.y:1.7-12:     previous declaration
2401 *** New format for error reports: carets
2403   Caret errors have been added to Bison:
2405     input.y:2.7-12: error: %type redeclaration for exp
2406      %type <sval> exp
2407            ^^^^^^
2408     input.y:1.7-12:     previous declaration
2409      %type <ival> exp
2410            ^^^^^^
2412   or
2414     input.y:3.20-23: error: ambiguous reference: '$exp'
2415      exp: exp '+' exp { $exp = $1 + $3; };
2416                         ^^^^
2417     input.y:3.1-3:       refers to: $exp at $$
2418      exp: exp '+' exp { $exp = $1 + $3; };
2419      ^^^
2420     input.y:3.6-8:       refers to: $exp at $1
2421      exp: exp '+' exp { $exp = $1 + $3; };
2422           ^^^
2423     input.y:3.14-16:     refers to: $exp at $3
2424      exp: exp '+' exp { $exp = $1 + $3; };
2425                   ^^^
2427   The default behavior for now is still not to display these unless
2428   explicitly asked with -fcaret (or -fall). However, in a later release, it
2429   will be made the default behavior (but may still be deactivated with
2430   -fno-caret).
2432 ** New value for %define variable: api.pure full
2434   The %define variable api.pure requests a pure (reentrant) parser. However,
2435   for historical reasons, using it in a location-tracking Yacc parser
2436   resulted in a yyerror function that did not take a location as a
2437   parameter. With this new value, the user may request a better pure parser,
2438   where yyerror does take a location as a parameter (in location-tracking
2439   parsers).
2441   The use of "%define api.pure true" is deprecated in favor of this new
2442   "%define api.pure full".
2444 ** New %define variable: api.location.type (glr.cc, lalr1.cc, lalr1.java)
2446   The %define variable api.location.type defines the name of the type to use
2447   for locations.  When defined, Bison no longer generates the position.hh
2448   and location.hh files, nor does the parser will include them: the user is
2449   then responsible to define her type.
2451   This can be used in programs with several parsers to factor their location
2452   and position files: let one of them generate them, and the others just use
2453   them.
2455   This feature was actually introduced, but not documented, in Bison 2.5,
2456   under the name "location_type" (which is maintained for backward
2457   compatibility).
2459   For consistency, lalr1.java's %define variables location_type and
2460   position_type are deprecated in favor of api.location.type and
2461   api.position.type.
2463 ** Exception safety (lalr1.cc)
2465   The parse function now catches exceptions, uses the %destructors to
2466   release memory (the lookahead symbol and the symbols pushed on the stack)
2467   before re-throwing the exception.
2469   This feature is somewhat experimental.  User feedback would be
2470   appreciated.
2472 ** Graph improvements in DOT and XSLT
2474   Contributed by Théophile Ranquet.
2476   The graphical presentation of the states is more readable: their shape is
2477   now rectangular, the state number is clearly displayed, and the items are
2478   numbered and left-justified.
2480   The reductions are now explicitly represented as transitions to other
2481   diamond shaped nodes.
2483   These changes are present in both --graph output and xml2dot.xsl XSLT
2484   processing, with minor (documented) differences.
2486 ** %language is no longer an experimental feature.
2488   The introduction of this feature, in 2.4, was four years ago. The
2489   --language option and the %language directive are no longer experimental.
2491 ** Documentation
2493   The sections about shift/reduce and reduce/reduce conflicts resolution
2494   have been fixed and extended.
2496   Although introduced more than four years ago, XML and Graphviz reports
2497   were not properly documented.
2499   The translation of midrule actions is now described.
2502 * Noteworthy changes in release 2.6.5 (2012-11-07) [stable]
2504   We consider compiler warnings about Bison generated parsers to be bugs.
2505   Rather than working around them in your own project, please consider
2506   reporting them to us.
2508 ** Bug fixes
2510   Warnings about uninitialized yylval and/or yylloc for push parsers with a
2511   pure interface have been fixed for GCC 4.0 up to 4.8, and Clang 2.9 to
2512   3.2.
2514   Other issues in the test suite have been addressed.
2516   Null characters are correctly displayed in error messages.
2518   When possible, yylloc is correctly initialized before calling yylex.  It
2519   is no longer necessary to initialize it in the %initial-action.
2522 * Noteworthy changes in release 2.6.4 (2012-10-23) [stable]
2524   Bison 2.6.3's --version was incorrect.  This release fixes this issue.
2527 * Noteworthy changes in release 2.6.3 (2012-10-22) [stable]
2529 ** Bug fixes
2531   Bugs and portability issues in the test suite have been fixed.
2533   Some errors in translations have been addressed, and --help now directs
2534   users to the appropriate place to report them.
2536   Stray Info files shipped by accident are removed.
2538   Incorrect definitions of YY_, issued by yacc.c when no parser header is
2539   generated, are removed.
2541   All the generated headers are self-contained.
2543 ** Header guards (yacc.c, glr.c, glr.cc)
2545   In order to avoid collisions, the header guards are now
2546   YY_<PREFIX>_<FILE>_INCLUDED, instead of merely <PREFIX>_<FILE>.
2547   For instance the header generated from
2549     %define api.prefix "calc"
2550     %defines "lib/parse.h"
2552   will use YY_CALC_LIB_PARSE_H_INCLUDED as guard.
2554 ** Fix compiler warnings in the generated parser (yacc.c, glr.c)
2556   The compilation of pure parsers (%define api.pure) can trigger GCC
2557   warnings such as:
2559     input.c: In function 'yyparse':
2560     input.c:1503:12: warning: 'yylval' may be used uninitialized in this
2561                               function [-Wmaybe-uninitialized]
2562        *++yyvsp = yylval;
2563                 ^
2565   This is now fixed; pragmas to avoid these warnings are no longer needed.
2567   Warnings from clang ("equality comparison with extraneous parentheses" and
2568   "function declared 'noreturn' should not return") have also been
2569   addressed.
2572 * Noteworthy changes in release 2.6.2 (2012-08-03) [stable]
2574 ** Bug fixes
2576   Buffer overruns, complaints from Flex, and portability issues in the test
2577   suite have been fixed.
2579 ** Spaces in %lex- and %parse-param (lalr1.cc, glr.cc)
2581   Trailing end-of-lines in %parse-param or %lex-param would result in
2582   invalid C++.  This is fixed.
2584 ** Spurious spaces and end-of-lines
2586   The generated files no longer end (nor start) with empty lines.
2589 * Noteworthy changes in release 2.6.1 (2012-07-30) [stable]
2591  Bison no longer executes user-specified M4 code when processing a grammar.
2593 ** Future Changes
2595   In addition to the removal of the features announced in Bison 2.6, the
2596   next major release will remove the "Temporary hack for adding a semicolon
2597   to the user action", as announced in the release 2.5.  Instead of:
2599     exp: exp "+" exp { $$ = $1 + $3 };
2601   write:
2603     exp: exp "+" exp { $$ = $1 + $3; };
2605 ** Bug fixes
2607 *** Type names are now properly escaped.
2609 *** glr.cc: set_debug_level and debug_level work as expected.
2611 *** Stray @ or $ in actions
2613   While Bison used to warn about stray $ or @ in action rules, it did not
2614   for other actions such as printers, destructors, or initial actions.  It
2615   now does.
2617 ** Type names in actions
2619   For consistency with rule actions, it is now possible to qualify $$ by a
2620   type-name in destructors, printers, and initial actions.  For instance:
2622     %printer { fprintf (yyo, "(%d, %f)", $<ival>$, $<fval>$); } <*> <>;
2624   will display two values for each typed and untyped symbol (provided
2625   that YYSTYPE has both "ival" and "fval" fields).
2628 * Noteworthy changes in release 2.6 (2012-07-19) [stable]
2630 ** Future changes
2632   The next major release of Bison will drop support for the following
2633   deprecated features.  Please report disagreements to bug-bison@gnu.org.
2635 *** K&R C parsers
2637   Support for generating parsers in K&R C will be removed.  Parsers
2638   generated for C support ISO C90, and are tested with ISO C99 and ISO C11
2639   compilers.
2641 *** Features deprecated since Bison 1.875
2643   The definitions of yystype and yyltype will be removed; use YYSTYPE and
2644   YYLTYPE.
2646   YYPARSE_PARAM and YYLEX_PARAM, deprecated in favor of %parse-param and
2647   %lex-param, will no longer be supported.
2649   Support for the preprocessor symbol YYERROR_VERBOSE will be removed, use
2650   %error-verbose.
2652 *** The generated header will be included (yacc.c)
2654   Instead of duplicating the content of the generated header (definition of
2655   YYSTYPE, yyparse declaration etc.), the generated parser will include it,
2656   as is already the case for GLR or C++ parsers.  This change is deferred
2657   because existing versions of ylwrap (e.g., Automake 1.12.1) do not support
2658   it.
2660 ** Generated Parser Headers
2662 *** Guards (yacc.c, glr.c, glr.cc)
2664   The generated headers are now guarded, as is already the case for C++
2665   parsers (lalr1.cc).  For instance, with --defines=foo.h:
2667     #ifndef YY_FOO_H
2668     # define YY_FOO_H
2669     ...
2670     #endif /* !YY_FOO_H  */
2672 *** New declarations (yacc.c, glr.c)
2674   The generated header now declares yydebug and yyparse.  Both honor
2675   --name-prefix=bar_, and yield
2677     int bar_parse (void);
2679   rather than
2681     #define yyparse bar_parse
2682     int yyparse (void);
2684   in order to facilitate the inclusion of several parser headers inside a
2685   single compilation unit.
2687 *** Exported symbols in C++
2689   The symbols YYTOKEN_TABLE and YYERROR_VERBOSE, which were defined in the
2690   header, are removed, as they prevent the possibility of including several
2691   generated headers from a single compilation unit.
2693 *** YYLSP_NEEDED
2695   For the same reasons, the undocumented and unused macro YYLSP_NEEDED is no
2696   longer defined.
2698 ** New %define variable: api.prefix
2700   Now that the generated headers are more complete and properly protected
2701   against multiple inclusions, constant names, such as YYSTYPE are a
2702   problem.  While yyparse and others are properly renamed by %name-prefix,
2703   YYSTYPE, YYDEBUG and others have never been affected by it.  Because it
2704   would introduce backward compatibility issues in projects not expecting
2705   YYSTYPE to be renamed, instead of changing the behavior of %name-prefix,
2706   it is deprecated in favor of a new %define variable: api.prefix.
2708   The following examples compares both:
2710     %name-prefix "bar_"               | %define api.prefix "bar_"
2711     %token <ival> FOO                   %token <ival> FOO
2712     %union { int ival; }                %union { int ival; }
2713     %%                                  %%
2714     exp: 'a';                           exp: 'a';
2716   bison generates:
2718     #ifndef BAR_FOO_H                   #ifndef BAR_FOO_H
2719     # define BAR_FOO_H                  # define BAR_FOO_H
2721     /* Enabling traces.  */             /* Enabling traces.  */
2722     # ifndef YYDEBUG                  | # ifndef BAR_DEBUG
2723                                       > #  if defined YYDEBUG
2724                                       > #   if YYDEBUG
2725                                       > #    define BAR_DEBUG 1
2726                                       > #   else
2727                                       > #    define BAR_DEBUG 0
2728                                       > #   endif
2729                                       > #  else
2730     #  define YYDEBUG 0               | #   define BAR_DEBUG 0
2731                                       > #  endif
2732     # endif                           | # endif
2734     # if YYDEBUG                      | # if BAR_DEBUG
2735     extern int bar_debug;               extern int bar_debug;
2736     # endif                             # endif
2738     /* Tokens.  */                      /* Tokens.  */
2739     # ifndef YYTOKENTYPE              | # ifndef BAR_TOKENTYPE
2740     #  define YYTOKENTYPE             | #  define BAR_TOKENTYPE
2741        enum yytokentype {             |    enum bar_tokentype {
2742          FOO = 258                           FOO = 258
2743        };                                  };
2744     # endif                             # endif
2746     #if ! defined YYSTYPE \           | #if ! defined BAR_STYPE \
2747      && ! defined YYSTYPE_IS_DECLARED |  && ! defined BAR_STYPE_IS_DECLARED
2748     typedef union YYSTYPE             | typedef union BAR_STYPE
2749     {                                   {
2750      int ival;                           int ival;
2751     } YYSTYPE;                        | } BAR_STYPE;
2752     # define YYSTYPE_IS_DECLARED 1    | # define BAR_STYPE_IS_DECLARED 1
2753     #endif                              #endif
2755     extern YYSTYPE bar_lval;          | extern BAR_STYPE bar_lval;
2757     int bar_parse (void);               int bar_parse (void);
2759     #endif /* !BAR_FOO_H  */            #endif /* !BAR_FOO_H  */
2762 * Noteworthy changes in release 2.5.1 (2012-06-05) [stable]
2764 ** Future changes:
2766   The next major release will drop support for generating parsers in K&R C.
2768 ** yacc.c: YYBACKUP works as expected.
2770 ** glr.c improvements:
2772 *** Location support is eliminated when not requested:
2774   GLR parsers used to include location-related code even when locations were
2775   not requested, and therefore not even usable.
2777 *** __attribute__ is preserved:
2779   __attribute__ is no longer disabled when __STRICT_ANSI__ is defined (i.e.,
2780   when -std is passed to GCC).
2782 ** lalr1.java: several fixes:
2784   The Java parser no longer throws ArrayIndexOutOfBoundsException if the
2785   first token leads to a syntax error.  Some minor clean ups.
2787 ** Changes for C++:
2789 *** C++11 compatibility:
2791   C and C++ parsers use "nullptr" instead of "0" when __cplusplus is 201103L
2792   or higher.
2794 *** Header guards
2796   The header files such as "parser.hh", "location.hh", etc. used a constant
2797   name for preprocessor guards, for instance:
2799     #ifndef BISON_LOCATION_HH
2800     # define BISON_LOCATION_HH
2801     ...
2802     #endif // !BISON_LOCATION_HH
2804   The inclusion guard is now computed from "PREFIX/FILE-NAME", where lower
2805   case characters are converted to upper case, and series of
2806   non-alphanumerical characters are converted to an underscore.
2808   With "bison -o lang++/parser.cc", "location.hh" would now include:
2810     #ifndef YY_LANG_LOCATION_HH
2811     # define YY_LANG_LOCATION_HH
2812     ...
2813     #endif // !YY_LANG_LOCATION_HH
2815 *** C++ locations:
2817   The position and location constructors (and their initialize methods)
2818   accept new arguments for line and column.  Several issues in the
2819   documentation were fixed.
2821 ** liby is no longer asking for "rpl_fprintf" on some platforms.
2823 ** Changes in the manual:
2825 *** %printer is documented
2827   The "%printer" directive, supported since at least Bison 1.50, is finally
2828   documented.  The "mfcalc" example is extended to demonstrate it.
2830   For consistency with the C skeletons, the C++ parsers now also support
2831   "yyoutput" (as an alias to "debug_stream ()").
2833 *** Several improvements have been made:
2835   The layout for grammar excerpts was changed to a more compact scheme.
2836   Named references are motivated.  The description of the automaton
2837   description file (*.output) is updated to the current format.  Incorrect
2838   index entries were fixed.  Some other errors were fixed.
2840 ** Building bison:
2842 *** Conflicting prototypes with recent/modified Flex.
2844   Fixed build problems with the current, unreleased, version of Flex, and
2845   some modified versions of 2.5.35, which have modified function prototypes.
2847 *** Warnings during the build procedure have been eliminated.
2849 *** Several portability problems in the test suite have been fixed:
2851   This includes warnings with some compilers, unexpected behavior of tools
2852   such as diff, warning messages from the test suite itself, etc.
2854 *** The install-pdf target works properly:
2856   Running "make install-pdf" (or -dvi, -html, -info, and -ps) no longer
2857   halts in the middle of its course.
2860 * Noteworthy changes in release 2.5 (2011-05-14)
2862 ** Grammar symbol names can now contain non-initial dashes:
2864   Consistently with directives (such as %error-verbose) and with
2865   %define variables (e.g. push-pull), grammar symbol names may contain
2866   dashes in any position except the beginning.  This is a GNU
2867   extension over POSIX Yacc.  Thus, use of this extension is reported
2868   by -Wyacc and rejected in Yacc mode (--yacc).
2870 ** Named references:
2872   Historically, Yacc and Bison have supported positional references
2873   ($n, $$) to allow access to symbol values from inside of semantic
2874   actions code.
2876   Starting from this version, Bison can also accept named references.
2877   When no ambiguity is possible, original symbol names may be used
2878   as named references:
2880     if_stmt : "if" cond_expr "then" then_stmt ';'
2881     { $if_stmt = mk_if_stmt($cond_expr, $then_stmt); }
2883   In the more common case, explicit names may be declared:
2885     stmt[res] : "if" expr[cond] "then" stmt[then] "else" stmt[else] ';'
2886     { $res = mk_if_stmt($cond, $then, $else); }
2888   Location information is also accessible using @name syntax.  When
2889   accessing symbol names containing dots or dashes, explicit bracketing
2890   ($[sym.1]) must be used.
2892   These features are experimental in this version.  More user feedback
2893   will help to stabilize them.
2894   Contributed by Alex Rozenman.
2896 ** IELR(1) and canonical LR(1):
2898   IELR(1) is a minimal LR(1) parser table generation algorithm.  That
2899   is, given any context-free grammar, IELR(1) generates parser tables
2900   with the full language-recognition power of canonical LR(1) but with
2901   nearly the same number of parser states as LALR(1).  This reduction
2902   in parser states is often an order of magnitude.  More importantly,
2903   because canonical LR(1)'s extra parser states may contain duplicate
2904   conflicts in the case of non-LR(1) grammars, the number of conflicts
2905   for IELR(1) is often an order of magnitude less as well.  This can
2906   significantly reduce the complexity of developing of a grammar.
2908   Bison can now generate IELR(1) and canonical LR(1) parser tables in
2909   place of its traditional LALR(1) parser tables, which remain the
2910   default.  You can specify the type of parser tables in the grammar
2911   file with these directives:
2913     %define lr.type lalr
2914     %define lr.type ielr
2915     %define lr.type canonical-lr
2917   The default-reduction optimization in the parser tables can also be
2918   adjusted using "%define lr.default-reductions".  For details on both
2919   of these features, see the new section "Tuning LR" in the Bison
2920   manual.
2922   These features are experimental.  More user feedback will help to
2923   stabilize them.
2925 ** LAC (Lookahead Correction) for syntax error handling
2927   Contributed by Joel E. Denny.
2929   Canonical LR, IELR, and LALR can suffer from a couple of problems
2930   upon encountering a syntax error.  First, the parser might perform
2931   additional parser stack reductions before discovering the syntax
2932   error.  Such reductions can perform user semantic actions that are
2933   unexpected because they are based on an invalid token, and they
2934   cause error recovery to begin in a different syntactic context than
2935   the one in which the invalid token was encountered.  Second, when
2936   verbose error messages are enabled (with %error-verbose or the
2937   obsolete "#define YYERROR_VERBOSE"), the expected token list in the
2938   syntax error message can both contain invalid tokens and omit valid
2939   tokens.
2941   The culprits for the above problems are %nonassoc, default
2942   reductions in inconsistent states, and parser state merging.  Thus,
2943   IELR and LALR suffer the most.  Canonical LR can suffer only if
2944   %nonassoc is used or if default reductions are enabled for
2945   inconsistent states.
2947   LAC is a new mechanism within the parsing algorithm that solves
2948   these problems for canonical LR, IELR, and LALR without sacrificing
2949   %nonassoc, default reductions, or state merging.  When LAC is in
2950   use, canonical LR and IELR behave almost exactly the same for both
2951   syntactically acceptable and syntactically unacceptable input.
2952   While LALR still does not support the full language-recognition
2953   power of canonical LR and IELR, LAC at least enables LALR's syntax
2954   error handling to correctly reflect LALR's language-recognition
2955   power.
2957   Currently, LAC is only supported for deterministic parsers in C.
2958   You can enable LAC with the following directive:
2960     %define parse.lac full
2962   See the new section "LAC" in the Bison manual for additional
2963   details including a few caveats.
2965   LAC is an experimental feature.  More user feedback will help to
2966   stabilize it.
2968 ** %define improvements:
2970 *** Can now be invoked via the command line:
2972   Each of these command-line options
2974     -D NAME[=VALUE]
2975     --define=NAME[=VALUE]
2977     -F NAME[=VALUE]
2978     --force-define=NAME[=VALUE]
2980   is equivalent to this grammar file declaration
2982     %define NAME ["VALUE"]
2984   except that the manner in which Bison processes multiple definitions
2985   for the same NAME differs.  Most importantly, -F and --force-define
2986   quietly override %define, but -D and --define do not.  For further
2987   details, see the section "Bison Options" in the Bison manual.
2989 *** Variables renamed:
2991   The following %define variables
2993     api.push_pull
2994     lr.keep_unreachable_states
2996   have been renamed to
2998     api.push-pull
2999     lr.keep-unreachable-states
3001   The old names are now deprecated but will be maintained indefinitely
3002   for backward compatibility.
3004 *** Values no longer need to be quoted in the grammar file:
3006   If a %define value is an identifier, it no longer needs to be placed
3007   within quotations marks.  For example,
3009     %define api.push-pull "push"
3011   can be rewritten as
3013     %define api.push-pull push
3015 *** Unrecognized variables are now errors not warnings.
3017 *** Multiple invocations for any variable is now an error not a warning.
3019 ** Unrecognized %code qualifiers are now errors not warnings.
3021 ** Character literals not of length one:
3023   Previously, Bison quietly converted all character literals to length
3024   one.  For example, without warning, Bison interpreted the operators in
3025   the following grammar to be the same token:
3027     exp: exp '++'
3028        | exp '+' exp
3029        ;
3031   Bison now warns when a character literal is not of length one.  In
3032   some future release, Bison will start reporting an error instead.
3034 ** Destructor calls fixed for lookaheads altered in semantic actions:
3036   Previously for deterministic parsers in C, if a user semantic action
3037   altered yychar, the parser in some cases used the old yychar value to
3038   determine which destructor to call for the lookahead upon a syntax
3039   error or upon parser return.  This bug has been fixed.
3041 ** C++ parsers use YYRHSLOC:
3043   Similarly to the C parsers, the C++ parsers now define the YYRHSLOC
3044   macro and use it in the default YYLLOC_DEFAULT.  You are encouraged
3045   to use it.  If, for instance, your location structure has "first"
3046   and "last" members, instead of
3048     # define YYLLOC_DEFAULT(Current, Rhs, N)                             \
3049       do                                                                 \
3050         if (N)                                                           \
3051           {                                                              \
3052             (Current).first = (Rhs)[1].location.first;                   \
3053             (Current).last  = (Rhs)[N].location.last;                    \
3054           }                                                              \
3055         else                                                             \
3056           {                                                              \
3057             (Current).first = (Current).last = (Rhs)[0].location.last;   \
3058           }                                                              \
3059       while (false)
3061   use:
3063     # define YYLLOC_DEFAULT(Current, Rhs, N)                             \
3064       do                                                                 \
3065         if (N)                                                           \
3066           {                                                              \
3067             (Current).first = YYRHSLOC (Rhs, 1).first;                   \
3068             (Current).last  = YYRHSLOC (Rhs, N).last;                    \
3069           }                                                              \
3070         else                                                             \
3071           {                                                              \
3072             (Current).first = (Current).last = YYRHSLOC (Rhs, 0).last;   \
3073           }                                                              \
3074       while (false)
3076 ** YYLLOC_DEFAULT in C++:
3078   The default implementation of YYLLOC_DEFAULT used to be issued in
3079   the header file.  It is now output in the implementation file, after
3080   the user %code sections so that its #ifndef guard does not try to
3081   override the user's YYLLOC_DEFAULT if provided.
3083 ** YYFAIL now produces warnings and Java parsers no longer implement it:
3085   YYFAIL has existed for many years as an undocumented feature of
3086   deterministic parsers in C generated by Bison.  More recently, it was
3087   a documented feature of Bison's experimental Java parsers.  As
3088   promised in Bison 2.4.2's NEWS entry, any appearance of YYFAIL in a
3089   semantic action now produces a deprecation warning, and Java parsers
3090   no longer implement YYFAIL at all.  For further details, including a
3091   discussion of how to suppress C preprocessor warnings about YYFAIL
3092   being unused, see the Bison 2.4.2 NEWS entry.
3094 ** Temporary hack for adding a semicolon to the user action:
3096   Previously, Bison appended a semicolon to every user action for
3097   reductions when the output language defaulted to C (specifically, when
3098   neither %yacc, %language, %skeleton, or equivalent command-line
3099   options were specified).  This allowed actions such as
3101     exp: exp "+" exp { $$ = $1 + $3 };
3103   instead of
3105     exp: exp "+" exp { $$ = $1 + $3; };
3107   As a first step in removing this misfeature, Bison now issues a
3108   warning when it appends a semicolon.  Moreover, in cases where Bison
3109   cannot easily determine whether a semicolon is needed (for example, an
3110   action ending with a cpp directive or a braced compound initializer),
3111   it no longer appends one.  Thus, the C compiler might now complain
3112   about a missing semicolon where it did not before.  Future releases of
3113   Bison will cease to append semicolons entirely.
3115 ** Verbose syntax error message fixes:
3117   When %error-verbose or the obsolete "#define YYERROR_VERBOSE" is
3118   specified, syntax error messages produced by the generated parser
3119   include the unexpected token as well as a list of expected tokens.
3120   The effect of %nonassoc on these verbose messages has been corrected
3121   in two ways, but a more complete fix requires LAC, described above:
3123 *** When %nonassoc is used, there can exist parser states that accept no
3124     tokens, and so the parser does not always require a lookahead token
3125     in order to detect a syntax error.  Because no unexpected token or
3126     expected tokens can then be reported, the verbose syntax error
3127     message described above is suppressed, and the parser instead
3128     reports the simpler message, "syntax error".  Previously, this
3129     suppression was sometimes erroneously triggered by %nonassoc when a
3130     lookahead was actually required.  Now verbose messages are
3131     suppressed only when all previous lookaheads have already been
3132     shifted or discarded.
3134 *** Previously, the list of expected tokens erroneously included tokens
3135     that would actually induce a syntax error because conflicts for them
3136     were resolved with %nonassoc in the current parser state.  Such
3137     tokens are now properly omitted from the list.
3139 *** Expected token lists are still often wrong due to state merging
3140     (from LALR or IELR) and default reductions, which can both add
3141     invalid tokens and subtract valid tokens.  Canonical LR almost
3142     completely fixes this problem by eliminating state merging and
3143     default reductions.  However, there is one minor problem left even
3144     when using canonical LR and even after the fixes above.  That is,
3145     if the resolution of a conflict with %nonassoc appears in a later
3146     parser state than the one at which some syntax error is
3147     discovered, the conflicted token is still erroneously included in
3148     the expected token list.  Bison's new LAC implementation,
3149     described above, eliminates this problem and the need for
3150     canonical LR.  However, LAC is still experimental and is disabled
3151     by default.
3153 ** Java skeleton fixes:
3155 *** A location handling bug has been fixed.
3157 *** The top element of each of the value stack and location stack is now
3158     cleared when popped so that it can be garbage collected.
3160 *** Parser traces now print the top element of the stack.
3162 ** -W/--warnings fixes:
3164 *** Bison now properly recognizes the "no-" versions of categories:
3166   For example, given the following command line, Bison now enables all
3167   warnings except warnings for incompatibilities with POSIX Yacc:
3169     bison -Wall,no-yacc gram.y
3171 *** Bison now treats S/R and R/R conflicts like other warnings:
3173   Previously, conflict reports were independent of Bison's normal
3174   warning system.  Now, Bison recognizes the warning categories
3175   "conflicts-sr" and "conflicts-rr".  This change has important
3176   consequences for the -W and --warnings command-line options.  For
3177   example:
3179     bison -Wno-conflicts-sr gram.y  # S/R conflicts not reported
3180     bison -Wno-conflicts-rr gram.y  # R/R conflicts not reported
3181     bison -Wnone            gram.y  # no conflicts are reported
3182     bison -Werror           gram.y  # any conflict is an error
3184   However, as before, if the %expect or %expect-rr directive is
3185   specified, an unexpected number of conflicts is an error, and an
3186   expected number of conflicts is not reported, so -W and --warning
3187   then have no effect on the conflict report.
3189 *** The "none" category no longer disables a preceding "error":
3191   For example, for the following command line, Bison now reports
3192   errors instead of warnings for incompatibilities with POSIX Yacc:
3194     bison -Werror,none,yacc gram.y
3196 *** The "none" category now disables all Bison warnings:
3198   Previously, the "none" category disabled only Bison warnings for
3199   which there existed a specific -W/--warning category.  However,
3200   given the following command line, Bison is now guaranteed to
3201   suppress all warnings:
3203     bison -Wnone gram.y
3205 ** Precedence directives can now assign token number 0:
3207   Since Bison 2.3b, which restored the ability of precedence
3208   directives to assign token numbers, doing so for token number 0 has
3209   produced an assertion failure.  For example:
3211     %left END 0
3213   This bug has been fixed.
3216 * Noteworthy changes in release 2.4.3 (2010-08-05)
3218 ** Bison now obeys -Werror and --warnings=error for warnings about
3219    grammar rules that are useless in the parser due to conflicts.
3221 ** Problems with spawning M4 on at least FreeBSD 8 and FreeBSD 9 have
3222    been fixed.
3224 ** Failures in the test suite for GCC 4.5 have been fixed.
3226 ** Failures in the test suite for some versions of Sun Studio C++ have
3227    been fixed.
3229 ** Contrary to Bison 2.4.2's NEWS entry, it has been decided that
3230    warnings about undefined %prec identifiers will not be converted to
3231    errors in Bison 2.5.  They will remain warnings, which should be
3232    sufficient for POSIX while avoiding backward compatibility issues.
3234 ** Minor documentation fixes.
3237 * Noteworthy changes in release 2.4.2 (2010-03-20)
3239 ** Some portability problems that resulted in failures and livelocks
3240    in the test suite on some versions of at least Solaris, AIX, HP-UX,
3241    RHEL4, and Tru64 have been addressed.  As a result, fatal Bison
3242    errors should no longer cause M4 to report a broken pipe on the
3243    affected platforms.
3245 ** "%prec IDENTIFIER" requires IDENTIFIER to be defined separately.
3247   POSIX specifies that an error be reported for any identifier that does
3248   not appear on the LHS of a grammar rule and that is not defined by
3249   %token, %left, %right, or %nonassoc.  Bison 2.3b and later lost this
3250   error report for the case when an identifier appears only after a
3251   %prec directive.  It is now restored.  However, for backward
3252   compatibility with recent Bison releases, it is only a warning for
3253   now.  In Bison 2.5 and later, it will return to being an error.
3254   [Between the 2.4.2 and 2.4.3 releases, it was decided that this
3255   warning will not be converted to an error in Bison 2.5.]
3257 ** Detection of GNU M4 1.4.6 or newer during configure is improved.
3259 ** Warnings from gcc's -Wundef option about undefined YYENABLE_NLS,
3260    YYLTYPE_IS_TRIVIAL, and __STRICT_ANSI__ in C/C++ parsers are now
3261    avoided.
3263 ** %code is now a permanent feature.
3265   A traditional Yacc prologue directive is written in the form:
3267     %{CODE%}
3269   To provide a more flexible alternative, Bison 2.3b introduced the
3270   %code directive with the following forms for C/C++:
3272     %code          {CODE}
3273     %code requires {CODE}
3274     %code provides {CODE}
3275     %code top      {CODE}
3277   These forms are now considered permanent features of Bison.  See the
3278   %code entries in the section "Bison Declaration Summary" in the Bison
3279   manual for a summary of their functionality.  See the section
3280   "Prologue Alternatives" for a detailed discussion including the
3281   advantages of %code over the traditional Yacc prologue directive.
3283   Bison's Java feature as a whole including its current usage of %code
3284   is still considered experimental.
3286 ** YYFAIL is deprecated and will eventually be removed.
3288   YYFAIL has existed for many years as an undocumented feature of
3289   deterministic parsers in C generated by Bison.  Previously, it was
3290   documented for Bison's experimental Java parsers.  YYFAIL is no longer
3291   documented for Java parsers and is formally deprecated in both cases.
3292   Users are strongly encouraged to migrate to YYERROR, which is
3293   specified by POSIX.
3295   Like YYERROR, you can invoke YYFAIL from a semantic action in order to
3296   induce a syntax error.  The most obvious difference from YYERROR is
3297   that YYFAIL will automatically invoke yyerror to report the syntax
3298   error so that you don't have to.  However, there are several other
3299   subtle differences between YYERROR and YYFAIL, and YYFAIL suffers from
3300   inherent flaws when %error-verbose or "#define YYERROR_VERBOSE" is
3301   used.  For a more detailed discussion, see:
3303     http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html
3305   The upcoming Bison 2.5 will remove YYFAIL from Java parsers, but
3306   deterministic parsers in C will continue to implement it.  However,
3307   because YYFAIL is already flawed, it seems futile to try to make new
3308   Bison features compatible with it.  Thus, during parser generation,
3309   Bison 2.5 will produce a warning whenever it discovers YYFAIL in a
3310   rule action.  In a later release, YYFAIL will be disabled for
3311   %error-verbose and "#define YYERROR_VERBOSE".  Eventually, YYFAIL will
3312   be removed altogether.
3314   There exists at least one case where Bison 2.5's YYFAIL warning will
3315   be a false positive.  Some projects add phony uses of YYFAIL and other
3316   Bison-defined macros for the sole purpose of suppressing C
3317   preprocessor warnings (from GCC cpp's -Wunused-macros, for example).
3318   To avoid Bison's future warning, such YYFAIL uses can be moved to the
3319   epilogue (that is, after the second "%%") in the Bison input file.  In
3320   this release (2.4.2), Bison already generates its own code to suppress
3321   C preprocessor warnings for YYFAIL, so projects can remove their own
3322   phony uses of YYFAIL if compatibility with Bison releases prior to
3323   2.4.2 is not necessary.
3325 ** Internationalization.
3327   Fix a regression introduced in Bison 2.4: Under some circumstances,
3328   message translations were not installed although supported by the
3329   host system.
3332 * Noteworthy changes in release 2.4.1 (2008-12-11)
3334 ** In the GLR defines file, unexpanded M4 macros in the yylval and yylloc
3335    declarations have been fixed.
3337 ** Temporary hack for adding a semicolon to the user action.
3339   Bison used to prepend a trailing semicolon at the end of the user
3340   action for reductions.  This allowed actions such as
3342     exp: exp "+" exp { $$ = $1 + $3 };
3344   instead of
3346     exp: exp "+" exp { $$ = $1 + $3; };
3348   Some grammars still depend on this "feature".  Bison 2.4.1 restores
3349   the previous behavior in the case of C output (specifically, when
3350   neither %language or %skeleton or equivalent command-line options
3351   are used) to leave more time for grammars depending on the old
3352   behavior to be adjusted.  Future releases of Bison will disable this
3353   feature.
3355 ** A few minor improvements to the Bison manual.
3358 * Noteworthy changes in release 2.4 (2008-11-02)
3360 ** %language is an experimental feature.
3362   We first introduced this feature in test release 2.3b as a cleaner
3363   alternative to %skeleton.  Since then, we have discussed the possibility of
3364   modifying its effect on Bison's output file names.  Thus, in this release,
3365   we consider %language to be an experimental feature that will likely evolve
3366   in future releases.
3368 ** Forward compatibility with GNU M4 has been improved.
3370 ** Several bugs in the C++ skeleton and the experimental Java skeleton have been
3371   fixed.
3374 * Noteworthy changes in release 2.3b (2008-05-27)
3376 ** The quotes around NAME that used to be required in the following directive
3377   are now deprecated:
3379     %define NAME "VALUE"
3381 ** The directive "%pure-parser" is now deprecated in favor of:
3383     %define api.pure
3385   which has the same effect except that Bison is more careful to warn about
3386   unreasonable usage in the latter case.
3388 ** Push Parsing
3390   Bison can now generate an LALR(1) parser in C with a push interface.  That
3391   is, instead of invoking "yyparse", which pulls tokens from "yylex", you can
3392   push one token at a time to the parser using "yypush_parse", which will
3393   return to the caller after processing each token.  By default, the push
3394   interface is disabled.  Either of the following directives will enable it:
3396     %define api.push_pull "push" // Just push; does not require yylex.
3397     %define api.push_pull "both" // Push and pull; requires yylex.
3399   See the new section "A Push Parser" in the Bison manual for details.
3401   The current push parsing interface is experimental and may evolve.  More user
3402   feedback will help to stabilize it.
3404 ** The -g and --graph options now output graphs in Graphviz DOT format,
3405   not VCG format.  Like --graph, -g now also takes an optional FILE argument
3406   and thus cannot be bundled with other short options.
3408 ** Java
3410   Bison can now generate an LALR(1) parser in Java.  The skeleton is
3411   "data/lalr1.java".  Consider using the new %language directive instead of
3412   %skeleton to select it.
3414   See the new section "Java Parsers" in the Bison manual for details.
3416   The current Java interface is experimental and may evolve.  More user
3417   feedback will help to stabilize it.
3418   Contributed by Paolo Bonzini.
3420 ** %language
3422   This new directive specifies the programming language of the generated
3423   parser, which can be C (the default), C++, or Java.  Besides the skeleton
3424   that Bison uses, the directive affects the names of the generated files if
3425   the grammar file's name ends in ".y".
3427 ** XML Automaton Report
3429   Bison can now generate an XML report of the LALR(1) automaton using the new
3430   "--xml" option.  The current XML schema is experimental and may evolve.  More
3431   user feedback will help to stabilize it.
3432   Contributed by Wojciech Polak.
3434 ** The grammar file may now specify the name of the parser header file using
3435   %defines.  For example:
3437     %defines "parser.h"
3439 ** When reporting useless rules, useless nonterminals, and unused terminals,
3440   Bison now employs the terms "useless in grammar" instead of "useless",
3441   "useless in parser" instead of "never reduced", and "unused in grammar"
3442   instead of "unused".
3444 ** Unreachable State Removal
3446   Previously, Bison sometimes generated parser tables containing unreachable
3447   states.  A state can become unreachable during conflict resolution if Bison
3448   disables a shift action leading to it from a predecessor state.  Bison now:
3450     1. Removes unreachable states.
3452     2. Does not report any conflicts that appeared in unreachable states.
3453        WARNING: As a result, you may need to update %expect and %expect-rr
3454        directives in existing grammar files.
3456     3. For any rule used only in such states, Bison now reports the rule as
3457        "useless in parser due to conflicts".
3459   This feature can be disabled with the following directive:
3461     %define lr.keep_unreachable_states
3463   See the %define entry in the "Bison Declaration Summary" in the Bison manual
3464   for further discussion.
3466 ** Lookahead Set Correction in the ".output" Report
3468   When instructed to generate a ".output" file including lookahead sets
3469   (using "--report=lookahead", for example), Bison now prints each reduction's
3470   lookahead set only next to the associated state's one item that (1) is
3471   associated with the same rule as the reduction and (2) has its dot at the end
3472   of its RHS.  Previously, Bison also erroneously printed the lookahead set
3473   next to all of the state's other items associated with the same rule.  This
3474   bug affected only the ".output" file and not the generated parser source
3475   code.
3477 ** --report-file=FILE is a new option to override the default ".output" file
3478   name.
3480 ** The "=" that used to be required in the following directives is now
3481   deprecated:
3483     %file-prefix "parser"
3484     %name-prefix "c_"
3485     %output "parser.c"
3487 ** An Alternative to "%{...%}" -- "%code QUALIFIER {CODE}"
3489   Bison 2.3a provided a new set of directives as a more flexible alternative to
3490   the traditional Yacc prologue blocks.  Those have now been consolidated into
3491   a single %code directive with an optional qualifier field, which identifies
3492   the purpose of the code and thus the location(s) where Bison should generate
3493   it:
3495     1. "%code          {CODE}" replaces "%after-header  {CODE}"
3496     2. "%code requires {CODE}" replaces "%start-header  {CODE}"
3497     3. "%code provides {CODE}" replaces "%end-header    {CODE}"
3498     4. "%code top      {CODE}" replaces "%before-header {CODE}"
3500   See the %code entries in section "Bison Declaration Summary" in the Bison
3501   manual for a summary of the new functionality.  See the new section "Prologue
3502   Alternatives" for a detailed discussion including the advantages of %code
3503   over the traditional Yacc prologues.
3505   The prologue alternatives are experimental.  More user feedback will help to
3506   determine whether they should become permanent features.
3508 ** Revised warning: unset or unused midrule values
3510   Since Bison 2.2, Bison has warned about midrule values that are set but not
3511   used within any of the actions of the parent rule.  For example, Bison warns
3512   about unused $2 in:
3514     exp: '1' { $$ = 1; } '+' exp { $$ = $1 + $4; };
3516   Now, Bison also warns about midrule values that are used but not set.  For
3517   example, Bison warns about unset $$ in the midrule action in:
3519     exp: '1' { $1 = 1; } '+' exp { $$ = $2 + $4; };
3521   However, Bison now disables both of these warnings by default since they
3522   sometimes prove to be false alarms in existing grammars employing the Yacc
3523   constructs $0 or $-N (where N is some positive integer).
3525   To enable these warnings, specify the option "--warnings=midrule-values" or
3526   "-W", which is a synonym for "--warnings=all".
3528 ** Default %destructor or %printer with "<*>" or "<>"
3530   Bison now recognizes two separate kinds of default %destructor's and
3531   %printer's:
3533     1. Place "<*>" in a %destructor/%printer symbol list to define a default
3534        %destructor/%printer for all grammar symbols for which you have formally
3535        declared semantic type tags.
3537     2. Place "<>" in a %destructor/%printer symbol list to define a default
3538        %destructor/%printer for all grammar symbols without declared semantic
3539        type tags.
3541   Bison no longer supports the "%symbol-default" notation from Bison 2.3a.
3542   "<*>" and "<>" combined achieve the same effect with one exception: Bison no
3543   longer applies any %destructor to a midrule value if that midrule value is
3544   not actually ever referenced using either $$ or $n in a semantic action.
3546   The default %destructor's and %printer's are experimental.  More user
3547   feedback will help to determine whether they should become permanent
3548   features.
3550   See the section "Freeing Discarded Symbols" in the Bison manual for further
3551   details.
3553 ** %left, %right, and %nonassoc can now declare token numbers.  This is required
3554   by POSIX.  However, see the end of section "Operator Precedence" in the Bison
3555   manual for a caveat concerning the treatment of literal strings.
3557 ** The nonfunctional --no-parser, -n, and %no-parser options have been
3558   completely removed from Bison.
3561 * Noteworthy changes in release 2.3a (2006-09-13)
3563 ** Instead of %union, you can define and use your own union type
3564   YYSTYPE if your grammar contains at least one <type> tag.
3565   Your YYSTYPE need not be a macro; it can be a typedef.
3566   This change is for compatibility with other Yacc implementations,
3567   and is required by POSIX.
3569 ** Locations columns and lines start at 1.
3570   In accordance with the GNU Coding Standards and Emacs.
3572 ** You may now declare per-type and default %destructor's and %printer's:
3574   For example:
3576     %union { char *string; }
3577     %token <string> STRING1
3578     %token <string> STRING2
3579     %type  <string> string1
3580     %type  <string> string2
3581     %union { char character; }
3582     %token <character> CHR
3583     %type  <character> chr
3584     %destructor { free ($$); } %symbol-default
3585     %destructor { free ($$); printf ("%d", @$.first_line); } STRING1 string1
3586     %destructor { } <character>
3588   guarantees that, when the parser discards any user-defined symbol that has a
3589   semantic type tag other than "<character>", it passes its semantic value to
3590   "free".  However, when the parser discards a "STRING1" or a "string1", it
3591   also prints its line number to "stdout".  It performs only the second
3592   "%destructor" in this case, so it invokes "free" only once.
3594   [Although we failed to mention this here in the 2.3a release, the default
3595   %destructor's and %printer's were experimental, and they were rewritten in
3596   future versions.]
3598 ** Except for LALR(1) parsers in C with POSIX Yacc emulation enabled (with "-y",
3599   "--yacc", or "%yacc"), Bison no longer generates #define statements for
3600   associating token numbers with token names.  Removing the #define statements
3601   helps to sanitize the global namespace during preprocessing, but POSIX Yacc
3602   requires them.  Bison still generates an enum for token names in all cases.
3604 ** Handling of traditional Yacc prologue blocks is now more consistent but
3605   potentially incompatible with previous releases of Bison.
3607   As before, you declare prologue blocks in your grammar file with the
3608   "%{ ... %}" syntax.  To generate the pre-prologue, Bison concatenates all
3609   prologue blocks that you've declared before the first %union.  To generate
3610   the post-prologue, Bison concatenates all prologue blocks that you've
3611   declared after the first %union.
3613   Previous releases of Bison inserted the pre-prologue into both the header
3614   file and the code file in all cases except for LALR(1) parsers in C.  In the
3615   latter case, Bison inserted it only into the code file.  For parsers in C++,
3616   the point of insertion was before any token definitions (which associate
3617   token numbers with names).  For parsers in C, the point of insertion was
3618   after the token definitions.
3620   Now, Bison never inserts the pre-prologue into the header file.  In the code
3621   file, it always inserts it before the token definitions.
3623 ** Bison now provides a more flexible alternative to the traditional Yacc
3624   prologue blocks: %before-header, %start-header, %end-header, and
3625   %after-header.
3627   For example, the following declaration order in the grammar file reflects the
3628   order in which Bison will output these code blocks.  However, you are free to
3629   declare these code blocks in your grammar file in whatever order is most
3630   convenient for you:
3632     %before-header {
3633       /* Bison treats this block like a pre-prologue block: it inserts it into
3634        * the code file before the contents of the header file.  It does *not*
3635        * insert it into the header file.  This is a good place to put
3636        * #include's that you want at the top of your code file.  A common
3637        * example is '#include "system.h"'.  */
3638     }
3639     %start-header {
3640       /* Bison inserts this block into both the header file and the code file.
3641        * In both files, the point of insertion is before any Bison-generated
3642        * token, semantic type, location type, and class definitions.  This is a
3643        * good place to define %union dependencies, for example.  */
3644     }
3645     %union {
3646       /* Unlike the traditional Yacc prologue blocks, the output order for the
3647        * new %*-header blocks is not affected by their declaration position
3648        * relative to any %union in the grammar file.  */
3649     }
3650     %end-header {
3651       /* Bison inserts this block into both the header file and the code file.
3652        * In both files, the point of insertion is after the Bison-generated
3653        * definitions.  This is a good place to declare or define public
3654        * functions or data structures that depend on the Bison-generated
3655        * definitions.  */
3656     }
3657     %after-header {
3658       /* Bison treats this block like a post-prologue block: it inserts it into
3659        * the code file after the contents of the header file.  It does *not*
3660        * insert it into the header file.  This is a good place to declare or
3661        * define internal functions or data structures that depend on the
3662        * Bison-generated definitions.  */
3663     }
3665   If you have multiple occurrences of any one of the above declarations, Bison
3666   will concatenate the contents in declaration order.
3668   [Although we failed to mention this here in the 2.3a release, the prologue
3669   alternatives were experimental, and they were rewritten in future versions.]
3671 ** The option "--report=look-ahead" has been changed to "--report=lookahead".
3672   The old spelling still works, but is not documented and may be removed
3673   in a future release.
3676 * Noteworthy changes in release 2.3 (2006-06-05)
3678 ** GLR grammars should now use "YYRECOVERING ()" instead of "YYRECOVERING",
3679   for compatibility with LALR(1) grammars.
3681 ** It is now documented that any definition of YYSTYPE or YYLTYPE should
3682   be to a type name that does not contain parentheses or brackets.
3685 * Noteworthy changes in release 2.2 (2006-05-19)
3687 ** The distribution terms for all Bison-generated parsers now permit
3688   using the parsers in nonfree programs.  Previously, this permission
3689   was granted only for Bison-generated LALR(1) parsers in C.
3691 ** %name-prefix changes the namespace name in C++ outputs.
3693 ** The C++ parsers export their token_type.
3695 ** Bison now allows multiple %union declarations, and concatenates
3696   their contents together.
3698 ** New warning: unused values
3699   Right-hand side symbols whose values are not used are reported,
3700   if the symbols have destructors.  For instance:
3702      exp: exp "?" exp ":" exp { $1 ? $1 : $3; }
3703         | exp "+" exp
3704         ;
3706   will trigger a warning about $$ and $5 in the first rule, and $3 in
3707   the second ($1 is copied to $$ by the default rule).  This example
3708   most likely contains three errors, and could be rewritten as:
3710      exp: exp "?" exp ":" exp
3711             { $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); }
3712         | exp "+" exp
3713             { $$ = $1 ? $1 : $3; if ($1) free ($3); }
3714         ;
3716   However, if the original actions were really intended, memory leaks
3717   and all, the warnings can be suppressed by letting Bison believe the
3718   values are used, e.g.:
3720      exp: exp "?" exp ":" exp { $1 ? $1 : $3; (void) ($$, $5); }
3721         | exp "+" exp         { $$ = $1; (void) $3; }
3722         ;
3724   If there are midrule actions, the warning is issued if no action
3725   uses it.  The following triggers no warning: $1 and $3 are used.
3727      exp: exp { push ($1); } '+' exp { push ($3); sum (); };
3729   The warning is intended to help catching lost values and memory leaks.
3730   If a value is ignored, its associated memory typically is not reclaimed.
3732 ** %destructor vs. YYABORT, YYACCEPT, and YYERROR.
3733   Destructors are now called when user code invokes YYABORT, YYACCEPT,
3734   and YYERROR, for all objects on the stack, other than objects
3735   corresponding to the right-hand side of the current rule.
3737 ** %expect, %expect-rr
3738   Incorrect numbers of expected conflicts are now actual errors,
3739   instead of warnings.
3741 ** GLR, YACC parsers.
3742   The %parse-params are available in the destructors (and the
3743   experimental printers) as per the documentation.
3745 ** Bison now warns if it finds a stray "$" or "@" in an action.
3747 ** %require "VERSION"
3748   This specifies that the grammar file depends on features implemented
3749   in Bison version VERSION or higher.
3751 ** lalr1.cc: The token and value types are now class members.
3752   The tokens were defined as free form enums and cpp macros.  YYSTYPE
3753   was defined as a free form union.  They are now class members:
3754   tokens are enumerations of the "yy::parser::token" struct, and the
3755   semantic values have the "yy::parser::semantic_type" type.
3757   If you do not want or can update to this scheme, the directive
3758   '%define "global_tokens_and_yystype" "1"' triggers the global
3759   definition of tokens and YYSTYPE.  This change is suitable both
3760   for previous releases of Bison, and this one.
3762   If you wish to update, then make sure older version of Bison will
3763   fail using '%require "2.2"'.
3765 ** DJGPP support added.
3768 * Noteworthy changes in release 2.1 (2005-09-16)
3770 ** The C++ lalr1.cc skeleton supports %lex-param.
3772 ** Bison-generated parsers now support the translation of diagnostics like
3773   "syntax error" into languages other than English.  The default
3774   language is still English.  For details, please see the new
3775   Internationalization section of the Bison manual.  Software
3776   distributors should also see the new PACKAGING file.  Thanks to
3777   Bruno Haible for this new feature.
3779 ** Wording in the Bison-generated parsers has been changed slightly to
3780   simplify translation.  In particular, the message "memory exhausted"
3781   has replaced "parser stack overflow", as the old message was not
3782   always accurate for modern Bison-generated parsers.
3784 ** Destructors are now called when the parser aborts, for all symbols left
3785   behind on the stack.  Also, the start symbol is now destroyed after a
3786   successful parse.  In both cases, the behavior was formerly inconsistent.
3788 ** When generating verbose diagnostics, Bison-generated parsers no longer
3789   quote the literal strings associated with tokens.  For example, for
3790   a syntax error associated with '%token NUM "number"' they might
3791   print 'syntax error, unexpected number' instead of 'syntax error,
3792   unexpected "number"'.
3795 * Noteworthy changes in release 2.0 (2004-12-25)
3797 ** Possibly-incompatible changes
3799   - Bison-generated parsers no longer default to using the alloca function
3800     (when available) to extend the parser stack, due to widespread
3801     problems in unchecked stack-overflow detection.  You can "#define
3802     YYSTACK_USE_ALLOCA 1" to require the use of alloca, but please read
3803     the manual to determine safe values for YYMAXDEPTH in that case.
3805   - Error token location.
3806     During error recovery, the location of the syntax error is updated
3807     to cover the whole sequence covered by the error token: it includes
3808     the shifted symbols thrown away during the first part of the error
3809     recovery, and the lookahead rejected during the second part.
3811   - Semicolon changes:
3812     . Stray semicolons are no longer allowed at the start of a grammar.
3813     . Semicolons are now required after in-grammar declarations.
3815   - Unescaped newlines are no longer allowed in character constants or
3816     string literals.  They were never portable, and GCC 3.4.0 has
3817     dropped support for them.  Better diagnostics are now generated if
3818     forget a closing quote.
3820   - NUL bytes are no longer allowed in Bison string literals, unfortunately.
3822 ** New features
3824   - GLR grammars now support locations.
3826   - New directive: %initial-action.
3827     This directive allows the user to run arbitrary code (including
3828     initializing @$) from yyparse before parsing starts.
3830   - A new directive "%expect-rr N" specifies the expected number of
3831     reduce/reduce conflicts in GLR parsers.
3833   - %token numbers can now be hexadecimal integers, e.g., "%token FOO 0x12d".
3834     This is a GNU extension.
3836   - The option "--report=lookahead" was changed to "--report=look-ahead".
3837     [However, this was changed back after 2.3.]
3839   - Experimental %destructor support has been added to lalr1.cc.
3841   - New configure option --disable-yacc, to disable installation of the
3842     yacc command and -ly library introduced in 1.875 for POSIX conformance.
3844 ** Bug fixes
3846   - For now, %expect-count violations are now just warnings, not errors.
3847     This is for compatibility with Bison 1.75 and earlier (when there are
3848     reduce/reduce conflicts) and with Bison 1.30 and earlier (when there
3849     are too many or too few shift/reduce conflicts).  However, in future
3850     versions of Bison we plan to improve the %expect machinery so that
3851     these violations will become errors again.
3853   - Within Bison itself, numbers (e.g., goto numbers) are no longer
3854     arbitrarily limited to 16-bit counts.
3856   - Semicolons are now allowed before "|" in grammar rules, as POSIX requires.
3859 * Noteworthy changes in release 1.875 (2003-01-01)
3861 ** The documentation license has been upgraded to version 1.2
3862   of the GNU Free Documentation License.
3864 ** syntax error processing
3866   - In Yacc-style parsers YYLLOC_DEFAULT is now used to compute error
3867     locations too.  This fixes bugs in error-location computation.
3869   - %destructor
3870     It is now possible to reclaim the memory associated to symbols
3871     discarded during error recovery.  This feature is still experimental.
3873   - %error-verbose
3874     This new directive is preferred over YYERROR_VERBOSE.
3876   - #defining yyerror to steal internal variables is discouraged.
3877     It is not guaranteed to work forever.
3879 ** POSIX conformance
3881   - Semicolons are once again optional at the end of grammar rules.
3882     This reverts to the behavior of Bison 1.33 and earlier, and improves
3883     compatibility with Yacc.
3885   - "parse error" -> "syntax error"
3886     Bison now uniformly uses the term "syntax error"; formerly, the code
3887     and manual sometimes used the term "parse error" instead.  POSIX
3888     requires "syntax error" in diagnostics, and it was thought better to
3889     be consistent.
3891   - The documentation now emphasizes that yylex and yyerror must be
3892     declared before use.  C99 requires this.
3894   - Bison now parses C99 lexical constructs like UCNs and
3895     backslash-newline within C escape sequences, as POSIX 1003.1-2001 requires.
3897   - File names are properly escaped in C output.  E.g., foo\bar.y is
3898     output as "foo\\bar.y".
3900   - Yacc command and library now available
3901     The Bison distribution now installs a "yacc" command, as POSIX requires.
3902     Also, Bison now installs a small library liby.a containing
3903     implementations of Yacc-compatible yyerror and main functions.
3904     This library is normally not useful, but POSIX requires it.
3906   - Type clashes now generate warnings, not errors.
3908   - If the user does not define YYSTYPE as a macro, Bison now declares it
3909     using typedef instead of defining it as a macro.
3910     For consistency, YYLTYPE is also declared instead of defined.
3912 ** Other compatibility issues
3914   - %union directives can now have a tag before the "{", e.g., the
3915     directive "%union foo {...}" now generates the C code
3916     "typedef union foo { ... } YYSTYPE;"; this is for Yacc compatibility.
3917     The default union tag is "YYSTYPE", for compatibility with Solaris 9 Yacc.
3918     For consistency, YYLTYPE's struct tag is now "YYLTYPE" not "yyltype".
3919     This is for compatibility with both Yacc and Bison 1.35.
3921   - ";" is output before the terminating "}" of an action, for
3922     compatibility with Bison 1.35.
3924   - Bison now uses a Yacc-style format for conflict reports, e.g.,
3925     "conflicts: 2 shift/reduce, 1 reduce/reduce".
3927   - "yystype" and "yyltype" are now obsolescent macros instead of being
3928     typedefs or tags; they are no longer documented and are planned to be
3929     withdrawn in a future release.
3931 ** GLR parser notes
3933   - GLR and inline
3934     Users of Bison have to decide how they handle the portability of the
3935     C keyword "inline".
3937   - "parsing stack overflow..." -> "parser stack overflow"
3938     GLR parsers now report "parser stack overflow" as per the Bison manual.
3940 ** %parse-param and %lex-param
3941   The macros YYPARSE_PARAM and YYLEX_PARAM provide a means to pass
3942   additional context to yyparse and yylex.  They suffer from several
3943   shortcomings:
3945   - a single argument only can be added,
3946   - their types are weak (void *),
3947   - this context is not passed to ancillary functions such as yyerror,
3948   - only yacc.c parsers support them.
3950   The new %parse-param/%lex-param directives provide a more precise control.
3951   For instance:
3953     %parse-param {int *nastiness}
3954     %lex-param   {int *nastiness}
3955     %parse-param {int *randomness}
3957   results in the following signatures:
3959     int yylex   (int *nastiness);
3960     int yyparse (int *nastiness, int *randomness);
3962   or, if both %pure-parser and %locations are used:
3964     int yylex   (YYSTYPE *lvalp, YYLTYPE *llocp, int *nastiness);
3965     int yyparse (int *nastiness, int *randomness);
3967 ** Bison now warns if it detects conflicting outputs to the same file,
3968   e.g., it generates a warning for "bison -d -o foo.h foo.y" since
3969   that command outputs both code and header to foo.h.
3971 ** #line in output files
3972   - --no-line works properly.
3974 ** Bison can no longer be built by a K&R C compiler; it requires C89 or
3975   later to be built.  This change originally took place a few versions
3976   ago, but nobody noticed until we recently asked someone to try
3977   building Bison with a K&R C compiler.
3980 * Noteworthy changes in release 1.75 (2002-10-14)
3982 ** Bison should now work on 64-bit hosts.
3984 ** Indonesian translation thanks to Tedi Heriyanto.
3986 ** GLR parsers
3987   Fix spurious parse errors.
3989 ** Pure parsers
3990   Some people redefine yyerror to steal yyparse' private variables.
3991   Reenable this trick until an official feature replaces it.
3993 ** Type Clashes
3994   In agreement with POSIX and with other Yaccs, leaving a default
3995   action is valid when $$ is untyped, and $1 typed:
3997         untyped: ... typed;
3999   but the converse remains an error:
4001         typed: ... untyped;
4003 ** Values of midrule actions
4004   The following code:
4006         foo: { ... } { $$ = $1; } ...
4008   was incorrectly rejected: $1 is defined in the second midrule
4009   action, and is equal to the $$ of the first midrule action.
4012 * Noteworthy changes in release 1.50 (2002-10-04)
4014 ** GLR parsing
4015   The declaration
4016      %glr-parser
4017   causes Bison to produce a Generalized LR (GLR) parser, capable of handling
4018   almost any context-free grammar, ambiguous or not.  The new declarations
4019   %dprec and %merge on grammar rules allow parse-time resolution of
4020   ambiguities.  Contributed by Paul Hilfinger.
4022   Unfortunately Bison 1.50 does not work properly on 64-bit hosts
4023   like the Alpha, so please stick to 32-bit hosts for now.
4025 ** Output Directory
4026   When not in Yacc compatibility mode, when the output file was not
4027   specified, running "bison foo/bar.y" created "foo/bar.c".  It
4028   now creates "bar.c".
4030 ** Undefined token
4031   The undefined token was systematically mapped to 2 which prevented
4032   the use of 2 by the user.  This is no longer the case.
4034 ** Unknown token numbers
4035   If yylex returned an out of range value, yyparse could die.  This is
4036   no longer the case.
4038 ** Error token
4039   According to POSIX, the error token must be 256.
4040   Bison extends this requirement by making it a preference: *if* the
4041   user specified that one of her tokens is numbered 256, then error
4042   will be mapped onto another number.
4044 ** Verbose error messages
4045   They no longer report "..., expecting error or..." for states where
4046   error recovery is possible.
4048 ** End token
4049   Defaults to "$end" instead of "$".
4051 ** Error recovery now conforms to documentation and to POSIX
4052   When a Bison-generated parser encounters a syntax error, it now pops
4053   the stack until it finds a state that allows shifting the error
4054   token.  Formerly, it popped the stack until it found a state that
4055   allowed some non-error action other than a default reduction on the
4056   error token.  The new behavior has long been the documented behavior,
4057   and has long been required by POSIX.  For more details, please see
4058   Paul Eggert, "Reductions during Bison error handling" (2002-05-20)
4059   <http://lists.gnu.org/archive/html/bug-bison/2002-05/msg00038.html>.
4061 ** Traces
4062   Popped tokens and nonterminals are now reported.
4064 ** Larger grammars
4065   Larger grammars are now supported (larger token numbers, larger grammar
4066   size (= sum of the LHS and RHS lengths), larger LALR tables).
4067   Formerly, many of these numbers ran afoul of 16-bit limits;
4068   now these limits are 32 bits on most hosts.
4070 ** Explicit initial rule
4071   Bison used to play hacks with the initial rule, which the user does
4072   not write.  It is now explicit, and visible in the reports and
4073   graphs as rule 0.
4075 ** Useless rules
4076   Before, Bison reported the useless rules, but, although not used,
4077   included them in the parsers.  They are now actually removed.
4079 ** Useless rules, useless nonterminals
4080   They are now reported, as a warning, with their locations.
4082 ** Rules never reduced
4083   Rules that can never be reduced because of conflicts are now
4084   reported.
4086 ** Incorrect "Token not used"
4087   On a grammar such as
4089     %token useless useful
4090     %%
4091     exp: '0' %prec useful;
4093   where a token was used to set the precedence of the last rule,
4094   bison reported both "useful" and "useless" as useless tokens.
4096 ** Revert the C++ namespace changes introduced in 1.31
4097   as they caused too many portability hassles.
4099 ** Default locations
4100   By an accident of design, the default computation of @$ was
4101   performed after another default computation was performed: @$ = @1.
4102   The latter is now removed: YYLLOC_DEFAULT is fully responsible of
4103   the computation of @$.
4105 ** Token end-of-file
4106   The token end of file may be specified by the user, in which case,
4107   the user symbol is used in the reports, the graphs, and the verbose
4108   error messages instead of "$end", which remains being the default.
4109   For instance
4110     %token MYEOF 0
4111   or
4112     %token MYEOF 0 "end of file"
4114 ** Semantic parser
4115   This old option, which has been broken for ages, is removed.
4117 ** New translations
4118   Brazilian Portuguese, thanks to Alexandre Folle de Menezes.
4119   Croatian, thanks to Denis Lackovic.
4121 ** Incorrect token definitions
4122   When given
4123     %token 'a' "A"
4124   bison used to output
4125     #define 'a' 65
4127 ** Token definitions as enums
4128   Tokens are output both as the traditional #define's, and, provided
4129   the compiler supports ANSI C or is a C++ compiler, as enums.
4130   This lets debuggers display names instead of integers.
4132 ** Reports
4133   In addition to --verbose, bison supports --report=THINGS, which
4134   produces additional information:
4135   - itemset
4136     complete the core item sets with their closure
4137   - lookahead [changed to "look-ahead" in 1.875e through 2.3, but changed back]
4138     explicitly associate lookahead tokens to items
4139   - solved
4140     describe shift/reduce conflicts solving.
4141     Bison used to systematically output this information on top of
4142     the report.  Solved conflicts are now attached to their states.
4144 ** Type clashes
4145   Previous versions don't complain when there is a type clash on
4146   the default action if the rule has a midrule action, such as in:
4148     %type <foo> bar
4149     %%
4150     bar: '0' {} '0';
4152   This is fixed.
4154 ** GNU M4 is now required when using Bison.
4157 * Noteworthy changes in release 1.35 (2002-03-25)
4159 ** C Skeleton
4160   Some projects use Bison's C parser with C++ compilers, and define
4161   YYSTYPE as a class.  The recent adjustment of C parsers for data
4162   alignment and 64 bit architectures made this impossible.
4164   Because for the time being no real solution for C++ parser
4165   generation exists, kludges were implemented in the parser to
4166   maintain this use.  In the future, when Bison has C++ parsers, this
4167   kludge will be disabled.
4169   This kludge also addresses some C++ problems when the stack was
4170   extended.
4173 * Noteworthy changes in release 1.34 (2002-03-12)
4175 ** File name clashes are detected
4176   $ bison foo.y -d -o foo.x
4177   fatal error: header and parser would both be named "foo.x"
4179 ** A missing ";" at the end of a rule triggers a warning
4180   In accordance with POSIX, and in agreement with other
4181   Yacc implementations, Bison will mandate this semicolon in the near
4182   future.  This eases the implementation of a Bison parser of Bison
4183   grammars by making this grammar LALR(1) instead of LR(2).  To
4184   facilitate the transition, this release introduces a warning.
4186 ** Revert the C++ namespace changes introduced in 1.31, as they caused too
4187   many portability hassles.
4189 ** DJGPP support added.
4191 ** Fix test suite portability problems.
4194 * Noteworthy changes in release 1.33 (2002-02-07)
4196 ** Fix C++ issues
4197   Groff could not be compiled for the definition of size_t was lacking
4198   under some conditions.
4200 ** Catch invalid @n
4201   As is done with $n.
4204 * Noteworthy changes in release 1.32 (2002-01-23)
4206 ** Fix Yacc output file names
4208 ** Portability fixes
4210 ** Italian, Dutch translations
4213 * Noteworthy changes in release 1.31 (2002-01-14)
4215 ** Many Bug Fixes
4217 ** GNU Gettext and %expect
4218   GNU Gettext asserts 10 s/r conflicts, but there are 7.  Now that
4219   Bison dies on incorrect %expectations, we fear there will be
4220   too many bug reports for Gettext, so _for the time being_, %expect
4221   does not trigger an error when the input file is named "plural.y".
4223 ** Use of alloca in parsers
4224   If YYSTACK_USE_ALLOCA is defined to 0, then the parsers will use
4225   malloc exclusively.  Since 1.29, but was not NEWS'ed.
4227   alloca is used only when compiled with GCC, to avoid portability
4228   problems as on AIX.
4230 ** yyparse now returns 2 if memory is exhausted; formerly it dumped core.
4232 ** When the generated parser lacks debugging code, YYDEBUG is now 0
4233   (as POSIX requires) instead of being undefined.
4235 ** User Actions
4236   Bison has always permitted actions such as { $$ = $1 }: it adds the
4237   ending semicolon.  Now if in Yacc compatibility mode, the semicolon
4238   is no longer output: one has to write { $$ = $1; }.
4240 ** Better C++ compliance
4241   The output parsers try to respect C++ namespaces.
4242   [This turned out to be a failed experiment, and it was reverted later.]
4244 ** Reduced Grammars
4245   Fixed bugs when reporting useless nonterminals.
4247 ** 64 bit hosts
4248   The parsers work properly on 64 bit hosts.
4250 ** Error messages
4251   Some calls to strerror resulted in scrambled or missing error messages.
4253 ** %expect
4254   When the number of shift/reduce conflicts is correct, don't issue
4255   any warning.
4257 ** The verbose report includes the rule line numbers.
4259 ** Rule line numbers are fixed in traces.
4261 ** Swedish translation
4263 ** Parse errors
4264   Verbose parse error messages from the parsers are better looking.
4265   Before: parse error: unexpected `'/'', expecting `"number"' or `'-'' or `'(''
4266      Now: parse error: unexpected '/', expecting "number" or '-' or '('
4268 ** Fixed parser memory leaks.
4269   When the generated parser was using malloc to extend its stacks, the
4270   previous allocations were not freed.
4272 ** Fixed verbose output file.
4273   Some newlines were missing.
4274   Some conflicts in state descriptions were missing.
4276 ** Fixed conflict report.
4277   Option -v was needed to get the result.
4279 ** %expect
4280   Was not used.
4281   Mismatches are errors, not warnings.
4283 ** Fixed incorrect processing of some invalid input.
4285 ** Fixed CPP guards: 9foo.h uses BISON_9FOO_H instead of 9FOO_H.
4287 ** Fixed some typos in the documentation.
4289 ** %token MY_EOF 0 is supported.
4290   Before, MY_EOF was silently renumbered as 257.
4292 ** doc/refcard.tex is updated.
4294 ** %output, %file-prefix, %name-prefix.
4295   New.
4297 ** --output
4298   New, aliasing "--output-file".
4301 * Noteworthy changes in release 1.30 (2001-10-26)
4303 ** "--defines" and "--graph" have now an optional argument which is the
4304   output file name. "-d" and "-g" do not change; they do not take any
4305   argument.
4307 ** "%source_extension" and "%header_extension" are removed, failed
4308   experiment.
4310 ** Portability fixes.
4313 * Noteworthy changes in release 1.29 (2001-09-07)
4315 ** The output file does not define const, as this caused problems when used
4316   with common autoconfiguration schemes.  If you still use ancient compilers
4317   that lack const, compile with the equivalent of the C compiler option
4318   "-Dconst=".  Autoconf's AC_C_CONST macro provides one way to do this.
4320 ** Added "-g" and "--graph".
4322 ** The Bison manual is now distributed under the terms of the GNU FDL.
4324 ** The input and the output files has automatically a similar extension.
4326 ** Russian translation added.
4328 ** NLS support updated; should hopefully be less troublesome.
4330 ** Added the old Bison reference card.
4332 ** Added "--locations" and "%locations".
4334 ** Added "-S" and "--skeleton".
4336 ** "%raw", "-r", "--raw" is disabled.
4338 ** Special characters are escaped when output.  This solves the problems
4339   of the #line lines with path names including backslashes.
4341 ** New directives.
4342   "%yacc", "%fixed_output_files", "%defines", "%no_parser", "%verbose",
4343   "%debug", "%source_extension" and "%header_extension".
4345 ** @$
4346   Automatic location tracking.
4349 * Noteworthy changes in release 1.28 (1999-07-06)
4351 ** Should compile better now with K&R compilers.
4353 ** Added NLS.
4355 ** Fixed a problem with escaping the double quote character.
4357 ** There is now a FAQ.
4360 * Noteworthy changes in release 1.27
4362 ** The make rule which prevented bison.simple from being created on
4363   some systems has been fixed.
4366 * Noteworthy changes in release 1.26
4368 ** Bison now uses Automake.
4370 ** New mailing lists: <bug-bison@gnu.org> and <help-bison@gnu.org>.
4372 ** Token numbers now start at 257 as previously documented, not 258.
4374 ** Bison honors the TMPDIR environment variable.
4376 ** A couple of buffer overruns have been fixed.
4378 ** Problems when closing files should now be reported.
4380 ** Generated parsers should now work even on operating systems which do
4381   not provide alloca().
4384 * Noteworthy changes in release 1.25 (1995-10-16)
4386 ** Errors in the input grammar are not fatal; Bison keeps reading
4387 the grammar file, and reports all the errors found in it.
4389 ** Tokens can now be specified as multiple-character strings: for
4390 example, you could use "<=" for a token which looks like <=, instead
4391 of choosing a name like LESSEQ.
4393 ** The %token_table declaration says to write a table of tokens (names
4394 and numbers) into the parser file.  The yylex function can use this
4395 table to recognize multiple-character string tokens, or for other
4396 purposes.
4398 ** The %no_lines declaration says not to generate any #line preprocessor
4399 directives in the parser file.
4401 ** The %raw declaration says to use internal Bison token numbers, not
4402 Yacc-compatible token numbers, when token names are defined as macros.
4404 ** The --no-parser option produces the parser tables without including
4405 the parser engine; a project can now use its own parser engine.
4406 The actions go into a separate file called NAME.act, in the form of
4407 a switch statement body.
4410 * Noteworthy changes in release 1.23
4412 The user can define YYPARSE_PARAM as the name of an argument to be
4413 passed into yyparse.  The argument should have type void *.  It should
4414 actually point to an object.  Grammar actions can access the variable
4415 by casting it to the proper pointer type.
4417 Line numbers in output file corrected.
4420 * Noteworthy changes in release 1.22
4422 --help option added.
4425 * Noteworthy changes in release 1.20
4427 Output file does not redefine const for C++.
4429 -----
4431 LocalWords:  yacc YYBACKUP glr GCC lalr ArrayIndexOutOfBoundsException nullptr
4432 LocalWords:  cplusplus liby rpl fprintf mfcalc Wyacc stmt cond expr mk sym lr
4433 LocalWords:  IELR ielr Lookahead YYERROR nonassoc LALR's api lookaheads yychar
4434 LocalWords:  destructor lookahead YYRHSLOC YYLLOC Rhs ifndef YYFAIL cpp sr rr
4435 LocalWords:  preprocessor initializer Wno Wnone Werror FreeBSD prec livelocks
4436 LocalWords:  Solaris AIX UX RHEL Tru LHS gcc's Wundef YYENABLE NLS YYLTYPE VCG
4437 LocalWords:  yyerror cpp's Wunused yylval yylloc prepend yyparse yylex yypush
4438 LocalWords:  Graphviz xml nonterminals midrule destructor's YYSTYPE typedef ly
4439 LocalWords:  CHR chr printf stdout namespace preprocessing enum pre include's
4440 LocalWords:  YYRECOVERING nonfree destructors YYABORT YYACCEPT params enums de
4441 LocalWords:  struct yystype DJGPP lex param Haible NUM alloca YYSTACK NUL goto
4442 LocalWords:  YYMAXDEPTH Unescaped UCNs YYLTYPE's yyltype typedefs inline Yaccs
4443 LocalWords:  Heriyanto Reenable dprec Hilfinger Eggert MYEOF Folle Menezes EOF
4444 LocalWords:  Lackovic define's itemset Groff Gettext malloc NEWS'ed YYDEBUG YY
4445 LocalWords:  namespaces strerror const autoconfiguration Dconst Autoconf's FDL
4446 LocalWords:  Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
4447 LocalWords:  extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
4448 LocalWords:  lang yyoutput dvi html ps POSIX lvalp llocp Wother nterm arg init
4449 LocalWords:  TOK calc yyo fval Wconflicts parsers yystackp yyval yynerrs
4450 LocalWords:  Théophile Ranquet Santet fno fnone stype associativity Tolmer
4451 LocalWords:  Wprecedence Rassoul Wempty Paolo Bonzini parser's Michiel loc
4452 LocalWords:  redeclaration sval fcaret reentrant XSLT xsl Wmaybe yyvsp Tedi
4453 LocalWords:  pragmas noreturn untyped Rozenman unexpanded Wojciech Polak
4454 LocalWords:  Alexandre MERCHANTABILITY yytype emplace ptr automove lvalues
4455 LocalWords:  nonterminal yy args Pragma dereference yyformat rhs docdir bw
4456 LocalWords:  Redeclarations rpcalc Autoconf YFLAGS Makefiles PROG DECL num
4457 LocalWords:  Heimbigner AST src ast Makefile srcdir MinGW xxlex XXSTYPE
4458 LocalWords:  XXLTYPE strictfp IDEs ffixit fdiagnostics parseable fixits
4459 LocalWords:  Wdeprecated yytext Variadic variadic yyrhs yyphrs RCS README
4460 LocalWords:  noexcept constexpr ispell american deprecations backend Teoh
4461 LocalWords:  YYPRINT Mangold Bonzini's Wdangling exVal baz checkable gcc
4462 LocalWords:  fsanitize Vogelsgesang lis redeclared stdint automata yytname
4463 LocalWords:  yysymbol yytnamerr yyreport ctx ARGMAX yysyntax stderr LPAREN
4464 LocalWords:  symrec yypcontext TOKENMAX yyexpected YYEMPTY yypstate YYEOF
4465 LocalWords:  autocompletion bistromathic submessages Cayuela lexcalc hoc
4466 LocalWords:  yytoken YYUNDEF YYerror basename Automake's UTF ifdef ffile
4467 LocalWords:  gotos readline Imbimbo Wcounterexamples Wcex Nonunifying rcex
4469 Local Variables:
4470 ispell-dictionary: "american"
4471 mode: outline
4472 fill-column: 76
4473 End:
4475 Copyright (C) 1995-2015, 2018-2020 Free Software Foundation, Inc.
4477 This file is part of Bison, the GNU Parser Generator.
4479 Permission is granted to copy, distribute and/or modify this document
4480 under the terms of the GNU Free Documentation License, Version 1.3 or
4481 any later version published by the Free Software Foundation; with no
4482 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
4483 Texts.  A copy of the license is included in the "GNU Free
4484 Documentation License" file as part of this distribution.