3 * Noteworthy changes in release ?.? (????-??-??) [?]
5 Fixed portability issues of the test suite on Solaris.
7 Fixed spurious warnings about input containing `m4_` or `b4_`.
9 * Noteworthy changes in release 3.8.2 (2021-09-25) [stable]
11 Fixed portability issues of bison on Cygwin.
13 Improvements in glr2.cc: add support for custom error messages (`%define
14 parse.error custom`), allow linking several parsers together.
16 * Noteworthy changes in release 3.8.1 (2021-09-11) [stable]
18 The generation of prototypes for yylex and yyerror in Yacc mode is
19 breaking existing grammar files. To avoid breaking too many grammars, the
20 prototypes are now generated when `-y/--yacc` is used *and* the
21 `POSIXLY_CORRECT` environment variable is defined.
23 Avoid using `-y`/`--yacc` simply to comply with Yacc's file name
24 conventions, rather, use `-o y.tab.c`. Autoconf's AC_PROG_YACC macro uses
25 `-y`. Avoid it if possible, for instance by using gnulib's gl_PROG_BISON.
27 * Noteworthy changes in release 3.8 (2021-09-07) [stable]
29 ** Backward incompatible changes
31 In conformance with the recommendations of the Graphviz team
32 (https://marc.info/?l=graphviz-devel&m=129418103126092), `-g`/`--graph`
33 now generates a *.gv file by default, instead of *.dot. A transition
36 To comply with the latest POSIX standard, in Yacc compatibility mode
37 (options `-y`/`--yacc`) Bison now generates prototypes for yyerror and
38 yylex. In some situations, this is breaking compatibility: if the user
39 has already declared these functions but with some differences (e.g., to
40 declare them as static, or to use specific attributes), the generated
41 parser will fail to compile. To disable these prototypes, #define yyerror
42 (to `yyerror`), and likewise for yylex.
44 ** Deprecated features
46 Support for the YYPRINT macro is removed. It worked only with yacc.c and
47 only for tokens. It was obsoleted by %printer, introduced in Bison 1.50
50 It has always been recommended to prefer `%define api.value.type foo` to
51 `#define YYSTYPE foo`. The latter is supported in C for compatibility
52 with Yacc, but not in C++. Warnings are now issued if `#define YYSTYPE`
53 is used in C++, and eventually support will be removed.
55 In C++ code, prefer value_type to semantic_type to denote the semantic
56 value type, which is specified by the `api.value.type` %define variable.
60 *** A skeleton for the D programming language
62 The "lalr1.d" skeleton is now officially part of Bison.
64 It was originally contributed by Oliver Mangold, based on Paolo Bonzini's
65 lalr1.java, and was improved by H. S. Teoh. Adela Vais then took over
66 maintenance and invested a lot of efforts to complete, test and document
69 It now supports all the bells and whistles of the other deterministic
70 parsers, which include: pull/push interfaces, verbose and custom error
71 messages, lookahead correction, token constructors, internationalization,
72 locations, printers, token and symbol prefixes, etc.
74 Two examples demonstrate the D parsers: a basic one (examples/d/simple),
75 and an advanced one (examples/d/calc).
77 *** Option -H, --header and directive %header
79 The option `-H`/`--header` supersedes the option `--defines`, and the
80 directive %header supersedes %defines. Both `--defines` and `%defines`
81 are, of course, maintained for backward compatibility.
85 Since version 2.4 Bison can be used to generate HTML reports. However it
86 was a two-step process: first bison must be invoked with option `--xml`,
87 and then xsltproc must be run to the convert the XML reports into HTML.
89 The new option `--html` combines these steps. The xsltproc program must
92 *** A C++ native GLR parser
94 A new version of the C++ GLR parser was added: "glr2.cc". It generates
95 "true C++11", instead of a C++ wrapper around a C parser as does the
96 existing "glr.cc" parser. As a first significant consequence, it supports
97 `%define api.value.type variant`, contrary to glr.cc.
99 It should be upward compatible in terms of interface, feature and
100 performance to "glr.cc". To try it out, simply use
104 It will eventually replace "glr.cc". However we need user feedback on
105 this skeleton. _Please_ report your results and comments about it.
109 Counterexamples now show the rule numbers, and always show ε for rules
110 with an empty right-hand side. For instance
122 *** Lookahead correction in Java
124 The Java skeleton (lalr1.java) now supports LAC, via the `parse.lac`
127 *** Abort parsing for memory exhaustion (C)
129 User actions may now use `YYNOMEM` (similar to `YYACCEPT` and `YYABORT`)
130 to abort the current parse with memory exhaustion.
132 *** Printing locations in debug traces (C)
134 The `YYLOCATION_PRINT(File, Loc)` macro prints a location. It is defined
135 when (i) locations are enabled, (ii) the default type for locations is
136 used, (iii) debug traces are enabled, and (iv) `YYLOCATION_PRINT` is not
139 Users may define `YYLOCATION_PRINT` to cover other cases.
143 There were no debug traces for deferred calls to user actions. They are
147 * Noteworthy changes in release 3.7.6 (2021-03-08) [stable]
151 *** Reused Push Parsers
153 When a push-parser state structure is used for multiple parses, it was
154 possible for some state to leak from one run into the following one.
156 *** Fix Table Generation
158 In some very rare conditions, when there are many useless tokens, it was
159 possible to generate incorrect parsers.
162 * Noteworthy changes in release 3.7.5 (2021-01-24) [stable]
166 *** Counterexample Generation
168 In some cases counterexample generation could crash. This is fixed.
170 *** Fix Table Generation
172 In some very rare conditions, when there are many useless tokens, it was
173 possible to generate incorrect parsers.
175 *** GLR parsers now support %merge together with api.value.type=union.
177 *** C++ parsers use noexcept in more places.
179 *** Generated parsers avoid some warnings about signedness issues.
181 *** C-language parsers now avoid warnings from pedantic clang.
183 *** C-language parsers now work around quirks of HP-UX 11.23 (2003).
186 * Noteworthy changes in release 3.7.4 (2020-11-14) [stable]
190 *** Bug fixes in yacc.c
192 In Yacc mode, all the tokens are defined twice: once as an enum, and then
193 as a macro. YYEMPTY was missing its macro.
195 *** Bug fixes in lalr1.cc
197 The lalr1.cc skeleton used to emit internal assertions (using YY_ASSERT)
198 even when the `parse.assert` %define variable is not enabled. It no
201 The private internal macro YY_ASSERT now obeys the `api.prefix` %define
204 When there is a very large number of tokens, some assertions could be long
205 enough to hit arbitrary limits in Visual C++. They have been rewritten to
206 work around this limitation.
210 The YYBISON macro in generated "regular C parsers" (from the "yacc.c"
211 skeleton) used to be defined to 1. It is now defined to the version of
212 Bison as an integer (e.g., 30704 for version 3.7.4).
215 * Noteworthy changes in release 3.7.3 (2020-10-13) [stable]
219 Fix concurrent build issues.
221 The bison executable is no longer linked uselessly against libreadline.
223 Fix incorrect use of yytname in glr.cc.
226 * Noteworthy changes in release 3.7.2 (2020-09-05) [stable]
228 This release of Bison fixes all known bugs reported for Bison in MITRE's
229 Common Vulnerabilities and Exposures (CVE) system. These vulnerabilities
230 are only about bison-the-program itself, not the generated code.
232 Although these bugs are typically irrelevant to how Bison is used, they
233 are worth fixing if only to give users peace of mind.
235 There is no known vulnerability in the generated parsers.
239 Fix concurrent build issues (introduced in Bison 3.5).
241 Push parsers always use YYMALLOC/YYFREE (no direct calls to malloc/free).
243 Fix portability issues of the test suite, and of bison itself.
245 Some unlikely crashes found by fuzzing have been fixed. This is only
246 about bison itself, not the generated parsers.
249 * Noteworthy changes in release 3.7.1 (2020-08-02) [stable]
253 Crash when a token alias contains a NUL byte.
255 Portability issues with libtextstyle.
257 Portability issues of Bison itself with MSVC.
261 Improvements and fixes in the documentation.
263 More precise location about symbol type redefinitions.
266 * Noteworthy changes in release 3.7 (2020-07-23) [stable]
268 ** Deprecated features
270 The YYPRINT macro, which works only with yacc.c and only for tokens, was
271 obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
272 It is deprecated and its support will be removed eventually.
274 In conformance with the recommendations of the Graphviz team, in the next
275 version Bison the option `--graph` will generate a *.gv file by default,
276 instead of *.dot. A transition started in Bison 3.4.
280 *** Counterexample Generation
282 Contributed by Vincent Imbimbo.
284 When given `-Wcounterexamples`/`-Wcex`, bison will now output
285 counterexamples for conflicts.
287 **** Unifying Counterexamples
289 Unifying counterexamples are strings which can be parsed in two ways due
290 to the conflict. For example on a grammar that contains the usual
291 "dangling else" ambiguity:
294 else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
295 else.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
298 else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
299 else.y: warning: shift/reduce conflict on token "else" [-Wcounterexamples]
300 Example: "if" exp "then" "if" exp "then" exp • "else" exp
303 ↳ "if" exp "then" exp
304 ↳ "if" exp "then" exp • "else" exp
305 Example: "if" exp "then" "if" exp "then" exp • "else" exp
308 ↳ "if" exp "then" exp "else" exp
309 ↳ "if" exp "then" exp •
311 When text styling is enabled, colors are used in the examples and the
312 derivations to highlight the structure of both analyses. In this case,
314 "if" exp "then" [ "if" exp "then" exp • ] "else" exp
318 "if" exp "then" [ "if" exp "then" exp • "else" exp ]
321 The counterexamples are "focused", in two different ways. First, they do
322 not clutter the output with all the derivations from the start symbol,
323 rather they start on the "conflicted nonterminal". They go straight to the
324 point. Second, they don't "expand" nonterminal symbols uselessly.
326 **** Nonunifying Counterexamples
328 In the case of the dangling else, Bison found an example that can be
329 parsed in two ways (therefore proving that the grammar is ambiguous).
330 When it cannot find such an example, it instead generates two examples
331 that are the same up until the dot:
334 foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
335 foo.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
336 foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
341 foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
342 foo.y: warning: shift/reduce conflict on token ID [-Wcounterexamples]
343 First example: expr • ID ',' ID $end
350 Second example: expr • ID $end
356 foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
360 In these cases, the parser usually doesn't have enough lookahead to
361 differentiate the two given examples.
365 Counterexamples are also included in the report when given
366 `--report=counterexamples`/`-rcex` (or `--report=all`), with more
371 1 exp: "if" exp "then" exp • [$end, "then", "else"]
372 2 | "if" exp "then" exp • "else" exp
374 "else" shift, and go to state 8
376 "else" [reduce using rule 1 (exp)]
377 $default reduce using rule 1 (exp)
379 shift/reduce conflict on token "else":
380 1 exp: "if" exp "then" exp •
381 2 exp: "if" exp "then" exp • "else" exp
382 Example: "if" exp "then" "if" exp "then" exp • "else" exp
385 ↳ "if" exp "then" exp
386 ↳ "if" exp "then" exp • "else" exp
387 Example: "if" exp "then" "if" exp "then" exp • "else" exp
390 ↳ "if" exp "then" exp "else" exp
391 ↳ "if" exp "then" exp •
393 *** File prefix mapping
395 Contributed by Joshua Watt.
397 Bison learned a new argument, `--file-prefix-map OLD=NEW`. Any file path
398 in the output (specifically `#line` directives and `#ifdef` header guards)
399 that begins with the prefix OLD will have it replaced with the prefix NEW,
400 similar to the `-ffile-prefix-map` in GCC. This option can be used to
401 make bison output reproducible.
407 When text styling is enabled and the terminal supports it, the warnings
408 now include hyperlinks to the documentation.
410 *** Relocatable installation
412 When installed to be relocatable (via `configure --enable-relocatable`),
413 bison will now also look for a relocated m4.
417 The `filename_type` %define variable was renamed `api.filename.type`.
420 %define filename_type "symbol"
424 %define api.filename.type {symbol}
426 (Or let `bison --update` do it for you).
428 It now defaults to `const std::string` instead of `std::string`.
430 *** Deprecated %define variable names
432 The following variables have been renamed for consistency. Backward
433 compatibility is ensured, but upgrading is recommended.
435 filename_type -> api.filename.type
436 package -> api.package
438 *** Push parsers no longer clear their state when parsing is finished
440 Previously push-parsers cleared their state when parsing was finished (on
441 success and on failure). This made it impossible to check if there were
442 parse errors, since `yynerrs` was also reset. This can be especially
443 troublesome when used in autocompletion, since a parser with error
444 recovery would suggest (irrelevant) expected tokens even if there were
447 Now the parser state can be examined when parsing is finished. The parser
448 state is reset when starting a new parse.
454 The bistromathic demonstrates %param and how to quote sources in the error
458 1.5-7: syntax error: expected end of file or + or - or * or / or ^ before number
464 *** Include the generated header (yacc.c)
466 Historically, when --defines was used, bison generated a header and pasted
467 an exact copy of it into the generated parser implementation file. Since
468 Bison 3.4 it is possible to specify that the header should be `#include`d,
469 and how. For instance
471 %define api.header.include {"parse.h"}
475 %define api.header.include {<parser/parse.h>}
477 Now api.header.include defaults to `"header-basename"`, as was intended in
478 Bison 3.4, where `header-basename` is the basename of the generated
479 header. This is disabled when the generated header is `y.tab.h`, to
480 comply with Automake's ylwrap.
482 *** String aliases are faithfully propagated
484 Bison used to interpret user strings (i.e., decoding backslash escapes)
485 when reading them, and to escape them (i.e., issue non-printable
486 characters as backslash escapes, taking the locale into account) when
487 outputting them. As a consequence non-ASCII strings (say in UTF-8) ended
488 up "ciphered" as sequences of backslash escapes. This happened not only
489 in the generated sources (where the compiler will reinterpret them), but
490 also in all the generated reports (text, xml, html, dot, etc.). Reports
491 were therefore not readable when string aliases were not pure ASCII.
492 Worse yet: the output depended on the user's locale.
494 Now Bison faithfully treats the string aliases exactly the way the user
495 spelled them. This fixes all the aforementioned problems. However, now,
496 string aliases semantically equivalent but syntactically different (e.g.,
497 "A", "\x41", "\101") are considered to be different.
499 *** Crash when generating IELR
501 An old, well hidden, bug in the generation of IELR parsers was fixed.
504 * Noteworthy changes in release 3.6.4 (2020-06-15) [stable]
508 In glr.cc some internal macros leaked in the user's code, and could damage
509 access to the token kinds.
512 * Noteworthy changes in release 3.6.3 (2020-06-03) [stable]
516 Incorrect comments in the generated parsers.
518 Warnings in push parsers (yacc.c).
520 Incorrect display of gotos in LAC traces (lalr1.cc).
523 * Noteworthy changes in release 3.6.2 (2020-05-17) [stable]
527 Some tests were fixed.
529 When token aliases contain comment delimiters:
531 %token FOO "/* foo */"
533 bison used to emit "nested" comments, which is invalid C.
536 * Noteworthy changes in release 3.6.1 (2020-05-10) [stable]
540 Restored ANSI-C compliance in yacc.c.
542 GNU readline portability issues.
544 In C++, yy::parser::symbol_name is now a public member, as was intended.
548 In C++, yy::parser::symbol_type now has a public name() member function.
551 * Noteworthy changes in release 3.6 (2020-05-08) [stable]
553 ** Backward incompatible changes
555 TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose".
557 The YYERROR_VERBOSE macro is no longer supported; the parsers that still
558 depend on it will now produce Yacc-like error messages (just "syntax
559 error"). It was superseded by the "%error-verbose" directive in Bison
560 1.875 (2003-01-01). Bison 2.6 (2012-07-19) clearly announced that support
561 for YYERROR_VERBOSE would be removed. Note that since Bison 3.0
562 (2013-07-25), "%error-verbose" is deprecated in favor of "%define
563 parse.error verbose".
565 ** Deprecated features
567 The YYPRINT macro, which works only with yacc.c and only for tokens, was
568 obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
569 It is deprecated and its support will be removed eventually.
573 *** Improved syntax error messages
575 Two new values for the %define parse.error variable offer more control to
576 the user. Available in all the skeletons (C, C++, Java).
578 **** %define parse.error detailed
580 The behavior of "%define parse.error detailed" is closely resembling that
581 of "%define parse.error verbose" with a few exceptions. First, it is safe
582 to use non-ASCII characters in token aliases (with 'verbose', the result
583 depends on the locale with which bison was run). Second, a yysymbol_name
584 function is exposed to the user, instead of the yytnamerr function and the
585 yytname table. Third, token internationalization is supported (see
588 **** %define parse.error custom
590 With this directive, the user forges and emits the syntax error message
591 herself by defining the yyreport_syntax_error function. A new type,
592 yypcontext_t, captures the circumstances of the error, and provides the
593 user with functions to get details, such as yypcontext_expected_tokens to
594 get the list of expected token kinds.
596 A possible implementation of yyreport_syntax_error is:
599 yyreport_syntax_error (const yypcontext_t *ctx)
602 YY_LOCATION_PRINT (stderr, *yypcontext_location (ctx));
603 fprintf (stderr, ": syntax error");
604 // Report the tokens expected at this point.
606 enum { TOKENMAX = 10 };
607 yysymbol_kind_t expected[TOKENMAX];
608 int n = yypcontext_expected_tokens (ctx, expected, TOKENMAX);
610 // Forward errors to yyparse.
613 for (int i = 0; i < n; ++i)
614 fprintf (stderr, "%s %s",
615 i == 0 ? ": expected" : " or", yysymbol_name (expected[i]));
617 // Report the unexpected token.
619 yysymbol_kind_t lookahead = yypcontext_token (ctx);
620 if (lookahead != YYSYMBOL_YYEMPTY)
621 fprintf (stderr, " before %s", yysymbol_name (lookahead));
623 fprintf (stderr, "\n");
627 **** Token aliases internationalization
629 When the %define variable parse.error is set to `custom` or `detailed`,
630 one may specify which token aliases are to be translated using _(). For
642 In that case the user must define _() and N_(), and yysymbol_name returns
643 the translated symbol (i.e., it returns '_("variable")' rather that
644 '"variable"'). In Java, the user must provide an i18n() function.
646 *** List of expected tokens (yacc.c)
648 Push parsers may invoke yypstate_expected_tokens at any point during
649 parsing (including even before submitting the first token) to get the list
650 of possible tokens. This feature can be used to propose autocompletion
651 (see below the "bistromathic" example).
653 It makes little sense to use this feature without enabling LAC (lookahead
656 *** Returning the error token
658 When the scanner returns an invalid token or the undefined token
659 (YYUNDEF), the parser generates an error message and enters error
660 recovery. Because of that error message, most scanners that find lexical
661 errors generate an error message, and then ignore the invalid input
662 without entering the error-recovery.
664 The scanners may now return YYerror, the error token, to enter the
665 error-recovery mode without triggering an additional error message. See
666 the bistromathic for an example.
668 *** Deep overhaul of the symbol and token kinds
670 To avoid the confusion with types in programming languages, we now refer
671 to token and symbol "kinds" instead of token and symbol "types". The
672 documentation and error messages have been revised.
674 All the skeletons have been updated to use dedicated enum types rather
675 than integral types. Special symbols are now regular citizens, instead of
676 being declared in ad hoc ways.
680 The "token kind" is what is returned by the scanner, e.g., PLUS, NUMBER,
681 LPAREN, etc. While backward compatibility is of course ensured, users are
682 nonetheless invited to replace their uses of "enum yytokentype" by
685 This type now also includes tokens that were previously hidden: YYEOF (end
686 of input), YYUNDEF (undefined token), and YYerror (error token). They
687 now have string aliases, internationalized when internationalization is
688 enabled. Therefore, by default, error messages now refer to "end of file"
689 (internationalized) rather than the cryptic "$end", or to "invalid token"
690 rather than "$undefined".
692 Therefore in most cases it is now useless to define the end-of-line token
695 %token T_EOF 0 "end of file"
697 Rather simply use "YYEOF" in your scanner.
701 The "symbol kinds" is what the parser actually uses. (Unless the
702 api.token.raw %define variable is used, the symbol kind of a terminal
703 differs from the corresponding token kind.)
705 They are now exposed as a enum, "yysymbol_kind_t".
707 This allows users to tailor the error messages the way they want, or to
708 process some symbols in a specific way in autocompletion (see the
709 bistromathic example below).
711 *** Modernize display of explanatory statements in diagnostics
713 Since Bison 2.7, output was indented four spaces for explanatory
714 statements. For example:
716 input.y:2.7-13: error: %type redeclaration for exp
717 input.y:1.7-11: previous declaration
719 Since the introduction of caret-diagnostics, it became less clear. This
720 indentation has been removed and submessages are displayed similarly as in
723 input.y:2.7-13: error: %type redeclaration for exp
724 2 | %type <float> exp
726 input.y:1.7-11: note: previous declaration
730 Contributed by Victor Morales Cayuela.
734 The token and symbol kinds are yy::parser::token_kind_type and
735 yy::parser::symbol_kind_type.
737 The symbol_type::kind() member function allows to get the kind of a
738 symbol. This can be used to write unit tests for scanners, e.g.,
740 yy::parser::symbol_type t = make_NUMBER ("123");
741 assert (t.kind () == yy::parser::symbol_kind::S_NUMBER);
742 assert (t.value.as<int> () == 123);
748 In order to avoid ambiguities with "type" as in "typing", we now refer to
749 the "token kind" (e.g., `PLUS`, `NUMBER`, etc.) rather than the "token
750 type". We now also refer to the "symbol type" (e.g., `PLUS`, `expr`,
755 There are now examples/java: a very simple calculator, and a more complete
756 one (push-parser, location tracking, and debug traces).
758 The lexcalc example (a simple example in C based on Flex and Bison) now
759 also demonstrates location tracking.
762 A new C example, bistromathic, is a fully featured interactive calculator
763 using many Bison features: pure interface, push parser, autocompletion
764 based on the current parser state (using yypstate_expected_tokens),
765 location tracking, internationalized custom error messages, lookahead
766 correction, rich debug traces, etc.
768 It shows how to depend on the symbol kinds to tailor autocompletion. For
769 instance it recognizes the symbol kind "VARIABLE" to propose
770 autocompletion on the existing variables, rather than of the word
774 * Noteworthy changes in release 3.5.4 (2020-04-05) [stable]
776 ** WARNING: Future backward-incompatibilities!
778 TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose".
780 Bison 3.6 will no longer support the YYERROR_VERBOSE macro; the parsers
781 that still depend on it will produce Yacc-like error messages (just
782 "syntax error"). It was superseded by the "%error-verbose" directive in
783 Bison 1.875 (2003-01-01). Bison 2.6 (2012-07-19) clearly announced that
784 support for YYERROR_VERBOSE would be removed. Note that since Bison 3.0
785 (2013-07-25), "%error-verbose" is deprecated in favor of "%define
786 parse.error verbose".
790 Fix portability issues of the package itself on old compilers.
792 Fix api.token.raw support in Java.
795 * Noteworthy changes in release 3.5.3 (2020-03-08) [stable]
799 Error messages could quote lines containing zero-width characters (such as
800 \005) with incorrect styling. Fixes for similar issues with unexpectedly
801 short lines (e.g., the file was changed between parsing and diagnosing).
803 Some unlikely crashes found by fuzzing have been fixed. This is only
804 about bison itself, not the generated parsers.
807 * Noteworthy changes in release 3.5.2 (2020-02-13) [stable]
811 Portability issues and minor cosmetic issues.
813 The lalr1.cc skeleton properly rejects unsupported values for parse.lac
817 * Noteworthy changes in release 3.5.1 (2020-01-19) [stable]
823 Fix compiler warnings.
826 * Noteworthy changes in release 3.5 (2019-12-11) [stable]
828 ** Backward incompatible changes
830 Lone carriage-return characters (aka \r or ^M) in the grammar files are no
831 longer treated as end-of-lines. This changes the diagnostics, and in
832 particular their locations.
834 In C++, line numbers and columns are now represented as 'int' not
835 'unsigned', so that integer overflow on positions is easily checkable via
836 'gcc -fsanitize=undefined' and the like. This affects the API for
837 positions. The default position and location classes now expose
838 'counter_type' (int), used to define line and column numbers.
840 ** Deprecated features
842 The YYPRINT macro, which works only with yacc.c and only for tokens, was
843 obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
844 It is deprecated and its support will be removed eventually.
848 *** Lookahead correction in C++
850 Contributed by Adrian Vogelsgesang.
852 The C++ deterministic skeleton (lalr1.cc) now supports LAC, via the
853 %define variable parse.lac.
855 *** Variable api.token.raw: Optimized token numbers (all skeletons)
857 In the generated parsers, tokens have two numbers: the "external" token
858 number as returned by yylex (which starts at 257), and the "internal"
859 symbol number (which starts at 3). Each time yylex is called, a table
860 lookup maps the external token number to the internal symbol number.
862 When the %define variable api.token.raw is set, tokens are assigned their
863 internal number, which saves one table lookup per token, and also saves
864 the generation of the mapping table.
866 The gain is typically moderate, but in extreme cases (very simple user
867 actions), a 10% improvement can be observed.
869 *** Generated parsers use better types for states
871 Stacks now use the best integral type for state numbers, instead of always
872 using 15 bits. As a result "small" parsers now have a smaller memory
873 footprint (they use 8 bits), and there is support for large automata (16
874 bits), and extra large (using int, i.e., typically 31 bits).
876 *** Generated parsers prefer signed integer types
878 Bison skeletons now prefer signed to unsigned integer types when either
879 will do, as the signed types are less error-prone and allow for better
880 checking with 'gcc -fsanitize=undefined'. Also, the types chosen are now
881 portable to unusual machines where char, short and int are all the same
882 width. On non-GNU platforms this may entail including <limits.h> and (if
883 available) <stdint.h> to define integer types and constants.
885 *** A skeleton for the D programming language
887 For the last few releases, Bison has shipped a stealth experimental
888 skeleton: lalr1.d. It was first contributed by Oliver Mangold, based on
889 Paolo Bonzini's lalr1.java, and was cleaned and improved thanks to
892 However, because nobody has committed to improving, testing, and
893 documenting this skeleton, it is not clear that it will be supported in
896 The lalr1.d skeleton *is functional*, and works well, as demonstrated in
897 examples/d/calc.d. Please try it, enjoy it, and... commit to support it.
899 *** Debug traces in Java
901 The Java backend no longer emits code and data for parser tracing if the
902 %define variable parse.trace is not defined.
906 *** New diagnostic: -Wdangling-alias
908 String literals, which allow for better error messages, are (too)
909 liberally accepted by Bison, which might result in silent errors. For
912 %type <exVal> cond "condition"
914 does not define "condition" as a string alias to 'cond' (nonterminal
915 symbols do not have string aliases). It is rather equivalent to
918 %token <exVal> "condition"
920 i.e., it gives the type 'exVal' to the "condition" token, which was
921 clearly not the intention.
923 Also, because string aliases need not be defined, typos such as "baz"
924 instead of "bar" will be not reported.
926 The option `-Wdangling-alias` catches these situations. On
929 %type <ival> foo "foo"
933 bison -Wdangling-alias reports
935 warning: string literal not attached to a symbol
936 | %type <ival> foo "foo"
938 warning: string literal not attached to a symbol
942 The `-Wall` option does not (yet?) include `-Wdangling-alias`.
944 *** Better POSIX Yacc compatibility diagnostics
946 POSIX Yacc restricts %type to nonterminals. This is now diagnosed by
950 %type <ival> TOKEN1 TOKEN2 't'
957 input.y:2.15-20: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
958 2 | %type <ival> TOKEN1 TOKEN2 't'
960 input.y:2.29-31: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
961 2 | %type <ival> TOKEN1 TOKEN2 't'
963 input.y:2.22-27: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
964 2 | %type <ival> TOKEN1 TOKEN2 't'
967 *** Diagnostics with insertion
969 The diagnostics now display the suggestion below the underlined source.
970 Replacement for undeclared symbols are now also suggested.
977 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'?
981 foo.y:2.16: warning: empty rule without %empty [-Wempty-rule]
985 foo.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
987 *** Diagnostics about long lines
989 Quoted sources may now be truncated to fit the screen. For instance, on a
990 30-column wide terminal:
997 foo.y:1.34-36: warning: symbol FOO redeclared [-Wother]
1000 foo.y:1.8-10: previous declaration
1003 foo.y:1.62-64: warning: symbol FOO redeclared [-Wother]
1006 foo.y:1.8-10: previous declaration
1012 *** Debugging glr.c and glr.cc
1014 The glr.c skeleton always had asserts to check its own behavior (not the
1015 user's). These assertions are now under the control of the parse.assert
1016 %define variable (disabled by default).
1020 Several new compiler warnings in the generated output have been avoided.
1021 Some unused features are no longer emitted. Cleaner generated code in
1026 Portability issues in the test suite.
1028 In theory, parsers using %nonassoc could crash when reporting verbose
1029 error messages. This unlikely bug has been fixed.
1031 In Java, %define api.prefix was ignored. It now behaves as expected.
1034 * Noteworthy changes in release 3.4.2 (2019-09-12) [stable]
1038 In some cases, when warnings are disabled, bison could emit tons of white
1039 spaces as diagnostics.
1041 When running out of memory, bison could crash (found by fuzzing).
1043 When defining twice the EOF token, bison would crash.
1045 New warnings from recent compilers have been addressed in the generated
1046 parsers (yacc.c, glr.c, glr.cc).
1048 When lone carriage-return characters appeared in the input file,
1049 diagnostics could hang forever.
1052 * Noteworthy changes in release 3.4.1 (2019-05-22) [stable]
1059 * Noteworthy changes in release 3.4 (2019-05-19) [stable]
1061 ** Deprecated features
1063 The %pure-parser directive is deprecated in favor of '%define api.pure'
1064 since Bison 2.3b (2008-05-27), but no warning was issued; there is one
1065 now. Note that since Bison 2.7 you are strongly encouraged to use
1066 '%define api.pure full' instead of '%define api.pure'.
1070 *** Colored diagnostics
1072 As an experimental feature, diagnostics are now colored, controlled by the
1073 new options --color and --style.
1075 To use them, install the libtextstyle library before configuring Bison.
1076 It is available from
1078 https://alpha.gnu.org/gnu/gettext/
1082 https://alpha.gnu.org/gnu/gettext/libtextstyle-0.8.tar.gz
1084 The option --color supports the following arguments:
1085 - always, yes: Enable colors.
1086 - never, no: Disable colors.
1087 - auto, tty (default): Enable colors if the output device is a tty.
1089 To customize the styles, create a CSS file similar to
1093 .error { font-weight: 800; text-decoration: underline; }
1096 then invoke bison with --style=bison-bw.css, or set the BISON_STYLE
1097 environment variable to "bison-bw.css".
1099 *** Disabling output
1101 When given -fsyntax-only, the diagnostics are reported, but no output is
1104 The name of this option is somewhat misleading as bison does more than
1105 just checking the syntax: every stage is run (including checking for
1106 conflicts for instance), except the generation of the output files.
1108 *** Include the generated header (yacc.c)
1110 Before, when --defines is used, bison generated a header, and pasted an
1111 exact copy of it into the generated parser implementation file. If the
1112 header name is not "y.tab.h", it is now #included instead of being
1115 To use an '#include' even if the header name is "y.tab.h" (which is what
1116 happens with --yacc, or when using the Autotools' ylwrap), define
1117 api.header.include to the exact argument to pass to #include. For
1120 %define api.header.include {"parse.h"}
1124 %define api.header.include {<parser/parse.h>}
1126 *** api.location.type is now supported in C (yacc.c, glr.c)
1128 The %define variable api.location.type defines the name of the type to use
1129 for locations. When defined, Bison no longer defines YYLTYPE.
1131 This can be used in programs with several parsers to factor their
1132 definition of locations: let one of them generate them, and the others
1139 In conformance with the recommendations of the Graphviz team, if %require
1140 "3.4" (or better) is specified, the option --graph generates a *.gv file
1141 by default, instead of *.dot.
1143 *** Diagnostics overhaul
1145 Column numbers were wrong with multibyte characters, which would also
1146 result in skewed diagnostics with carets. Beside, because we were
1147 indenting the quoted source with a single space, lines with tab characters
1148 were incorrectly underlined.
1150 To address these issues, and to be clearer, Bison now issues diagnostics
1151 as GCC9 does. For instance it used to display (there's a tab before the
1154 foo.y:3.37-38: error: $2 of ‘expr’ has no declared type
1155 expr: expr '+' "number" { $$ = $1 + $2; }
1159 foo.y:3.37-38: error: $2 of ‘expr’ has no declared type
1160 3 | expr: expr '+' "number" { $$ = $1 + $2; }
1163 Other constructs now also have better locations, resulting in more precise
1166 *** Fix-it hints for %empty
1168 Running Bison with -Wempty-rules and --update will remove incorrect %empty
1169 annotations, and add the missing ones.
1171 *** Generated reports
1173 The format of the reports (parse.output) was improved for readability.
1175 *** Better support for --no-line.
1177 When --no-line is used, the generated files are now cleaner: no lines are
1178 generated instead of empty lines. Together with using api.header.include,
1179 that should help people saving the generated files into version control
1180 systems get smaller diffs.
1184 A new example in C shows an simple infix calculator with a hand-written
1185 scanner (examples/c/calc).
1187 A new example in C shows a reentrant parser (capable of recursive calls)
1188 built with Flex and Bison (examples/c/reccalc).
1190 There is a new section about the history of Yaccs and Bison.
1194 A few obscure bugs were fixed, including the second oldest (known) bug in
1195 Bison: it was there when Bison was entered in the RCS version control
1196 system, in December 1987. See the NEWS of Bison 3.3 for the previous
1200 * Noteworthy changes in release 3.3.2 (2019-02-03) [stable]
1204 Bison 3.3 failed to generate parsers for grammars with unused nonterminal
1208 * Noteworthy changes in release 3.3.1 (2019-01-27) [stable]
1212 The option -y/--yacc used to imply -Werror=yacc, which turns uses of Bison
1213 extensions into errors. It now makes them simple warnings (-Wyacc).
1216 * Noteworthy changes in release 3.3 (2019-01-26) [stable]
1218 A new mailing list was created, Bison Announce. It is low traffic, and is
1219 only about announcing new releases and important messages (e.g., polls
1220 about major decisions to make).
1222 https://lists.gnu.org/mailman/listinfo/bison-announce
1224 ** Backward incompatible changes
1226 Support for DJGPP, which has been unmaintained and untested for years, is
1229 ** Deprecated features
1231 A new feature, --update (see below) helps adjusting existing grammars to
1234 *** Deprecated directives
1236 The %error-verbose directive is deprecated in favor of '%define
1237 parse.error verbose' since Bison 3.0, but no warning was issued.
1239 The '%name-prefix "xx"' directive is deprecated in favor of '%define
1240 api.prefix {xx}' since Bison 3.0, but no warning was issued. These
1241 directives are slightly different, you might need to adjust your code.
1242 %name-prefix renames only symbols with external linkage, while api.prefix
1243 also renames types and macros, including YYDEBUG, YYTOKENTYPE,
1244 yytokentype, YYSTYPE, YYLTYPE, etc.
1246 Users of Flex that move from '%name-prefix "xx"' to '%define api.prefix
1247 {xx}' will typically have to update YY_DECL from
1249 #define YY_DECL int xxlex (YYSTYPE *yylval, YYLTYPE *yylloc)
1253 #define YY_DECL int xxlex (XXSTYPE *yylval, XXLTYPE *yylloc)
1255 *** Deprecated %define variable names
1257 The following variables, mostly related to parsers in Java, have been
1258 renamed for consistency. Backward compatibility is ensured, but upgrading
1261 abstract -> api.parser.abstract
1262 annotations -> api.parser.annotations
1263 extends -> api.parser.extends
1264 final -> api.parser.final
1265 implements -> api.parser.implements
1266 parser_class_name -> api.parser.class
1267 public -> api.parser.public
1268 strictfp -> api.parser.strictfp
1272 *** Generation of fix-its for IDEs/Editors
1274 When given the new option -ffixit (aka -fdiagnostics-parseable-fixits),
1275 bison now generates machine readable editing instructions to fix some
1276 issues. Currently, this is mostly limited to updating deprecated
1277 directives and removing duplicates. For instance:
1281 %define parser_class_name "Parser"
1282 %define api.parser.class "Parser"
1286 See the "fix-it:" lines below:
1288 $ bison -ffixit foo.y
1289 foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated]
1292 fix-it:"foo.y":{1:1-1:15}:"%define parse.error verbose"
1293 foo.y:2.1-34: warning: deprecated directive, use '%define api.parser.class {Parser}' [-Wdeprecated]
1294 %define parser_class_name "Parser"
1295 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1296 fix-it:"foo.y":{2:1-2:35}:"%define api.parser.class {Parser}"
1297 foo.y:3.1-33: error: %define variable 'api.parser.class' redefined
1298 %define api.parser.class "Parser"
1299 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1300 foo.y:2.1-34: previous definition
1301 %define parser_class_name "Parser"
1302 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1303 fix-it:"foo.y":{3:1-3:34}:""
1304 foo.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
1306 This uses the same output format as GCC and Clang.
1308 *** Updating grammar files
1310 Fixes can be applied on the fly. The previous example ends with the
1311 suggestion to re-run bison with the option -u/--update, which results in a
1312 cleaner grammar file.
1314 $ bison --update foo.y
1316 bison: file 'foo.y' was updated (backup: 'foo.y~')
1319 %define parse.error verbose
1320 %define api.parser.class {Parser}
1324 *** Bison is now relocatable
1326 If you pass '--enable-relocatable' to 'configure', Bison is relocatable.
1328 A relocatable program can be moved or copied to a different location on
1329 the file system. It can also be used through mount points for network
1330 sharing. It is possible to make symbolic links to the installed and moved
1331 programs, and invoke them through the symbolic link.
1333 *** %expect and %expect-rr modifiers on individual rules
1335 One can now document (and check) which rules participate in shift/reduce
1336 and reduce/reduce conflicts. This is particularly important GLR parsers,
1337 where conflicts are a normal occurrence. For example,
1353 | argument_list ',' expression
1358 Looking at the output from -v, one can see that the shift/reduce conflict
1359 here is due to the fact that the parser does not know whether to reduce
1360 arguments to argument_list until it sees the token _after_ the following
1361 ','. By marking the rule with %expect 1 (because there is a conflict in
1362 one state), we document the source of the 1 overall shift/reduce conflict.
1364 In GLR parsers, we can use %expect-rr in a rule for reduce/reduce
1365 conflicts. In this case, we mark each of the conflicting rules. For
1374 target_list '=' expr ';'
1380 | target ',' target_list
1389 | expr ',' expr_list
1397 In a statement such as
1401 the parser must reduce x to a target or an expr, but does not know which
1402 until it sees the '='. So we notate the two possible reductions to
1403 indicate that each conflicts in one rule.
1405 This feature needs user feedback, and might evolve in the future.
1407 *** C++: Actual token constructors
1409 When variants and token constructors are enabled, in addition to the
1410 type-safe named token constructors (make_ID, make_INT, etc.), we now
1411 generate genuine constructors for symbol_type.
1413 For instance with these declarations
1419 you may use these constructors:
1421 symbol_type (int token, const std::string&);
1422 symbol_type (int token, const int&);
1423 symbol_type (int token);
1425 Correct matching between token types and value types is checked via
1426 'assert'; for instance, 'symbol_type (ID, 42)' would abort. Named
1427 constructors are preferable, as they offer better type safety (for
1428 instance 'make_ID (42)' would not even compile), but symbol_type
1429 constructors may help when token types are discovered at run-time, e.g.,
1432 if (auto i = lookup_keyword (yytext))
1433 return yy::parser::symbol_type (i);
1435 return yy::parser::make_ID (yytext);
1438 *** C++: Variadic emplace
1440 If your application requires C++11 and you don't use symbol constructors,
1441 you may now use a variadic emplace for semantic values:
1443 %define api.value.type variant
1444 %token <std::pair<int, int>> PAIR
1448 int yylex (parser::semantic_type *lvalp)
1450 lvalp->emplace <std::pair<int, int>> (1, 2);
1451 return parser::token::PAIR;
1454 *** C++: Syntax error exceptions in GLR
1456 The glr.cc skeleton now supports syntax_error exceptions thrown from user
1457 actions, or from the scanner.
1459 *** More POSIX Yacc compatibility warnings
1461 More Bison specific directives are now reported with -y or -Wyacc. This
1462 change was ready since the release of Bison 3.0 in September 2015. It was
1463 delayed because Autoconf used to define YACC as `bison -y`, which resulted
1464 in numerous warnings for Bison users that use the GNU Build System.
1466 If you still experience that problem, either redefine YACC as `bison -o
1467 y.tab.c`, or pass -Wno-yacc to Bison.
1469 *** The tables yyrhs and yyphrs are back
1471 Because no Bison skeleton uses them, these tables were removed (no longer
1472 passed to the skeletons, not even computed) in 2008. However, some users
1473 have expressed interest in being able to use them in their own skeletons.
1477 *** Incorrect number of reduce/reduce conflicts
1479 On a grammar such as
1481 exp: "num" | "num" | "num"
1483 bison used to report a single RR conflict, instead of two. This is now
1484 fixed. This was the oldest (known) bug in Bison: it was there when Bison
1485 was entered in the RCS version control system, in December 1987.
1487 Some grammar files might have to adjust their %expect-rr.
1489 *** Parser directives that were not careful enough
1491 Passing invalid arguments to %nterm, for instance character literals, used
1492 to result in unclear error messages.
1496 The examples/ directory (installed in .../share/doc/bison/examples) has
1497 been restructured per language for clarity. The examples come with a
1498 README and a Makefile. Not only can they be used to toy with Bison, they
1499 can also be starting points for your own grammars.
1501 There is now a Java example, and a simple example in C based on Flex and
1502 Bison (examples/c/lexcalc/).
1508 They now use noexcept and constexpr. Please, report missing annotations.
1510 *** Symbol Declarations
1512 The syntax of the variation directives to declare symbols was overhauled
1513 for more consistency, and also better POSIX Yacc compliance (which, for
1514 instance, allows "%type" without actually providing a type). The %nterm
1515 directive, supported by Bison since its inception, is now documented and
1516 officially supported.
1518 The syntax is now as follows:
1520 %token TAG? ( ID NUMBER? STRING? )+ ( TAG ( ID NUMBER? STRING? )+ )*
1521 %left TAG? ( ID NUMBER? )+ ( TAG ( ID NUMBER? )+ )*
1522 %type TAG? ( ID | CHAR | STRING )+ ( TAG ( ID | CHAR | STRING )+ )*
1523 %nterm TAG? ID+ ( TAG ID+ )*
1525 where TAG denotes a type tag such as ‘<ival>’, ID denotes an identifier
1526 such as ‘NUM’, NUMBER a decimal or hexadecimal integer such as ‘300’ or
1527 ‘0x12d’, CHAR a character literal such as ‘'+'’, and STRING a string
1528 literal such as ‘"number"’. The post-fix quantifiers are ‘?’ (zero or
1529 one), ‘*’ (zero or more) and ‘+’ (one or more).
1532 * Noteworthy changes in release 3.2.4 (2018-12-24) [stable]
1536 Fix the move constructor of symbol_type.
1538 Always provide a copy constructor for symbol_type, even in modern C++.
1541 * Noteworthy changes in release 3.2.3 (2018-12-18) [stable]
1545 Properly support token constructors in C++ with types that include commas
1546 (e.g., std::pair<int, int>). A regression introduced in Bison 3.2.
1549 * Noteworthy changes in release 3.2.2 (2018-11-21) [stable]
1553 C++ portability issues.
1556 * Noteworthy changes in release 3.2.1 (2018-11-09) [stable]
1560 Several portability issues have been fixed in the build system, in the
1561 test suite, and in the generated parsers in C++.
1564 * Noteworthy changes in release 3.2 (2018-10-29) [stable]
1566 ** Backward incompatible changes
1568 Support for DJGPP, which has been unmaintained and untested for years, is
1569 obsolete. Unless there is activity to revive it, it will be removed.
1573 %printers should use yyo rather than yyoutput to denote the output stream.
1575 Variant-based symbols in C++ should use emplace() rather than build().
1577 In C++ parsers, parser::operator() is now a synonym for the parser::parse.
1581 A new section, "A Simple C++ Example", is a tutorial for parsers in C++.
1583 A comment in the generated code now emphasizes that users should not
1584 depend upon non-documented implementation details, such as macros starting
1589 *** C++: Support for move semantics (lalr1.cc)
1591 The lalr1.cc skeleton now fully supports C++ move semantics, while
1592 maintaining compatibility with C++98. You may now store move-only types
1593 when using Bison's variants. For instance:
1600 %skeleton "lalr1.cc"
1601 %define api.value.type variant
1605 %token <int> INT "int";
1606 %type <std::unique_ptr<int>> int;
1607 %type <std::vector<std::unique_ptr<int>>> list;
1611 | list int { $$ = std::move($1); $$.emplace_back(std::move($2)); }
1613 int: "int" { $$ = std::make_unique<int>($1); }
1615 *** C++: Implicit move of right-hand side values (lalr1.cc)
1617 In modern C++ (C++11 and later), you should always use 'std::move' with
1618 the values of the right-hand side symbols ($1, $2, etc.), as they will be
1619 popped from the stack anyway. Using 'std::move' is mandatory for
1620 move-only types such as unique_ptr, and it provides a significant speedup
1621 for large types such as std::string, or std::vector, etc.
1623 If '%define api.value.automove' is set, every occurrence '$n' is replaced
1624 by 'std::move ($n)'. The second rule in the previous grammar can be
1627 list: list int { $$ = $1; $$.emplace_back($2); }
1629 With automove enabled, the semantic values are no longer lvalues, so do
1630 not use the swap idiom:
1632 list: list int { std::swap($$, $1); $$.emplace_back($2); }
1634 This idiom is anyway obsolete: it is preferable to move than to swap.
1636 A warning is issued when automove is enabled, and a value is used several
1639 input.yy:16.31-32: warning: multiple occurrences of $2 with api.value.automove enabled [-Wother]
1640 exp: "twice" exp { $$ = $2 + $2; }
1643 Enabling api.value.automove does not require support for modern C++. The
1644 generated code is valid C++98/03, but will use copies instead of moves.
1646 The new examples/c++/variant-11.yy shows these features in action.
1648 *** C++: The implicit default semantic action is always run
1650 When variants are enabled, the default action was not run, so
1658 It now behaves like in all the other cases, as
1660 exp: "number" { $$ = $1; }
1662 possibly using std::move if automove is enabled.
1664 We do not expect backward compatibility issues. However, beware of
1665 forward compatibility issues: if you rely on default actions with
1666 variants, be sure to '%require "3.2"' to avoid older versions of Bison to
1667 generate incorrect parsers.
1669 *** C++: Renaming location.hh
1671 When both %defines and %locations are enabled, Bison generates a
1672 location.hh file. If you don't use locations outside of the parser, you
1673 may avoid its creation with:
1675 %define api.location.file none
1677 However this file is useful if, for instance, your parser builds an AST
1678 decorated with locations: you may use Bison's location independently of
1679 Bison's parser. You can now give it another name, for instance:
1681 %define api.location.file "my-location.hh"
1683 This name can have directory components, and even be absolute. The name
1684 under which the location file is included is controlled by
1685 api.location.include.
1687 This way it is possible to have several parsers share the same location
1690 For instance, in src/foo/parser.hh, generate the include/ast/loc.hh file:
1693 %define api.namespace {foo}
1694 %define api.location.file "include/ast/loc.hh"
1695 %define api.location.include {<ast/loc.hh>}
1697 and use it in src/bar/parser.hh:
1700 %define api.namespace {bar}
1701 %code requires {#include <ast/loc.hh>}
1702 %define api.location.type {bar::location}
1704 Absolute file names are supported, so in your Makefile, passing the flag
1705 -Dapi.location.file='"$(top_srcdir)/include/ast/location.hh"' to bison is
1708 *** C++: stack.hh and position.hh are deprecated
1710 When asked to generate a header file (%defines), the lalr1.cc skeleton
1711 generates a stack.hh file. This file had no interest for users; it is now
1712 made useless: its content is included in the parser definition. It is
1713 still generated for backward compatibility.
1715 When in addition to %defines, location support is requested (%locations),
1716 the file position.hh is also generated. It is now also useless: its
1717 content is now included in location.hh.
1719 These files are no longer generated when your grammar file requires at
1720 least Bison 3.2 (%require "3.2").
1724 Portability issues on MinGW and VS2015.
1726 Portability issues in the test suite.
1728 Portability/warning issues with Flex.
1731 * Noteworthy changes in release 3.1 (2018-08-27) [stable]
1733 ** Backward incompatible changes
1735 Compiling Bison now requires a C99 compiler---as announced during the
1736 release of Bison 3.0, five years ago. Generated parsers do not require a
1739 Support for DJGPP, which has been unmaintained and untested for years, is
1740 obsolete. Unless there is activity to revive it, the next release of Bison
1741 will have it removed.
1745 *** Typed midrule actions
1747 Because their type is unknown to Bison, the values of midrule actions are
1748 not treated like the others: they don't have %printer and %destructor
1749 support. It also prevents C++ (Bison) variants to handle them properly.
1751 Typed midrule actions address these issues. Instead of:
1753 exp: { $<ival>$ = 1; } { $<ival>$ = 2; } { $$ = $<ival>1 + $<ival>2; }
1757 exp: <ival>{ $$ = 1; } <ival>{ $$ = 2; } { $$ = $1 + $2; }
1759 *** Reports include the type of the symbols
1761 The sections about terminal and nonterminal symbols of the '*.output' file
1762 now specify their declared type. For instance, for:
1766 the report now shows '<ival>':
1768 Terminals, with rules where they appear
1772 *** Diagnostics about useless rules
1774 In the following grammar, the 'exp' nonterminal is trivially useless. So,
1775 of course, its rules are useless too.
1779 exp: exp '+' exp | exp '-' exp | '(' exp ')'
1781 Previously all the useless rules were reported, including those whose
1782 left-hand side is the 'exp' nonterminal:
1784 warning: 1 nonterminal useless in grammar [-Wother]
1785 warning: 4 rules useless in grammar [-Wother]
1786 2.14-16: warning: nonterminal useless in grammar: exp [-Wother]
1789 2.14-16: warning: rule useless in grammar [-Wother]
1792 3.6-16: warning: rule useless in grammar [-Wother]
1793 exp: exp '+' exp | exp '-' exp | '(' exp ')'
1795 3.20-30: warning: rule useless in grammar [-Wother]
1796 exp: exp '+' exp | exp '-' exp | '(' exp ')'
1798 3.34-44: warning: rule useless in grammar [-Wother]
1799 exp: exp '+' exp | exp '-' exp | '(' exp ')'
1802 Now, rules whose left-hand side symbol is useless are no longer reported
1803 as useless. The locations of the errors have also been adjusted to point
1804 to the first use of the nonterminal as a left-hand side of a rule:
1806 warning: 1 nonterminal useless in grammar [-Wother]
1807 warning: 4 rules useless in grammar [-Wother]
1808 3.1-3: warning: nonterminal useless in grammar: exp [-Wother]
1809 exp: exp '+' exp | exp '-' exp | '(' exp ')'
1811 2.14-16: warning: rule useless in grammar [-Wother]
1815 *** C++: Generated parsers can be compiled with -fno-exceptions (lalr1.cc)
1817 When compiled with exceptions disabled, the generated parsers no longer
1818 uses try/catch clauses.
1820 Currently only GCC and Clang are supported.
1824 *** A demonstration of variants
1826 A new example was added (installed in .../share/doc/bison/examples),
1827 'variant.yy', which shows how to use (Bison) variants in C++.
1829 The other examples were made nicer to read.
1831 *** Some features are no longer 'experimental'
1833 The following features, mature enough, are no longer flagged as
1834 experimental in the documentation: push parsers, default %printer and
1835 %destructor (typed: <*> and untyped: <>), %define api.value.type union and
1836 variant, Java parsers, XML output, LR family (lr, ielr, lalr), and
1837 semantic predicates (%?).
1841 *** GLR: Predicates support broken by #line directives
1843 Predicates (%?) in GLR such as
1846 %? {new_syntax} 'w' id new_args
1847 | %?{!new_syntax} 'w' id old_args
1849 were issued with #lines in the middle of C code.
1851 *** Printer and destructor with broken #line directives
1853 The #line directives were not properly escaped when emitting the code for
1854 %printer/%destructor, which resulted in compiler errors if there are
1855 backslashes or double-quotes in the grammar file name.
1857 *** Portability on ICC
1859 The Intel compiler claims compatibility with GCC, yet rejects its _Pragma.
1860 Generated parsers now work around this.
1864 There were several small fixes in the test suite and in the build system,
1865 many warnings in bison and in the generated parsers were eliminated. The
1866 documentation also received its share of minor improvements.
1868 Useless code was removed from C++ parsers, and some of the generated
1869 constructors are more 'natural'.
1872 * Noteworthy changes in release 3.0.5 (2018-05-27) [stable]
1876 *** C++: Fix support of 'syntax_error'
1878 One incorrect 'inline' resulted in linking errors about the constructor of
1879 the syntax_error exception.
1881 *** C++: Fix warnings
1883 GCC 7.3 (with -O1 or -O2 but not -O0 or -O3) issued null-dereference
1884 warnings about yyformat being possibly null. It also warned about the
1885 deprecated implicit definition of copy constructors when there's a
1886 user-defined (copy) assignment operator.
1888 *** Location of errors
1890 In C++ parsers, out-of-bounds errors can happen when a rule with an empty
1891 ride-hand side raises a syntax error. The behavior of the default parser
1892 (yacc.c) in such a condition was undefined.
1894 Now all the parsers match the behavior of glr.c: @$ is used as the
1895 location of the error. This handles gracefully rules with and without
1898 *** Portability fixes in the test suite
1900 On some platforms, some Java and/or C++ tests were failing.
1903 * Noteworthy changes in release 3.0.4 (2015-01-23) [stable]
1907 *** C++ with Variants (lalr1.cc)
1909 Fix a compiler warning when no %destructor use $$.
1913 Several portability issues in tests were fixed.
1916 * Noteworthy changes in release 3.0.3 (2015-01-15) [stable]
1920 *** C++ with Variants (lalr1.cc)
1922 Problems with %destructor and '%define parse.assert' have been fixed.
1924 *** Named %union support (yacc.c, glr.c)
1926 Bison 3.0 introduced a regression on named %union such as
1928 %union foo { int ival; };
1930 The possibility to use a name was introduced "for Yacc compatibility".
1931 It is however not required by POSIX Yacc, and its usefulness is not clear.
1933 *** %define api.value.type union with %defines (yacc.c, glr.c)
1935 The C parsers were broken when %defines was used together with "%define
1936 api.value.type union".
1938 *** Redeclarations are reported in proper order
1946 bison used to report:
1948 foo.yy:2.10-11: error: %printer redeclaration for FOO
1951 foo.yy:3.10-11: previous declaration
1955 Now, the "previous" declaration is always the first one.
1960 Bison now installs various files in its docdir (which defaults to
1961 '/usr/local/share/doc/bison'), including the three fully blown examples
1962 extracted from the documentation:
1965 Reverse Polish Calculator, a simple introductory example.
1967 Multi-function Calc, a calculator with memory and functions and located
1970 a calculator in C++ using variant support and token constructors.
1973 * Noteworthy changes in release 3.0.2 (2013-12-05) [stable]
1977 *** Generated source files when errors are reported
1979 When warnings are issued and -Werror is set, bison would still generate
1980 the source files (*.c, *.h...). As a consequence, some runs of "make"
1981 could fail the first time, but not the second (as the files were generated
1984 This is fixed: bison no longer generates this source files, but, of
1985 course, still produces the various reports (*.output, *.xml, etc.).
1987 *** %empty is used in reports
1989 Empty right-hand sides are denoted by '%empty' in all the reports (text,
1990 dot, XML and formats derived from it).
1992 *** YYERROR and variants
1994 When C++ variant support is enabled, an error triggered via YYERROR, but
1995 not caught via error recovery, resulted in a double deletion.
1998 * Noteworthy changes in release 3.0.1 (2013-11-12) [stable]
2002 *** Errors in caret diagnostics
2004 On some platforms, some errors could result in endless diagnostics.
2006 *** Fixes of the -Werror option
2008 Options such as "-Werror -Wno-error=foo" were still turning "foo"
2009 diagnostics into errors instead of warnings. This is fixed.
2011 Actually, for consistency with GCC, "-Wno-error=foo -Werror" now also
2012 leaves "foo" diagnostics as warnings. Similarly, with "-Werror=foo
2013 -Wno-error", "foo" diagnostics are now errors.
2017 As demonstrated in the documentation, one can now leave spaces between
2022 The yacc.1 man page is no longer installed if --disable-yacc was
2025 *** Fixes in the test suite
2027 Bugs and portability issues.
2030 * Noteworthy changes in release 3.0 (2013-07-25) [stable]
2032 ** WARNING: Future backward-incompatibilities!
2034 Like other GNU packages, Bison will start using some of the C99 features
2035 for its own code, especially the definition of variables after statements.
2036 The generated C parsers still aim at C90.
2038 ** Backward incompatible changes
2040 *** Obsolete features
2042 Support for YYFAIL is removed (deprecated in Bison 2.4.2): use YYERROR.
2044 Support for yystype and yyltype is removed (deprecated in Bison 1.875):
2045 use YYSTYPE and YYLTYPE.
2047 Support for YYLEX_PARAM and YYPARSE_PARAM is removed (deprecated in Bison
2048 1.875): use %lex-param, %parse-param, or %param.
2050 Missing semicolons at the end of actions are no longer added (as announced
2051 in the release 2.5).
2053 *** Use of YACC='bison -y'
2055 TL;DR: With Autoconf <= 2.69, pass -Wno-yacc to (AM_)YFLAGS if you use
2058 Traditional Yacc generates 'y.tab.c' whatever the name of the input file.
2059 Therefore Makefiles written for Yacc expect 'y.tab.c' (and possibly
2060 'y.tab.h' and 'y.output') to be generated from 'foo.y'.
2062 To this end, for ages, AC_PROG_YACC, Autoconf's macro to look for an
2063 implementation of Yacc, was using Bison as 'bison -y'. While it does
2064 ensure compatible output file names, it also enables warnings for
2065 incompatibilities with POSIX Yacc. In other words, 'bison -y' triggers
2066 warnings for Bison extensions.
2068 Autoconf 2.70+ fixes this incompatibility by using YACC='bison -o y.tab.c'
2069 (which also generates 'y.tab.h' and 'y.output' when needed).
2070 Alternatively, disable Yacc warnings by passing '-Wno-yacc' to your Yacc
2071 flags (YFLAGS, or AM_YFLAGS with Automake).
2075 *** The epilogue is no longer affected by internal #defines (glr.c)
2077 The glr.c skeleton uses defines such as #define yylval (yystackp->yyval) in
2078 generated code. These weren't properly undefined before the inclusion of
2079 the user epilogue, so functions such as the following were butchered by the
2080 preprocessor expansion:
2082 int yylex (YYSTYPE *yylval);
2084 This is fixed: yylval, yynerrs, yychar, and yylloc are now valid
2085 identifiers for user-provided variables.
2087 *** stdio.h is no longer needed when locations are enabled (yacc.c)
2089 Changes in Bison 2.7 introduced a dependency on FILE and fprintf when
2090 locations are enabled. This is fixed.
2092 *** Warnings about useless %pure-parser/%define api.pure are restored
2094 ** Diagnostics reported by Bison
2096 Most of these features were contributed by Théophile Ranquet and Victor
2101 Version 2.7 introduced caret errors, for a prettier output. These are now
2102 activated by default. The old format can still be used by invoking Bison
2103 with -fno-caret (or -fnone).
2105 Some error messages that reproduced excerpts of the grammar are now using
2106 the caret information only. For instance on:
2113 in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2114 in.y:2.12-14: warning: rule useless in parser due to conflicts: exp: 'a' [-Wother]
2118 in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2119 in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
2123 and "bison -fno-caret" reports:
2125 in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2126 in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
2128 *** Enhancements of the -Werror option
2130 The -Werror=CATEGORY option is now recognized, and will treat specified
2131 warnings as errors. The warnings need not have been explicitly activated
2132 using the -W option, this is similar to what GCC 4.7 does.
2134 For example, given the following command line, Bison will treat both
2135 warnings related to POSIX Yacc incompatibilities and S/R conflicts as
2136 errors (and only those):
2138 $ bison -Werror=yacc,error=conflicts-sr input.y
2140 If no categories are specified, -Werror will make all active warnings into
2141 errors. For example, the following line does the same the previous example:
2143 $ bison -Werror -Wnone -Wyacc -Wconflicts-sr input.y
2145 (By default -Wconflicts-sr,conflicts-rr,deprecated,other is enabled.)
2147 Note that the categories in this -Werror option may not be prefixed with
2148 "no-". However, -Wno-error[=CATEGORY] is valid.
2150 Note that -y enables -Werror=yacc. Therefore it is now possible to require
2151 Yacc-like behavior (e.g., always generate y.tab.c), but to report
2152 incompatibilities as warnings: "-y -Wno-error=yacc".
2154 *** The display of warnings is now richer
2156 The option that controls a given warning is now displayed:
2158 foo.y:4.6: warning: type clash on default action: <foo> != <bar> [-Wother]
2160 In the case of warnings treated as errors, the prefix is changed from
2161 "warning: " to "error: ", and the suffix is displayed, in a manner similar
2162 to GCC, as [-Werror=CATEGORY].
2164 For instance, where the previous version of Bison would report (and exit
2167 bison: warnings being treated as errors
2168 input.y:1.1: warning: stray ',' treated as white space
2172 input.y:1.1: error: stray ',' treated as white space [-Werror=other]
2174 *** Deprecated constructs
2176 The new 'deprecated' warning category flags obsolete constructs whose
2177 support will be discontinued. It is enabled by default. These warnings
2178 used to be reported as 'other' warnings.
2180 *** Useless semantic types
2182 Bison now warns about useless (uninhabited) semantic types. Since
2183 semantic types are not declared to Bison (they are defined in the opaque
2184 %union structure), it is %printer/%destructor directives about useless
2185 types that trigger the warning:
2189 %printer {} <type1> <type3>
2190 %destructor {} <type2> <type4>
2192 nterm: term { $$ = $1; };
2194 3.28-34: warning: type <type3> is used, but is not associated to any symbol
2195 4.28-34: warning: type <type4> is used, but is not associated to any symbol
2197 *** Undefined but unused symbols
2199 Bison used to raise an error for undefined symbols that are not used in
2200 the grammar. This is now only a warning.
2203 %destructor {} symbol2
2204 %type <type> symbol3
2208 *** Useless destructors or printers
2210 Bison now warns about useless destructors or printers. In the following
2211 example, the printer for <type1>, and the destructor for <type2> are
2212 useless: all symbols of <type1> (token1) already have a printer, and all
2213 symbols of type <type2> (token2) already have a destructor.
2215 %token <type1> token1
2219 %printer {} token1 <type1> <type3>
2220 %destructor {} token2 <type2> <type4>
2224 The warnings and error messages about shift/reduce and reduce/reduce
2225 conflicts have been normalized. For instance on the following foo.y file:
2229 exp: exp '+' exp | '0' | '0';
2231 compare the previous version of bison:
2234 foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2235 $ bison -Werror foo.y
2236 bison: warnings being treated as errors
2237 foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2239 with the new behavior:
2242 foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
2243 foo.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
2244 $ bison -Werror foo.y
2245 foo.y: error: 1 shift/reduce conflict [-Werror=conflicts-sr]
2246 foo.y: error: 2 reduce/reduce conflicts [-Werror=conflicts-rr]
2248 When %expect or %expect-rr is used, such as with bar.y:
2253 exp: exp '+' exp | '0' | '0';
2258 bar.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2259 bar.y: expected 0 shift/reduce conflicts
2260 bar.y: expected 0 reduce/reduce conflicts
2265 bar.y: error: shift/reduce conflicts: 1 found, 0 expected
2266 bar.y: error: reduce/reduce conflicts: 2 found, 0 expected
2268 ** Incompatibilities with POSIX Yacc
2270 The 'yacc' category is no longer part of '-Wall', enable it explicitly
2273 ** Additional yylex/yyparse arguments
2275 The new directive %param declares additional arguments to both yylex and
2276 yyparse. The %lex-param, %parse-param, and %param directives support one
2277 or more arguments. Instead of
2279 %lex-param {arg1_type *arg1}
2280 %lex-param {arg2_type *arg2}
2281 %parse-param {arg1_type *arg1}
2282 %parse-param {arg2_type *arg2}
2286 %param {arg1_type *arg1} {arg2_type *arg2}
2288 ** Types of values for %define variables
2290 Bison used to make no difference between '%define foo bar' and '%define
2291 foo "bar"'. The former is now called a 'keyword value', and the latter a
2292 'string value'. A third kind was added: 'code values', such as '%define
2295 Keyword variables are used for fixed value sets, e.g.,
2297 %define lr.type lalr
2299 Code variables are used for value in the target language, e.g.,
2301 %define api.value.type {struct semantic_type}
2303 String variables are used remaining cases, e.g. file names.
2305 ** Variable api.token.prefix
2307 The variable api.token.prefix changes the way tokens are identified in
2308 the generated files. This is especially useful to avoid collisions
2309 with identifiers in the target language. For instance
2311 %token FILE for ERROR
2312 %define api.token.prefix {TOK_}
2314 start: FILE for ERROR;
2316 will generate the definition of the symbols TOK_FILE, TOK_for, and
2317 TOK_ERROR in the generated sources. In particular, the scanner must
2318 use these prefixed token names, although the grammar itself still
2319 uses the short names (as in the sample rule given above).
2321 ** Variable api.value.type
2323 This new %define variable supersedes the #define macro YYSTYPE. The use
2324 of YYSTYPE is discouraged. In particular, #defining YYSTYPE *and* either
2325 using %union or %defining api.value.type results in undefined behavior.
2327 Either define api.value.type, or use "%union":
2334 %token <ival> INT "integer"
2335 %token <sval> STRING "string"
2336 %printer { fprintf (yyo, "%d", $$); } <ival>
2337 %destructor { free ($$); } <sval>
2340 yylval.ival = 42; return INT;
2341 yylval.sval = "42"; return STRING;
2343 The %define variable api.value.type supports both keyword and code values.
2345 The keyword value 'union' means that the user provides genuine types, not
2346 union member names such as "ival" and "sval" above (WARNING: will fail if
2347 -y/--yacc/%yacc is enabled).
2349 %define api.value.type union
2350 %token <int> INT "integer"
2351 %token <char *> STRING "string"
2352 %printer { fprintf (yyo, "%d", $$); } <int>
2353 %destructor { free ($$); } <char *>
2356 yylval.INT = 42; return INT;
2357 yylval.STRING = "42"; return STRING;
2359 The keyword value variant is somewhat equivalent, but for C++ special
2360 provision is made to allow classes to be used (more about this below).
2362 %define api.value.type variant
2363 %token <int> INT "integer"
2364 %token <std::string> STRING "string"
2366 Code values (in braces) denote user defined types. This is where YYSTYPE
2384 %define api.value.type {struct my_value}
2385 %token <u.ival> INT "integer"
2386 %token <u.sval> STRING "string"
2387 %printer { fprintf (yyo, "%d", $$); } <u.ival>
2388 %destructor { free ($$); } <u.sval>
2391 yylval.u.ival = 42; return INT;
2392 yylval.u.sval = "42"; return STRING;
2394 ** Variable parse.error
2396 This variable controls the verbosity of error messages. The use of the
2397 %error-verbose directive is deprecated in favor of "%define parse.error
2400 ** Deprecated %define variable names
2402 The following variables have been renamed for consistency. Backward
2403 compatibility is ensured, but upgrading is recommended.
2405 lr.default-reductions -> lr.default-reduction
2406 lr.keep-unreachable-states -> lr.keep-unreachable-state
2407 namespace -> api.namespace
2408 stype -> api.value.type
2410 ** Semantic predicates
2412 Contributed by Paul Hilfinger.
2414 The new, experimental, semantic-predicate feature allows actions of the
2415 form "%?{ BOOLEAN-EXPRESSION }", which cause syntax errors (as for
2416 YYERROR) if the expression evaluates to 0, and are evaluated immediately
2417 in GLR parsers, rather than being deferred. The result is that they allow
2418 the programmer to prune possible parses based on the values of run-time
2421 ** The directive %expect-rr is now an error in non GLR mode
2423 It used to be an error only if used in non GLR mode, _and_ if there are
2424 reduce/reduce conflicts.
2426 ** Tokens are numbered in their order of appearance
2428 Contributed by Valentin Tolmer.
2430 With '%token A B', A had a number less than the one of B. However,
2431 precedence declarations used to generate a reversed order. This is now
2432 fixed, and introducing tokens with any of %token, %left, %right,
2433 %precedence, or %nonassoc yields the same result.
2435 When mixing declarations of tokens with a literal character (e.g., 'a') or
2436 with an identifier (e.g., B) in a precedence declaration, Bison numbered
2437 the literal characters first. For example
2441 would lead to the tokens declared in this order: 'c' 'd' A B. Again, the
2442 input order is now preserved.
2444 These changes were made so that one can remove useless precedence and
2445 associativity declarations (i.e., map %nonassoc, %left or %right to
2446 %precedence, or to %token) and get exactly the same output.
2448 ** Useless precedence and associativity
2450 Contributed by Valentin Tolmer.
2452 When developing and maintaining a grammar, useless associativity and
2453 precedence directives are common. They can be a nuisance: new ambiguities
2454 arising are sometimes masked because their conflicts are resolved due to
2455 the extra precedence or associativity information. Furthermore, it can
2456 hinder the comprehension of a new grammar: one will wonder about the role
2457 of a precedence, where in fact it is useless. The following changes aim
2458 at detecting and reporting these extra directives.
2460 *** Precedence warning category
2462 A new category of warning, -Wprecedence, was introduced. It flags the
2463 useless precedence and associativity directives.
2465 *** Useless associativity
2467 Bison now warns about symbols with a declared associativity that is never
2468 used to resolve conflicts. In that case, using %precedence is sufficient;
2469 the parsing tables will remain unchanged. Solving these warnings may raise
2470 useless precedence warnings, as the symbols no longer have associativity.
2484 warning: useless associativity for '+', use %precedence [-Wprecedence]
2488 *** Useless precedence
2490 Bison now warns about symbols with a declared precedence and no declared
2491 associativity (i.e., declared with %precedence), and whose precedence is
2492 never used. In that case, the symbol can be safely declared with %token
2493 instead, without modifying the parsing tables. For example:
2497 exp: "var" '=' "number";
2501 warning: useless precedence for '=' [-Wprecedence]
2505 *** Useless precedence and associativity
2507 In case of both useless precedence and associativity, the issue is flagged
2512 exp: "var" '=' "number";
2516 warning: useless precedence and associativity for '=' [-Wprecedence]
2522 With help from Joel E. Denny and Gabriel Rassoul.
2524 Empty rules (i.e., with an empty right-hand side) can now be explicitly
2525 marked by the new %empty directive. Using %empty on a non-empty rule is
2526 an error. The new -Wempty-rule warning reports empty rules without
2527 %empty. On the following grammar:
2537 3.4-5: warning: empty rule without %empty [-Wempty-rule]
2540 5.8-13: error: %empty on non-empty rule
2544 ** Java skeleton improvements
2546 The constants for token names were moved to the Lexer interface. Also, it
2547 is possible to add code to the parser's constructors using "%code init"
2548 and "%define init_throws".
2549 Contributed by Paolo Bonzini.
2551 The Java skeleton now supports push parsing.
2552 Contributed by Dennis Heimbigner.
2554 ** C++ skeletons improvements
2556 *** The parser header is no longer mandatory (lalr1.cc, glr.cc)
2558 Using %defines is now optional. Without it, the needed support classes
2559 are defined in the generated parser, instead of additional files (such as
2560 location.hh, position.hh and stack.hh).
2562 *** Locations are no longer mandatory (lalr1.cc, glr.cc)
2564 Both lalr1.cc and glr.cc no longer require %location.
2566 *** syntax_error exception (lalr1.cc)
2568 The C++ parser features a syntax_error exception, which can be
2569 thrown from the scanner or from user rules to raise syntax errors.
2570 This facilitates reporting errors caught in sub-functions (e.g.,
2571 rejecting too large integral literals from a conversion function
2572 used by the scanner, or rejecting invalid combinations from a
2573 factory invoked by the user actions).
2575 *** %define api.value.type variant
2577 This is based on a submission from Michiel De Wilde. With help
2578 from Théophile Ranquet.
2580 In this mode, complex C++ objects can be used as semantic values. For
2583 %token <::std::string> TEXT;
2584 %token <int> NUMBER;
2585 %token SEMICOLON ";"
2586 %type <::std::string> item;
2587 %type <::std::list<std::string>> list;
2590 list { std::cout << $1 << std::endl; }
2594 %empty { /* Generates an empty string list. */ }
2595 | list item ";" { std::swap ($$, $1); $$.push_back ($2); }
2599 TEXT { std::swap ($$, $1); }
2600 | NUMBER { $$ = string_cast ($1); }
2603 *** %define api.token.constructor
2605 When variants are enabled, Bison can generate functions to build the
2606 tokens. This guarantees that the token type (e.g., NUMBER) is consistent
2607 with the semantic value (e.g., int):
2609 parser::symbol_type yylex ()
2611 parser::location_type loc = ...;
2613 return parser::make_TEXT ("Hello, world!", loc);
2615 return parser::make_NUMBER (42, loc);
2617 return parser::make_SEMICOLON (loc);
2623 There are operator- and operator-= for 'location'. Negative line/column
2624 increments can no longer underflow the resulting value.
2627 * Noteworthy changes in release 2.7.1 (2013-04-15) [stable]
2631 *** Fix compiler attribute portability (yacc.c)
2633 With locations enabled, __attribute__ was used unprotected.
2635 *** Fix some compiler warnings (lalr1.cc)
2638 * Noteworthy changes in release 2.7 (2012-12-12) [stable]
2642 Warnings about uninitialized yylloc in yyparse have been fixed.
2644 Restored C90 compliance (yet no report was ever made).
2646 ** Diagnostics are improved
2648 Contributed by Théophile Ranquet.
2650 *** Changes in the format of error messages
2652 This used to be the format of many error reports:
2654 input.y:2.7-12: %type redeclaration for exp
2655 input.y:1.7-12: previous declaration
2659 input.y:2.7-12: error: %type redeclaration for exp
2660 input.y:1.7-12: previous declaration
2662 *** New format for error reports: carets
2664 Caret errors have been added to Bison:
2666 input.y:2.7-12: error: %type redeclaration for exp
2669 input.y:1.7-12: previous declaration
2675 input.y:3.20-23: error: ambiguous reference: '$exp'
2676 exp: exp '+' exp { $exp = $1 + $3; };
2678 input.y:3.1-3: refers to: $exp at $$
2679 exp: exp '+' exp { $exp = $1 + $3; };
2681 input.y:3.6-8: refers to: $exp at $1
2682 exp: exp '+' exp { $exp = $1 + $3; };
2684 input.y:3.14-16: refers to: $exp at $3
2685 exp: exp '+' exp { $exp = $1 + $3; };
2688 The default behavior for now is still not to display these unless
2689 explicitly asked with -fcaret (or -fall). However, in a later release, it
2690 will be made the default behavior (but may still be deactivated with
2693 ** New value for %define variable: api.pure full
2695 The %define variable api.pure requests a pure (reentrant) parser. However,
2696 for historical reasons, using it in a location-tracking Yacc parser
2697 resulted in a yyerror function that did not take a location as a
2698 parameter. With this new value, the user may request a better pure parser,
2699 where yyerror does take a location as a parameter (in location-tracking
2702 The use of "%define api.pure true" is deprecated in favor of this new
2703 "%define api.pure full".
2705 ** New %define variable: api.location.type (glr.cc, lalr1.cc, lalr1.java)
2707 The %define variable api.location.type defines the name of the type to use
2708 for locations. When defined, Bison no longer generates the position.hh
2709 and location.hh files, nor does the parser will include them: the user is
2710 then responsible to define her type.
2712 This can be used in programs with several parsers to factor their location
2713 and position files: let one of them generate them, and the others just use
2716 This feature was actually introduced, but not documented, in Bison 2.5,
2717 under the name "location_type" (which is maintained for backward
2720 For consistency, lalr1.java's %define variables location_type and
2721 position_type are deprecated in favor of api.location.type and
2724 ** Exception safety (lalr1.cc)
2726 The parse function now catches exceptions, uses the %destructors to
2727 release memory (the lookahead symbol and the symbols pushed on the stack)
2728 before re-throwing the exception.
2730 This feature is somewhat experimental. User feedback would be
2733 ** Graph improvements in DOT and XSLT
2735 Contributed by Théophile Ranquet.
2737 The graphical presentation of the states is more readable: their shape is
2738 now rectangular, the state number is clearly displayed, and the items are
2739 numbered and left-justified.
2741 The reductions are now explicitly represented as transitions to other
2742 diamond shaped nodes.
2744 These changes are present in both --graph output and xml2dot.xsl XSLT
2745 processing, with minor (documented) differences.
2747 ** %language is no longer an experimental feature.
2749 The introduction of this feature, in 2.4, was four years ago. The
2750 --language option and the %language directive are no longer experimental.
2754 The sections about shift/reduce and reduce/reduce conflicts resolution
2755 have been fixed and extended.
2757 Although introduced more than four years ago, XML and Graphviz reports
2758 were not properly documented.
2760 The translation of midrule actions is now described.
2763 * Noteworthy changes in release 2.6.5 (2012-11-07) [stable]
2765 We consider compiler warnings about Bison generated parsers to be bugs.
2766 Rather than working around them in your own project, please consider
2767 reporting them to us.
2771 Warnings about uninitialized yylval and/or yylloc for push parsers with a
2772 pure interface have been fixed for GCC 4.0 up to 4.8, and Clang 2.9 to
2775 Other issues in the test suite have been addressed.
2777 Null characters are correctly displayed in error messages.
2779 When possible, yylloc is correctly initialized before calling yylex. It
2780 is no longer necessary to initialize it in the %initial-action.
2783 * Noteworthy changes in release 2.6.4 (2012-10-23) [stable]
2785 Bison 2.6.3's --version was incorrect. This release fixes this issue.
2788 * Noteworthy changes in release 2.6.3 (2012-10-22) [stable]
2792 Bugs and portability issues in the test suite have been fixed.
2794 Some errors in translations have been addressed, and --help now directs
2795 users to the appropriate place to report them.
2797 Stray Info files shipped by accident are removed.
2799 Incorrect definitions of YY_, issued by yacc.c when no parser header is
2800 generated, are removed.
2802 All the generated headers are self-contained.
2804 ** Header guards (yacc.c, glr.c, glr.cc)
2806 In order to avoid collisions, the header guards are now
2807 YY_<PREFIX>_<FILE>_INCLUDED, instead of merely <PREFIX>_<FILE>.
2808 For instance the header generated from
2810 %define api.prefix "calc"
2811 %defines "lib/parse.h"
2813 will use YY_CALC_LIB_PARSE_H_INCLUDED as guard.
2815 ** Fix compiler warnings in the generated parser (yacc.c, glr.c)
2817 The compilation of pure parsers (%define api.pure) can trigger GCC
2820 input.c: In function 'yyparse':
2821 input.c:1503:12: warning: 'yylval' may be used uninitialized in this
2822 function [-Wmaybe-uninitialized]
2826 This is now fixed; pragmas to avoid these warnings are no longer needed.
2828 Warnings from clang ("equality comparison with extraneous parentheses" and
2829 "function declared 'noreturn' should not return") have also been
2833 * Noteworthy changes in release 2.6.2 (2012-08-03) [stable]
2837 Buffer overruns, complaints from Flex, and portability issues in the test
2838 suite have been fixed.
2840 ** Spaces in %lex- and %parse-param (lalr1.cc, glr.cc)
2842 Trailing end-of-lines in %parse-param or %lex-param would result in
2843 invalid C++. This is fixed.
2845 ** Spurious spaces and end-of-lines
2847 The generated files no longer end (nor start) with empty lines.
2850 * Noteworthy changes in release 2.6.1 (2012-07-30) [stable]
2852 Bison no longer executes user-specified M4 code when processing a grammar.
2856 In addition to the removal of the features announced in Bison 2.6, the
2857 next major release will remove the "Temporary hack for adding a semicolon
2858 to the user action", as announced in the release 2.5. Instead of:
2860 exp: exp "+" exp { $$ = $1 + $3 };
2864 exp: exp "+" exp { $$ = $1 + $3; };
2868 *** Type names are now properly escaped.
2870 *** glr.cc: set_debug_level and debug_level work as expected.
2872 *** Stray @ or $ in actions
2874 While Bison used to warn about stray $ or @ in action rules, it did not
2875 for other actions such as printers, destructors, or initial actions. It
2878 ** Type names in actions
2880 For consistency with rule actions, it is now possible to qualify $$ by a
2881 type-name in destructors, printers, and initial actions. For instance:
2883 %printer { fprintf (yyo, "(%d, %f)", $<ival>$, $<fval>$); } <*> <>;
2885 will display two values for each typed and untyped symbol (provided
2886 that YYSTYPE has both "ival" and "fval" fields).
2889 * Noteworthy changes in release 2.6 (2012-07-19) [stable]
2893 The next major release of Bison will drop support for the following
2894 deprecated features. Please report disagreements to bug-bison@gnu.org.
2898 Support for generating parsers in K&R C will be removed. Parsers
2899 generated for C support ISO C90, and are tested with ISO C99 and ISO C11
2902 *** Features deprecated since Bison 1.875
2904 The definitions of yystype and yyltype will be removed; use YYSTYPE and
2907 YYPARSE_PARAM and YYLEX_PARAM, deprecated in favor of %parse-param and
2908 %lex-param, will no longer be supported.
2910 Support for the preprocessor symbol YYERROR_VERBOSE will be removed, use
2913 *** The generated header will be included (yacc.c)
2915 Instead of duplicating the content of the generated header (definition of
2916 YYSTYPE, yyparse declaration etc.), the generated parser will include it,
2917 as is already the case for GLR or C++ parsers. This change is deferred
2918 because existing versions of ylwrap (e.g., Automake 1.12.1) do not support
2921 ** Generated Parser Headers
2923 *** Guards (yacc.c, glr.c, glr.cc)
2925 The generated headers are now guarded, as is already the case for C++
2926 parsers (lalr1.cc). For instance, with --defines=foo.h:
2931 #endif /* !YY_FOO_H */
2933 *** New declarations (yacc.c, glr.c)
2935 The generated header now declares yydebug and yyparse. Both honor
2936 --name-prefix=bar_, and yield
2938 int bar_parse (void);
2942 #define yyparse bar_parse
2945 in order to facilitate the inclusion of several parser headers inside a
2946 single compilation unit.
2948 *** Exported symbols in C++
2950 The symbols YYTOKEN_TABLE and YYERROR_VERBOSE, which were defined in the
2951 header, are removed, as they prevent the possibility of including several
2952 generated headers from a single compilation unit.
2956 For the same reasons, the undocumented and unused macro YYLSP_NEEDED is no
2959 ** New %define variable: api.prefix
2961 Now that the generated headers are more complete and properly protected
2962 against multiple inclusions, constant names, such as YYSTYPE are a
2963 problem. While yyparse and others are properly renamed by %name-prefix,
2964 YYSTYPE, YYDEBUG and others have never been affected by it. Because it
2965 would introduce backward compatibility issues in projects not expecting
2966 YYSTYPE to be renamed, instead of changing the behavior of %name-prefix,
2967 it is deprecated in favor of a new %define variable: api.prefix.
2969 The following examples compares both:
2971 %name-prefix "bar_" | %define api.prefix "bar_"
2972 %token <ival> FOO %token <ival> FOO
2973 %union { int ival; } %union { int ival; }
2979 #ifndef BAR_FOO_H #ifndef BAR_FOO_H
2980 # define BAR_FOO_H # define BAR_FOO_H
2982 /* Enabling traces. */ /* Enabling traces. */
2983 # ifndef YYDEBUG | # ifndef BAR_DEBUG
2984 > # if defined YYDEBUG
2986 > # define BAR_DEBUG 1
2988 > # define BAR_DEBUG 0
2991 # define YYDEBUG 0 | # define BAR_DEBUG 0
2995 # if YYDEBUG | # if BAR_DEBUG
2996 extern int bar_debug; extern int bar_debug;
2999 /* Tokens. */ /* Tokens. */
3000 # ifndef YYTOKENTYPE | # ifndef BAR_TOKENTYPE
3001 # define YYTOKENTYPE | # define BAR_TOKENTYPE
3002 enum yytokentype { | enum bar_tokentype {
3007 #if ! defined YYSTYPE \ | #if ! defined BAR_STYPE \
3008 && ! defined YYSTYPE_IS_DECLARED | && ! defined BAR_STYPE_IS_DECLARED
3009 typedef union YYSTYPE | typedef union BAR_STYPE
3012 } YYSTYPE; | } BAR_STYPE;
3013 # define YYSTYPE_IS_DECLARED 1 | # define BAR_STYPE_IS_DECLARED 1
3016 extern YYSTYPE bar_lval; | extern BAR_STYPE bar_lval;
3018 int bar_parse (void); int bar_parse (void);
3020 #endif /* !BAR_FOO_H */ #endif /* !BAR_FOO_H */
3023 * Noteworthy changes in release 2.5.1 (2012-06-05) [stable]
3027 The next major release will drop support for generating parsers in K&R C.
3029 ** yacc.c: YYBACKUP works as expected.
3031 ** glr.c improvements:
3033 *** Location support is eliminated when not requested:
3035 GLR parsers used to include location-related code even when locations were
3036 not requested, and therefore not even usable.
3038 *** __attribute__ is preserved:
3040 __attribute__ is no longer disabled when __STRICT_ANSI__ is defined (i.e.,
3041 when -std is passed to GCC).
3043 ** lalr1.java: several fixes:
3045 The Java parser no longer throws ArrayIndexOutOfBoundsException if the
3046 first token leads to a syntax error. Some minor clean ups.
3050 *** C++11 compatibility:
3052 C and C++ parsers use "nullptr" instead of "0" when __cplusplus is 201103L
3057 The header files such as "parser.hh", "location.hh", etc. used a constant
3058 name for preprocessor guards, for instance:
3060 #ifndef BISON_LOCATION_HH
3061 # define BISON_LOCATION_HH
3063 #endif // !BISON_LOCATION_HH
3065 The inclusion guard is now computed from "PREFIX/FILE-NAME", where lower
3066 case characters are converted to upper case, and series of
3067 non-alphanumerical characters are converted to an underscore.
3069 With "bison -o lang++/parser.cc", "location.hh" would now include:
3071 #ifndef YY_LANG_LOCATION_HH
3072 # define YY_LANG_LOCATION_HH
3074 #endif // !YY_LANG_LOCATION_HH
3078 The position and location constructors (and their initialize methods)
3079 accept new arguments for line and column. Several issues in the
3080 documentation were fixed.
3082 ** liby is no longer asking for "rpl_fprintf" on some platforms.
3084 ** Changes in the manual:
3086 *** %printer is documented
3088 The "%printer" directive, supported since at least Bison 1.50, is finally
3089 documented. The "mfcalc" example is extended to demonstrate it.
3091 For consistency with the C skeletons, the C++ parsers now also support
3092 "yyoutput" (as an alias to "debug_stream ()").
3094 *** Several improvements have been made:
3096 The layout for grammar excerpts was changed to a more compact scheme.
3097 Named references are motivated. The description of the automaton
3098 description file (*.output) is updated to the current format. Incorrect
3099 index entries were fixed. Some other errors were fixed.
3103 *** Conflicting prototypes with recent/modified Flex.
3105 Fixed build problems with the current, unreleased, version of Flex, and
3106 some modified versions of 2.5.35, which have modified function prototypes.
3108 *** Warnings during the build procedure have been eliminated.
3110 *** Several portability problems in the test suite have been fixed:
3112 This includes warnings with some compilers, unexpected behavior of tools
3113 such as diff, warning messages from the test suite itself, etc.
3115 *** The install-pdf target works properly:
3117 Running "make install-pdf" (or -dvi, -html, -info, and -ps) no longer
3118 halts in the middle of its course.
3121 * Noteworthy changes in release 2.5 (2011-05-14)
3123 ** Grammar symbol names can now contain non-initial dashes:
3125 Consistently with directives (such as %error-verbose) and with
3126 %define variables (e.g. push-pull), grammar symbol names may contain
3127 dashes in any position except the beginning. This is a GNU
3128 extension over POSIX Yacc. Thus, use of this extension is reported
3129 by -Wyacc and rejected in Yacc mode (--yacc).
3131 ** Named references:
3133 Historically, Yacc and Bison have supported positional references
3134 ($n, $$) to allow access to symbol values from inside of semantic
3137 Starting from this version, Bison can also accept named references.
3138 When no ambiguity is possible, original symbol names may be used
3139 as named references:
3141 if_stmt : "if" cond_expr "then" then_stmt ';'
3142 { $if_stmt = mk_if_stmt($cond_expr, $then_stmt); }
3144 In the more common case, explicit names may be declared:
3146 stmt[res] : "if" expr[cond] "then" stmt[then] "else" stmt[else] ';'
3147 { $res = mk_if_stmt($cond, $then, $else); }
3149 Location information is also accessible using @name syntax. When
3150 accessing symbol names containing dots or dashes, explicit bracketing
3151 ($[sym.1]) must be used.
3153 These features are experimental in this version. More user feedback
3154 will help to stabilize them.
3155 Contributed by Alex Rozenman.
3157 ** IELR(1) and canonical LR(1):
3159 IELR(1) is a minimal LR(1) parser table generation algorithm. That
3160 is, given any context-free grammar, IELR(1) generates parser tables
3161 with the full language-recognition power of canonical LR(1) but with
3162 nearly the same number of parser states as LALR(1). This reduction
3163 in parser states is often an order of magnitude. More importantly,
3164 because canonical LR(1)'s extra parser states may contain duplicate
3165 conflicts in the case of non-LR(1) grammars, the number of conflicts
3166 for IELR(1) is often an order of magnitude less as well. This can
3167 significantly reduce the complexity of developing of a grammar.
3169 Bison can now generate IELR(1) and canonical LR(1) parser tables in
3170 place of its traditional LALR(1) parser tables, which remain the
3171 default. You can specify the type of parser tables in the grammar
3172 file with these directives:
3174 %define lr.type lalr
3175 %define lr.type ielr
3176 %define lr.type canonical-lr
3178 The default-reduction optimization in the parser tables can also be
3179 adjusted using "%define lr.default-reductions". For details on both
3180 of these features, see the new section "Tuning LR" in the Bison
3183 These features are experimental. More user feedback will help to
3186 ** LAC (Lookahead Correction) for syntax error handling
3188 Contributed by Joel E. Denny.
3190 Canonical LR, IELR, and LALR can suffer from a couple of problems
3191 upon encountering a syntax error. First, the parser might perform
3192 additional parser stack reductions before discovering the syntax
3193 error. Such reductions can perform user semantic actions that are
3194 unexpected because they are based on an invalid token, and they
3195 cause error recovery to begin in a different syntactic context than
3196 the one in which the invalid token was encountered. Second, when
3197 verbose error messages are enabled (with %error-verbose or the
3198 obsolete "#define YYERROR_VERBOSE"), the expected token list in the
3199 syntax error message can both contain invalid tokens and omit valid
3202 The culprits for the above problems are %nonassoc, default
3203 reductions in inconsistent states, and parser state merging. Thus,
3204 IELR and LALR suffer the most. Canonical LR can suffer only if
3205 %nonassoc is used or if default reductions are enabled for
3206 inconsistent states.
3208 LAC is a new mechanism within the parsing algorithm that solves
3209 these problems for canonical LR, IELR, and LALR without sacrificing
3210 %nonassoc, default reductions, or state merging. When LAC is in
3211 use, canonical LR and IELR behave almost exactly the same for both
3212 syntactically acceptable and syntactically unacceptable input.
3213 While LALR still does not support the full language-recognition
3214 power of canonical LR and IELR, LAC at least enables LALR's syntax
3215 error handling to correctly reflect LALR's language-recognition
3218 Currently, LAC is only supported for deterministic parsers in C.
3219 You can enable LAC with the following directive:
3221 %define parse.lac full
3223 See the new section "LAC" in the Bison manual for additional
3224 details including a few caveats.
3226 LAC is an experimental feature. More user feedback will help to
3229 ** %define improvements:
3231 *** Can now be invoked via the command line:
3233 Each of these command-line options
3236 --define=NAME[=VALUE]
3239 --force-define=NAME[=VALUE]
3241 is equivalent to this grammar file declaration
3243 %define NAME ["VALUE"]
3245 except that the manner in which Bison processes multiple definitions
3246 for the same NAME differs. Most importantly, -F and --force-define
3247 quietly override %define, but -D and --define do not. For further
3248 details, see the section "Bison Options" in the Bison manual.
3250 *** Variables renamed:
3252 The following %define variables
3255 lr.keep_unreachable_states
3257 have been renamed to
3260 lr.keep-unreachable-states
3262 The old names are now deprecated but will be maintained indefinitely
3263 for backward compatibility.
3265 *** Values no longer need to be quoted in the grammar file:
3267 If a %define value is an identifier, it no longer needs to be placed
3268 within quotations marks. For example,
3270 %define api.push-pull "push"
3274 %define api.push-pull push
3276 *** Unrecognized variables are now errors not warnings.
3278 *** Multiple invocations for any variable is now an error not a warning.
3280 ** Unrecognized %code qualifiers are now errors not warnings.
3282 ** Character literals not of length one:
3284 Previously, Bison quietly converted all character literals to length
3285 one. For example, without warning, Bison interpreted the operators in
3286 the following grammar to be the same token:
3292 Bison now warns when a character literal is not of length one. In
3293 some future release, Bison will start reporting an error instead.
3295 ** Destructor calls fixed for lookaheads altered in semantic actions:
3297 Previously for deterministic parsers in C, if a user semantic action
3298 altered yychar, the parser in some cases used the old yychar value to
3299 determine which destructor to call for the lookahead upon a syntax
3300 error or upon parser return. This bug has been fixed.
3302 ** C++ parsers use YYRHSLOC:
3304 Similarly to the C parsers, the C++ parsers now define the YYRHSLOC
3305 macro and use it in the default YYLLOC_DEFAULT. You are encouraged
3306 to use it. If, for instance, your location structure has "first"
3307 and "last" members, instead of
3309 # define YYLLOC_DEFAULT(Current, Rhs, N) \
3313 (Current).first = (Rhs)[1].location.first; \
3314 (Current).last = (Rhs)[N].location.last; \
3318 (Current).first = (Current).last = (Rhs)[0].location.last; \
3324 # define YYLLOC_DEFAULT(Current, Rhs, N) \
3328 (Current).first = YYRHSLOC (Rhs, 1).first; \
3329 (Current).last = YYRHSLOC (Rhs, N).last; \
3333 (Current).first = (Current).last = YYRHSLOC (Rhs, 0).last; \
3337 ** YYLLOC_DEFAULT in C++:
3339 The default implementation of YYLLOC_DEFAULT used to be issued in
3340 the header file. It is now output in the implementation file, after
3341 the user %code sections so that its #ifndef guard does not try to
3342 override the user's YYLLOC_DEFAULT if provided.
3344 ** YYFAIL now produces warnings and Java parsers no longer implement it:
3346 YYFAIL has existed for many years as an undocumented feature of
3347 deterministic parsers in C generated by Bison. More recently, it was
3348 a documented feature of Bison's experimental Java parsers. As
3349 promised in Bison 2.4.2's NEWS entry, any appearance of YYFAIL in a
3350 semantic action now produces a deprecation warning, and Java parsers
3351 no longer implement YYFAIL at all. For further details, including a
3352 discussion of how to suppress C preprocessor warnings about YYFAIL
3353 being unused, see the Bison 2.4.2 NEWS entry.
3355 ** Temporary hack for adding a semicolon to the user action:
3357 Previously, Bison appended a semicolon to every user action for
3358 reductions when the output language defaulted to C (specifically, when
3359 neither %yacc, %language, %skeleton, or equivalent command-line
3360 options were specified). This allowed actions such as
3362 exp: exp "+" exp { $$ = $1 + $3 };
3366 exp: exp "+" exp { $$ = $1 + $3; };
3368 As a first step in removing this misfeature, Bison now issues a
3369 warning when it appends a semicolon. Moreover, in cases where Bison
3370 cannot easily determine whether a semicolon is needed (for example, an
3371 action ending with a cpp directive or a braced compound initializer),
3372 it no longer appends one. Thus, the C compiler might now complain
3373 about a missing semicolon where it did not before. Future releases of
3374 Bison will cease to append semicolons entirely.
3376 ** Verbose syntax error message fixes:
3378 When %error-verbose or the obsolete "#define YYERROR_VERBOSE" is
3379 specified, syntax error messages produced by the generated parser
3380 include the unexpected token as well as a list of expected tokens.
3381 The effect of %nonassoc on these verbose messages has been corrected
3382 in two ways, but a more complete fix requires LAC, described above:
3384 *** When %nonassoc is used, there can exist parser states that accept no
3385 tokens, and so the parser does not always require a lookahead token
3386 in order to detect a syntax error. Because no unexpected token or
3387 expected tokens can then be reported, the verbose syntax error
3388 message described above is suppressed, and the parser instead
3389 reports the simpler message, "syntax error". Previously, this
3390 suppression was sometimes erroneously triggered by %nonassoc when a
3391 lookahead was actually required. Now verbose messages are
3392 suppressed only when all previous lookaheads have already been
3393 shifted or discarded.
3395 *** Previously, the list of expected tokens erroneously included tokens
3396 that would actually induce a syntax error because conflicts for them
3397 were resolved with %nonassoc in the current parser state. Such
3398 tokens are now properly omitted from the list.
3400 *** Expected token lists are still often wrong due to state merging
3401 (from LALR or IELR) and default reductions, which can both add
3402 invalid tokens and subtract valid tokens. Canonical LR almost
3403 completely fixes this problem by eliminating state merging and
3404 default reductions. However, there is one minor problem left even
3405 when using canonical LR and even after the fixes above. That is,
3406 if the resolution of a conflict with %nonassoc appears in a later
3407 parser state than the one at which some syntax error is
3408 discovered, the conflicted token is still erroneously included in
3409 the expected token list. Bison's new LAC implementation,
3410 described above, eliminates this problem and the need for
3411 canonical LR. However, LAC is still experimental and is disabled
3414 ** Java skeleton fixes:
3416 *** A location handling bug has been fixed.
3418 *** The top element of each of the value stack and location stack is now
3419 cleared when popped so that it can be garbage collected.
3421 *** Parser traces now print the top element of the stack.
3423 ** -W/--warnings fixes:
3425 *** Bison now properly recognizes the "no-" versions of categories:
3427 For example, given the following command line, Bison now enables all
3428 warnings except warnings for incompatibilities with POSIX Yacc:
3430 bison -Wall,no-yacc gram.y
3432 *** Bison now treats S/R and R/R conflicts like other warnings:
3434 Previously, conflict reports were independent of Bison's normal
3435 warning system. Now, Bison recognizes the warning categories
3436 "conflicts-sr" and "conflicts-rr". This change has important
3437 consequences for the -W and --warnings command-line options. For
3440 bison -Wno-conflicts-sr gram.y # S/R conflicts not reported
3441 bison -Wno-conflicts-rr gram.y # R/R conflicts not reported
3442 bison -Wnone gram.y # no conflicts are reported
3443 bison -Werror gram.y # any conflict is an error
3445 However, as before, if the %expect or %expect-rr directive is
3446 specified, an unexpected number of conflicts is an error, and an
3447 expected number of conflicts is not reported, so -W and --warning
3448 then have no effect on the conflict report.
3450 *** The "none" category no longer disables a preceding "error":
3452 For example, for the following command line, Bison now reports
3453 errors instead of warnings for incompatibilities with POSIX Yacc:
3455 bison -Werror,none,yacc gram.y
3457 *** The "none" category now disables all Bison warnings:
3459 Previously, the "none" category disabled only Bison warnings for
3460 which there existed a specific -W/--warning category. However,
3461 given the following command line, Bison is now guaranteed to
3462 suppress all warnings:
3466 ** Precedence directives can now assign token number 0:
3468 Since Bison 2.3b, which restored the ability of precedence
3469 directives to assign token numbers, doing so for token number 0 has
3470 produced an assertion failure. For example:
3474 This bug has been fixed.
3477 * Noteworthy changes in release 2.4.3 (2010-08-05)
3479 ** Bison now obeys -Werror and --warnings=error for warnings about
3480 grammar rules that are useless in the parser due to conflicts.
3482 ** Problems with spawning M4 on at least FreeBSD 8 and FreeBSD 9 have
3485 ** Failures in the test suite for GCC 4.5 have been fixed.
3487 ** Failures in the test suite for some versions of Sun Studio C++ have
3490 ** Contrary to Bison 2.4.2's NEWS entry, it has been decided that
3491 warnings about undefined %prec identifiers will not be converted to
3492 errors in Bison 2.5. They will remain warnings, which should be
3493 sufficient for POSIX while avoiding backward compatibility issues.
3495 ** Minor documentation fixes.
3498 * Noteworthy changes in release 2.4.2 (2010-03-20)
3500 ** Some portability problems that resulted in failures and livelocks
3501 in the test suite on some versions of at least Solaris, AIX, HP-UX,
3502 RHEL4, and Tru64 have been addressed. As a result, fatal Bison
3503 errors should no longer cause M4 to report a broken pipe on the
3506 ** "%prec IDENTIFIER" requires IDENTIFIER to be defined separately.
3508 POSIX specifies that an error be reported for any identifier that does
3509 not appear on the LHS of a grammar rule and that is not defined by
3510 %token, %left, %right, or %nonassoc. Bison 2.3b and later lost this
3511 error report for the case when an identifier appears only after a
3512 %prec directive. It is now restored. However, for backward
3513 compatibility with recent Bison releases, it is only a warning for
3514 now. In Bison 2.5 and later, it will return to being an error.
3515 [Between the 2.4.2 and 2.4.3 releases, it was decided that this
3516 warning will not be converted to an error in Bison 2.5.]
3518 ** Detection of GNU M4 1.4.6 or newer during configure is improved.
3520 ** Warnings from gcc's -Wundef option about undefined YYENABLE_NLS,
3521 YYLTYPE_IS_TRIVIAL, and __STRICT_ANSI__ in C/C++ parsers are now
3524 ** %code is now a permanent feature.
3526 A traditional Yacc prologue directive is written in the form:
3530 To provide a more flexible alternative, Bison 2.3b introduced the
3531 %code directive with the following forms for C/C++:
3534 %code requires {CODE}
3535 %code provides {CODE}
3538 These forms are now considered permanent features of Bison. See the
3539 %code entries in the section "Bison Declaration Summary" in the Bison
3540 manual for a summary of their functionality. See the section
3541 "Prologue Alternatives" for a detailed discussion including the
3542 advantages of %code over the traditional Yacc prologue directive.
3544 Bison's Java feature as a whole including its current usage of %code
3545 is still considered experimental.
3547 ** YYFAIL is deprecated and will eventually be removed.
3549 YYFAIL has existed for many years as an undocumented feature of
3550 deterministic parsers in C generated by Bison. Previously, it was
3551 documented for Bison's experimental Java parsers. YYFAIL is no longer
3552 documented for Java parsers and is formally deprecated in both cases.
3553 Users are strongly encouraged to migrate to YYERROR, which is
3556 Like YYERROR, you can invoke YYFAIL from a semantic action in order to
3557 induce a syntax error. The most obvious difference from YYERROR is
3558 that YYFAIL will automatically invoke yyerror to report the syntax
3559 error so that you don't have to. However, there are several other
3560 subtle differences between YYERROR and YYFAIL, and YYFAIL suffers from
3561 inherent flaws when %error-verbose or "#define YYERROR_VERBOSE" is
3562 used. For a more detailed discussion, see:
3564 https://lists.gnu.org/r/bison-patches/2009-12/msg00024.html
3566 The upcoming Bison 2.5 will remove YYFAIL from Java parsers, but
3567 deterministic parsers in C will continue to implement it. However,
3568 because YYFAIL is already flawed, it seems futile to try to make new
3569 Bison features compatible with it. Thus, during parser generation,
3570 Bison 2.5 will produce a warning whenever it discovers YYFAIL in a
3571 rule action. In a later release, YYFAIL will be disabled for
3572 %error-verbose and "#define YYERROR_VERBOSE". Eventually, YYFAIL will
3573 be removed altogether.
3575 There exists at least one case where Bison 2.5's YYFAIL warning will
3576 be a false positive. Some projects add phony uses of YYFAIL and other
3577 Bison-defined macros for the sole purpose of suppressing C
3578 preprocessor warnings (from GCC cpp's -Wunused-macros, for example).
3579 To avoid Bison's future warning, such YYFAIL uses can be moved to the
3580 epilogue (that is, after the second "%%") in the Bison input file. In
3581 this release (2.4.2), Bison already generates its own code to suppress
3582 C preprocessor warnings for YYFAIL, so projects can remove their own
3583 phony uses of YYFAIL if compatibility with Bison releases prior to
3584 2.4.2 is not necessary.
3586 ** Internationalization.
3588 Fix a regression introduced in Bison 2.4: Under some circumstances,
3589 message translations were not installed although supported by the
3593 * Noteworthy changes in release 2.4.1 (2008-12-11)
3595 ** In the GLR defines file, unexpanded M4 macros in the yylval and yylloc
3596 declarations have been fixed.
3598 ** Temporary hack for adding a semicolon to the user action.
3600 Bison used to prepend a trailing semicolon at the end of the user
3601 action for reductions. This allowed actions such as
3603 exp: exp "+" exp { $$ = $1 + $3 };
3607 exp: exp "+" exp { $$ = $1 + $3; };
3609 Some grammars still depend on this "feature". Bison 2.4.1 restores
3610 the previous behavior in the case of C output (specifically, when
3611 neither %language or %skeleton or equivalent command-line options
3612 are used) to leave more time for grammars depending on the old
3613 behavior to be adjusted. Future releases of Bison will disable this
3616 ** A few minor improvements to the Bison manual.
3619 * Noteworthy changes in release 2.4 (2008-11-02)
3621 ** %language is an experimental feature.
3623 We first introduced this feature in test release 2.3b as a cleaner
3624 alternative to %skeleton. Since then, we have discussed the possibility of
3625 modifying its effect on Bison's output file names. Thus, in this release,
3626 we consider %language to be an experimental feature that will likely evolve
3629 ** Forward compatibility with GNU M4 has been improved.
3631 ** Several bugs in the C++ skeleton and the experimental Java skeleton have been
3635 * Noteworthy changes in release 2.3b (2008-05-27)
3637 ** The quotes around NAME that used to be required in the following directive
3640 %define NAME "VALUE"
3642 ** The directive "%pure-parser" is now deprecated in favor of:
3646 which has the same effect except that Bison is more careful to warn about
3647 unreasonable usage in the latter case.
3651 Bison can now generate an LALR(1) parser in C with a push interface. That
3652 is, instead of invoking "yyparse", which pulls tokens from "yylex", you can
3653 push one token at a time to the parser using "yypush_parse", which will
3654 return to the caller after processing each token. By default, the push
3655 interface is disabled. Either of the following directives will enable it:
3657 %define api.push_pull "push" // Just push; does not require yylex.
3658 %define api.push_pull "both" // Push and pull; requires yylex.
3660 See the new section "A Push Parser" in the Bison manual for details.
3662 The current push parsing interface is experimental and may evolve. More user
3663 feedback will help to stabilize it.
3665 ** The -g and --graph options now output graphs in Graphviz DOT format,
3666 not VCG format. Like --graph, -g now also takes an optional FILE argument
3667 and thus cannot be bundled with other short options.
3671 Bison can now generate an LALR(1) parser in Java. The skeleton is
3672 "data/lalr1.java". Consider using the new %language directive instead of
3673 %skeleton to select it.
3675 See the new section "Java Parsers" in the Bison manual for details.
3677 The current Java interface is experimental and may evolve. More user
3678 feedback will help to stabilize it.
3679 Contributed by Paolo Bonzini.
3683 This new directive specifies the programming language of the generated
3684 parser, which can be C (the default), C++, or Java. Besides the skeleton
3685 that Bison uses, the directive affects the names of the generated files if
3686 the grammar file's name ends in ".y".
3688 ** XML Automaton Report
3690 Bison can now generate an XML report of the LALR(1) automaton using the new
3691 "--xml" option. The current XML schema is experimental and may evolve. More
3692 user feedback will help to stabilize it.
3693 Contributed by Wojciech Polak.
3695 ** The grammar file may now specify the name of the parser header file using
3696 %defines. For example:
3700 ** When reporting useless rules, useless nonterminals, and unused terminals,
3701 Bison now employs the terms "useless in grammar" instead of "useless",
3702 "useless in parser" instead of "never reduced", and "unused in grammar"
3703 instead of "unused".
3705 ** Unreachable State Removal
3707 Previously, Bison sometimes generated parser tables containing unreachable
3708 states. A state can become unreachable during conflict resolution if Bison
3709 disables a shift action leading to it from a predecessor state. Bison now:
3711 1. Removes unreachable states.
3713 2. Does not report any conflicts that appeared in unreachable states.
3714 WARNING: As a result, you may need to update %expect and %expect-rr
3715 directives in existing grammar files.
3717 3. For any rule used only in such states, Bison now reports the rule as
3718 "useless in parser due to conflicts".
3720 This feature can be disabled with the following directive:
3722 %define lr.keep_unreachable_states
3724 See the %define entry in the "Bison Declaration Summary" in the Bison manual
3725 for further discussion.
3727 ** Lookahead Set Correction in the ".output" Report
3729 When instructed to generate a ".output" file including lookahead sets
3730 (using "--report=lookahead", for example), Bison now prints each reduction's
3731 lookahead set only next to the associated state's one item that (1) is
3732 associated with the same rule as the reduction and (2) has its dot at the end
3733 of its RHS. Previously, Bison also erroneously printed the lookahead set
3734 next to all of the state's other items associated with the same rule. This
3735 bug affected only the ".output" file and not the generated parser source
3738 ** --report-file=FILE is a new option to override the default ".output" file
3741 ** The "=" that used to be required in the following directives is now
3744 %file-prefix "parser"
3748 ** An Alternative to "%{...%}" -- "%code QUALIFIER {CODE}"
3750 Bison 2.3a provided a new set of directives as a more flexible alternative to
3751 the traditional Yacc prologue blocks. Those have now been consolidated into
3752 a single %code directive with an optional qualifier field, which identifies
3753 the purpose of the code and thus the location(s) where Bison should generate
3756 1. "%code {CODE}" replaces "%after-header {CODE}"
3757 2. "%code requires {CODE}" replaces "%start-header {CODE}"
3758 3. "%code provides {CODE}" replaces "%end-header {CODE}"
3759 4. "%code top {CODE}" replaces "%before-header {CODE}"
3761 See the %code entries in section "Bison Declaration Summary" in the Bison
3762 manual for a summary of the new functionality. See the new section "Prologue
3763 Alternatives" for a detailed discussion including the advantages of %code
3764 over the traditional Yacc prologues.
3766 The prologue alternatives are experimental. More user feedback will help to
3767 determine whether they should become permanent features.
3769 ** Revised warning: unset or unused midrule values
3771 Since Bison 2.2, Bison has warned about midrule values that are set but not
3772 used within any of the actions of the parent rule. For example, Bison warns
3775 exp: '1' { $$ = 1; } '+' exp { $$ = $1 + $4; };
3777 Now, Bison also warns about midrule values that are used but not set. For
3778 example, Bison warns about unset $$ in the midrule action in:
3780 exp: '1' { $1 = 1; } '+' exp { $$ = $2 + $4; };
3782 However, Bison now disables both of these warnings by default since they
3783 sometimes prove to be false alarms in existing grammars employing the Yacc
3784 constructs $0 or $-N (where N is some positive integer).
3786 To enable these warnings, specify the option "--warnings=midrule-values" or
3787 "-W", which is a synonym for "--warnings=all".
3789 ** Default %destructor or %printer with "<*>" or "<>"
3791 Bison now recognizes two separate kinds of default %destructor's and
3794 1. Place "<*>" in a %destructor/%printer symbol list to define a default
3795 %destructor/%printer for all grammar symbols for which you have formally
3796 declared semantic type tags.
3798 2. Place "<>" in a %destructor/%printer symbol list to define a default
3799 %destructor/%printer for all grammar symbols without declared semantic
3802 Bison no longer supports the "%symbol-default" notation from Bison 2.3a.
3803 "<*>" and "<>" combined achieve the same effect with one exception: Bison no
3804 longer applies any %destructor to a midrule value if that midrule value is
3805 not actually ever referenced using either $$ or $n in a semantic action.
3807 The default %destructor's and %printer's are experimental. More user
3808 feedback will help to determine whether they should become permanent
3811 See the section "Freeing Discarded Symbols" in the Bison manual for further
3814 ** %left, %right, and %nonassoc can now declare token numbers. This is required
3815 by POSIX. However, see the end of section "Operator Precedence" in the Bison
3816 manual for a caveat concerning the treatment of literal strings.
3818 ** The nonfunctional --no-parser, -n, and %no-parser options have been
3819 completely removed from Bison.
3822 * Noteworthy changes in release 2.3a (2006-09-13)
3824 ** Instead of %union, you can define and use your own union type
3825 YYSTYPE if your grammar contains at least one <type> tag.
3826 Your YYSTYPE need not be a macro; it can be a typedef.
3827 This change is for compatibility with other Yacc implementations,
3828 and is required by POSIX.
3830 ** Locations columns and lines start at 1.
3831 In accordance with the GNU Coding Standards and Emacs.
3833 ** You may now declare per-type and default %destructor's and %printer's:
3837 %union { char *string; }
3838 %token <string> STRING1
3839 %token <string> STRING2
3840 %type <string> string1
3841 %type <string> string2
3842 %union { char character; }
3843 %token <character> CHR
3844 %type <character> chr
3845 %destructor { free ($$); } %symbol-default
3846 %destructor { free ($$); printf ("%d", @$.first_line); } STRING1 string1
3847 %destructor { } <character>
3849 guarantees that, when the parser discards any user-defined symbol that has a
3850 semantic type tag other than "<character>", it passes its semantic value to
3851 "free". However, when the parser discards a "STRING1" or a "string1", it
3852 also prints its line number to "stdout". It performs only the second
3853 "%destructor" in this case, so it invokes "free" only once.
3855 [Although we failed to mention this here in the 2.3a release, the default
3856 %destructor's and %printer's were experimental, and they were rewritten in
3859 ** Except for LALR(1) parsers in C with POSIX Yacc emulation enabled (with "-y",
3860 "--yacc", or "%yacc"), Bison no longer generates #define statements for
3861 associating token numbers with token names. Removing the #define statements
3862 helps to sanitize the global namespace during preprocessing, but POSIX Yacc
3863 requires them. Bison still generates an enum for token names in all cases.
3865 ** Handling of traditional Yacc prologue blocks is now more consistent but
3866 potentially incompatible with previous releases of Bison.
3868 As before, you declare prologue blocks in your grammar file with the
3869 "%{ ... %}" syntax. To generate the pre-prologue, Bison concatenates all
3870 prologue blocks that you've declared before the first %union. To generate
3871 the post-prologue, Bison concatenates all prologue blocks that you've
3872 declared after the first %union.
3874 Previous releases of Bison inserted the pre-prologue into both the header
3875 file and the code file in all cases except for LALR(1) parsers in C. In the
3876 latter case, Bison inserted it only into the code file. For parsers in C++,
3877 the point of insertion was before any token definitions (which associate
3878 token numbers with names). For parsers in C, the point of insertion was
3879 after the token definitions.
3881 Now, Bison never inserts the pre-prologue into the header file. In the code
3882 file, it always inserts it before the token definitions.
3884 ** Bison now provides a more flexible alternative to the traditional Yacc
3885 prologue blocks: %before-header, %start-header, %end-header, and
3888 For example, the following declaration order in the grammar file reflects the
3889 order in which Bison will output these code blocks. However, you are free to
3890 declare these code blocks in your grammar file in whatever order is most
3894 /* Bison treats this block like a pre-prologue block: it inserts it into
3895 * the code file before the contents of the header file. It does *not*
3896 * insert it into the header file. This is a good place to put
3897 * #include's that you want at the top of your code file. A common
3898 * example is '#include "system.h"'. */
3901 /* Bison inserts this block into both the header file and the code file.
3902 * In both files, the point of insertion is before any Bison-generated
3903 * token, semantic type, location type, and class definitions. This is a
3904 * good place to define %union dependencies, for example. */
3907 /* Unlike the traditional Yacc prologue blocks, the output order for the
3908 * new %*-header blocks is not affected by their declaration position
3909 * relative to any %union in the grammar file. */
3912 /* Bison inserts this block into both the header file and the code file.
3913 * In both files, the point of insertion is after the Bison-generated
3914 * definitions. This is a good place to declare or define public
3915 * functions or data structures that depend on the Bison-generated
3919 /* Bison treats this block like a post-prologue block: it inserts it into
3920 * the code file after the contents of the header file. It does *not*
3921 * insert it into the header file. This is a good place to declare or
3922 * define internal functions or data structures that depend on the
3923 * Bison-generated definitions. */
3926 If you have multiple occurrences of any one of the above declarations, Bison
3927 will concatenate the contents in declaration order.
3929 [Although we failed to mention this here in the 2.3a release, the prologue
3930 alternatives were experimental, and they were rewritten in future versions.]
3932 ** The option "--report=look-ahead" has been changed to "--report=lookahead".
3933 The old spelling still works, but is not documented and may be removed
3934 in a future release.
3937 * Noteworthy changes in release 2.3 (2006-06-05)
3939 ** GLR grammars should now use "YYRECOVERING ()" instead of "YYRECOVERING",
3940 for compatibility with LALR(1) grammars.
3942 ** It is now documented that any definition of YYSTYPE or YYLTYPE should
3943 be to a type name that does not contain parentheses or brackets.
3946 * Noteworthy changes in release 2.2 (2006-05-19)
3948 ** The distribution terms for all Bison-generated parsers now permit
3949 using the parsers in nonfree programs. Previously, this permission
3950 was granted only for Bison-generated LALR(1) parsers in C.
3952 ** %name-prefix changes the namespace name in C++ outputs.
3954 ** The C++ parsers export their token_type.
3956 ** Bison now allows multiple %union declarations, and concatenates
3957 their contents together.
3959 ** New warning: unused values
3960 Right-hand side symbols whose values are not used are reported,
3961 if the symbols have destructors. For instance:
3963 exp: exp "?" exp ":" exp { $1 ? $1 : $3; }
3967 will trigger a warning about $$ and $5 in the first rule, and $3 in
3968 the second ($1 is copied to $$ by the default rule). This example
3969 most likely contains three errors, and could be rewritten as:
3971 exp: exp "?" exp ":" exp
3972 { $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); }
3974 { $$ = $1 ? $1 : $3; if ($1) free ($3); }
3977 However, if the original actions were really intended, memory leaks
3978 and all, the warnings can be suppressed by letting Bison believe the
3979 values are used, e.g.:
3981 exp: exp "?" exp ":" exp { $1 ? $1 : $3; (void) ($$, $5); }
3982 | exp "+" exp { $$ = $1; (void) $3; }
3985 If there are midrule actions, the warning is issued if no action
3986 uses it. The following triggers no warning: $1 and $3 are used.
3988 exp: exp { push ($1); } '+' exp { push ($3); sum (); };
3990 The warning is intended to help catching lost values and memory leaks.
3991 If a value is ignored, its associated memory typically is not reclaimed.
3993 ** %destructor vs. YYABORT, YYACCEPT, and YYERROR.
3994 Destructors are now called when user code invokes YYABORT, YYACCEPT,
3995 and YYERROR, for all objects on the stack, other than objects
3996 corresponding to the right-hand side of the current rule.
3998 ** %expect, %expect-rr
3999 Incorrect numbers of expected conflicts are now actual errors,
4000 instead of warnings.
4002 ** GLR, YACC parsers.
4003 The %parse-params are available in the destructors (and the
4004 experimental printers) as per the documentation.
4006 ** Bison now warns if it finds a stray "$" or "@" in an action.
4008 ** %require "VERSION"
4009 This specifies that the grammar file depends on features implemented
4010 in Bison version VERSION or higher.
4012 ** lalr1.cc: The token and value types are now class members.
4013 The tokens were defined as free form enums and cpp macros. YYSTYPE
4014 was defined as a free form union. They are now class members:
4015 tokens are enumerations of the "yy::parser::token" struct, and the
4016 semantic values have the "yy::parser::semantic_type" type.
4018 If you do not want or can update to this scheme, the directive
4019 '%define "global_tokens_and_yystype" "1"' triggers the global
4020 definition of tokens and YYSTYPE. This change is suitable both
4021 for previous releases of Bison, and this one.
4023 If you wish to update, then make sure older version of Bison will
4024 fail using '%require "2.2"'.
4026 ** DJGPP support added.
4029 * Noteworthy changes in release 2.1 (2005-09-16)
4031 ** The C++ lalr1.cc skeleton supports %lex-param.
4033 ** Bison-generated parsers now support the translation of diagnostics like
4034 "syntax error" into languages other than English. The default
4035 language is still English. For details, please see the new
4036 Internationalization section of the Bison manual. Software
4037 distributors should also see the new PACKAGING file. Thanks to
4038 Bruno Haible for this new feature.
4040 ** Wording in the Bison-generated parsers has been changed slightly to
4041 simplify translation. In particular, the message "memory exhausted"
4042 has replaced "parser stack overflow", as the old message was not
4043 always accurate for modern Bison-generated parsers.
4045 ** Destructors are now called when the parser aborts, for all symbols left
4046 behind on the stack. Also, the start symbol is now destroyed after a
4047 successful parse. In both cases, the behavior was formerly inconsistent.
4049 ** When generating verbose diagnostics, Bison-generated parsers no longer
4050 quote the literal strings associated with tokens. For example, for
4051 a syntax error associated with '%token NUM "number"' they might
4052 print 'syntax error, unexpected number' instead of 'syntax error,
4053 unexpected "number"'.
4056 * Noteworthy changes in release 2.0 (2004-12-25)
4058 ** Possibly-incompatible changes
4060 - Bison-generated parsers no longer default to using the alloca function
4061 (when available) to extend the parser stack, due to widespread
4062 problems in unchecked stack-overflow detection. You can "#define
4063 YYSTACK_USE_ALLOCA 1" to require the use of alloca, but please read
4064 the manual to determine safe values for YYMAXDEPTH in that case.
4066 - Error token location.
4067 During error recovery, the location of the syntax error is updated
4068 to cover the whole sequence covered by the error token: it includes
4069 the shifted symbols thrown away during the first part of the error
4070 recovery, and the lookahead rejected during the second part.
4072 - Semicolon changes:
4073 . Stray semicolons are no longer allowed at the start of a grammar.
4074 . Semicolons are now required after in-grammar declarations.
4076 - Unescaped newlines are no longer allowed in character constants or
4077 string literals. They were never portable, and GCC 3.4.0 has
4078 dropped support for them. Better diagnostics are now generated if
4079 forget a closing quote.
4081 - NUL bytes are no longer allowed in Bison string literals, unfortunately.
4085 - GLR grammars now support locations.
4087 - New directive: %initial-action.
4088 This directive allows the user to run arbitrary code (including
4089 initializing @$) from yyparse before parsing starts.
4091 - A new directive "%expect-rr N" specifies the expected number of
4092 reduce/reduce conflicts in GLR parsers.
4094 - %token numbers can now be hexadecimal integers, e.g., "%token FOO 0x12d".
4095 This is a GNU extension.
4097 - The option "--report=lookahead" was changed to "--report=look-ahead".
4098 [However, this was changed back after 2.3.]
4100 - Experimental %destructor support has been added to lalr1.cc.
4102 - New configure option --disable-yacc, to disable installation of the
4103 yacc command and -ly library introduced in 1.875 for POSIX conformance.
4107 - For now, %expect-count violations are now just warnings, not errors.
4108 This is for compatibility with Bison 1.75 and earlier (when there are
4109 reduce/reduce conflicts) and with Bison 1.30 and earlier (when there
4110 are too many or too few shift/reduce conflicts). However, in future
4111 versions of Bison we plan to improve the %expect machinery so that
4112 these violations will become errors again.
4114 - Within Bison itself, numbers (e.g., goto numbers) are no longer
4115 arbitrarily limited to 16-bit counts.
4117 - Semicolons are now allowed before "|" in grammar rules, as POSIX requires.
4120 * Noteworthy changes in release 1.875 (2003-01-01)
4122 ** The documentation license has been upgraded to version 1.2
4123 of the GNU Free Documentation License.
4125 ** syntax error processing
4127 - In Yacc-style parsers YYLLOC_DEFAULT is now used to compute error
4128 locations too. This fixes bugs in error-location computation.
4131 It is now possible to reclaim the memory associated to symbols
4132 discarded during error recovery. This feature is still experimental.
4135 This new directive is preferred over YYERROR_VERBOSE.
4137 - #defining yyerror to steal internal variables is discouraged.
4138 It is not guaranteed to work forever.
4140 ** POSIX conformance
4142 - Semicolons are once again optional at the end of grammar rules.
4143 This reverts to the behavior of Bison 1.33 and earlier, and improves
4144 compatibility with Yacc.
4146 - "parse error" -> "syntax error"
4147 Bison now uniformly uses the term "syntax error"; formerly, the code
4148 and manual sometimes used the term "parse error" instead. POSIX
4149 requires "syntax error" in diagnostics, and it was thought better to
4152 - The documentation now emphasizes that yylex and yyerror must be
4153 declared before use. C99 requires this.
4155 - Bison now parses C99 lexical constructs like UCNs and
4156 backslash-newline within C escape sequences, as POSIX 1003.1-2001 requires.
4158 - File names are properly escaped in C output. E.g., foo\bar.y is
4159 output as "foo\\bar.y".
4161 - Yacc command and library now available
4162 The Bison distribution now installs a "yacc" command, as POSIX requires.
4163 Also, Bison now installs a small library liby.a containing
4164 implementations of Yacc-compatible yyerror and main functions.
4165 This library is normally not useful, but POSIX requires it.
4167 - Type clashes now generate warnings, not errors.
4169 - If the user does not define YYSTYPE as a macro, Bison now declares it
4170 using typedef instead of defining it as a macro.
4171 For consistency, YYLTYPE is also declared instead of defined.
4173 ** Other compatibility issues
4175 - %union directives can now have a tag before the "{", e.g., the
4176 directive "%union foo {...}" now generates the C code
4177 "typedef union foo { ... } YYSTYPE;"; this is for Yacc compatibility.
4178 The default union tag is "YYSTYPE", for compatibility with Solaris 9 Yacc.
4179 For consistency, YYLTYPE's struct tag is now "YYLTYPE" not "yyltype".
4180 This is for compatibility with both Yacc and Bison 1.35.
4182 - ";" is output before the terminating "}" of an action, for
4183 compatibility with Bison 1.35.
4185 - Bison now uses a Yacc-style format for conflict reports, e.g.,
4186 "conflicts: 2 shift/reduce, 1 reduce/reduce".
4188 - "yystype" and "yyltype" are now obsolescent macros instead of being
4189 typedefs or tags; they are no longer documented and are planned to be
4190 withdrawn in a future release.
4195 Users of Bison have to decide how they handle the portability of the
4198 - "parsing stack overflow..." -> "parser stack overflow"
4199 GLR parsers now report "parser stack overflow" as per the Bison manual.
4201 ** %parse-param and %lex-param
4202 The macros YYPARSE_PARAM and YYLEX_PARAM provide a means to pass
4203 additional context to yyparse and yylex. They suffer from several
4206 - a single argument only can be added,
4207 - their types are weak (void *),
4208 - this context is not passed to ancillary functions such as yyerror,
4209 - only yacc.c parsers support them.
4211 The new %parse-param/%lex-param directives provide a more precise control.
4214 %parse-param {int *nastiness}
4215 %lex-param {int *nastiness}
4216 %parse-param {int *randomness}
4218 results in the following signatures:
4220 int yylex (int *nastiness);
4221 int yyparse (int *nastiness, int *randomness);
4223 or, if both %pure-parser and %locations are used:
4225 int yylex (YYSTYPE *lvalp, YYLTYPE *llocp, int *nastiness);
4226 int yyparse (int *nastiness, int *randomness);
4228 ** Bison now warns if it detects conflicting outputs to the same file,
4229 e.g., it generates a warning for "bison -d -o foo.h foo.y" since
4230 that command outputs both code and header to foo.h.
4232 ** #line in output files
4233 - --no-line works properly.
4235 ** Bison can no longer be built by a K&R C compiler; it requires C89 or
4236 later to be built. This change originally took place a few versions
4237 ago, but nobody noticed until we recently asked someone to try
4238 building Bison with a K&R C compiler.
4241 * Noteworthy changes in release 1.75 (2002-10-14)
4243 ** Bison should now work on 64-bit hosts.
4245 ** Indonesian translation thanks to Tedi Heriyanto.
4248 Fix spurious parse errors.
4251 Some people redefine yyerror to steal yyparse' private variables.
4252 Reenable this trick until an official feature replaces it.
4255 In agreement with POSIX and with other Yaccs, leaving a default
4256 action is valid when $$ is untyped, and $1 typed:
4260 but the converse remains an error:
4264 ** Values of midrule actions
4267 foo: { ... } { $$ = $1; } ...
4269 was incorrectly rejected: $1 is defined in the second midrule
4270 action, and is equal to the $$ of the first midrule action.
4273 * Noteworthy changes in release 1.50 (2002-10-04)
4278 causes Bison to produce a Generalized LR (GLR) parser, capable of handling
4279 almost any context-free grammar, ambiguous or not. The new declarations
4280 %dprec and %merge on grammar rules allow parse-time resolution of
4281 ambiguities. Contributed by Paul Hilfinger.
4283 Unfortunately Bison 1.50 does not work properly on 64-bit hosts
4284 like the Alpha, so please stick to 32-bit hosts for now.
4287 When not in Yacc compatibility mode, when the output file was not
4288 specified, running "bison foo/bar.y" created "foo/bar.c". It
4289 now creates "bar.c".
4292 The undefined token was systematically mapped to 2 which prevented
4293 the use of 2 by the user. This is no longer the case.
4295 ** Unknown token numbers
4296 If yylex returned an out of range value, yyparse could die. This is
4300 According to POSIX, the error token must be 256.
4301 Bison extends this requirement by making it a preference: *if* the
4302 user specified that one of her tokens is numbered 256, then error
4303 will be mapped onto another number.
4305 ** Verbose error messages
4306 They no longer report "..., expecting error or..." for states where
4307 error recovery is possible.
4310 Defaults to "$end" instead of "$".
4312 ** Error recovery now conforms to documentation and to POSIX
4313 When a Bison-generated parser encounters a syntax error, it now pops
4314 the stack until it finds a state that allows shifting the error
4315 token. Formerly, it popped the stack until it found a state that
4316 allowed some non-error action other than a default reduction on the
4317 error token. The new behavior has long been the documented behavior,
4318 and has long been required by POSIX. For more details, please see
4319 Paul Eggert, "Reductions during Bison error handling" (2002-05-20)
4320 <https://lists.gnu.org/r/bug-bison/2002-05/msg00038.html>.
4323 Popped tokens and nonterminals are now reported.
4326 Larger grammars are now supported (larger token numbers, larger grammar
4327 size (= sum of the LHS and RHS lengths), larger LALR tables).
4328 Formerly, many of these numbers ran afoul of 16-bit limits;
4329 now these limits are 32 bits on most hosts.
4331 ** Explicit initial rule
4332 Bison used to play hacks with the initial rule, which the user does
4333 not write. It is now explicit, and visible in the reports and
4337 Before, Bison reported the useless rules, but, although not used,
4338 included them in the parsers. They are now actually removed.
4340 ** Useless rules, useless nonterminals
4341 They are now reported, as a warning, with their locations.
4343 ** Rules never reduced
4344 Rules that can never be reduced because of conflicts are now
4347 ** Incorrect "Token not used"
4348 On a grammar such as
4350 %token useless useful
4352 exp: '0' %prec useful;
4354 where a token was used to set the precedence of the last rule,
4355 bison reported both "useful" and "useless" as useless tokens.
4357 ** Revert the C++ namespace changes introduced in 1.31
4358 as they caused too many portability hassles.
4360 ** Default locations
4361 By an accident of design, the default computation of @$ was
4362 performed after another default computation was performed: @$ = @1.
4363 The latter is now removed: YYLLOC_DEFAULT is fully responsible of
4364 the computation of @$.
4366 ** Token end-of-file
4367 The token end of file may be specified by the user, in which case,
4368 the user symbol is used in the reports, the graphs, and the verbose
4369 error messages instead of "$end", which remains being the default.
4373 %token MYEOF 0 "end of file"
4376 This old option, which has been broken for ages, is removed.
4379 Brazilian Portuguese, thanks to Alexandre Folle de Menezes.
4380 Croatian, thanks to Denis Lackovic.
4382 ** Incorrect token definitions
4385 bison used to output
4388 ** Token definitions as enums
4389 Tokens are output both as the traditional #define's, and, provided
4390 the compiler supports ANSI C or is a C++ compiler, as enums.
4391 This lets debuggers display names instead of integers.
4394 In addition to --verbose, bison supports --report=THINGS, which
4395 produces additional information:
4397 complete the core item sets with their closure
4398 - lookahead [changed to "look-ahead" in 1.875e through 2.3, but changed back]
4399 explicitly associate lookahead tokens to items
4401 describe shift/reduce conflicts solving.
4402 Bison used to systematically output this information on top of
4403 the report. Solved conflicts are now attached to their states.
4406 Previous versions don't complain when there is a type clash on
4407 the default action if the rule has a midrule action, such as in:
4415 ** GNU M4 is now required when using Bison.
4418 * Noteworthy changes in release 1.35 (2002-03-25)
4421 Some projects use Bison's C parser with C++ compilers, and define
4422 YYSTYPE as a class. The recent adjustment of C parsers for data
4423 alignment and 64 bit architectures made this impossible.
4425 Because for the time being no real solution for C++ parser
4426 generation exists, kludges were implemented in the parser to
4427 maintain this use. In the future, when Bison has C++ parsers, this
4428 kludge will be disabled.
4430 This kludge also addresses some C++ problems when the stack was
4434 * Noteworthy changes in release 1.34 (2002-03-12)
4436 ** File name clashes are detected
4437 $ bison foo.y -d -o foo.x
4438 fatal error: header and parser would both be named "foo.x"
4440 ** A missing ";" at the end of a rule triggers a warning
4441 In accordance with POSIX, and in agreement with other
4442 Yacc implementations, Bison will mandate this semicolon in the near
4443 future. This eases the implementation of a Bison parser of Bison
4444 grammars by making this grammar LALR(1) instead of LR(2). To
4445 facilitate the transition, this release introduces a warning.
4447 ** Revert the C++ namespace changes introduced in 1.31, as they caused too
4448 many portability hassles.
4450 ** DJGPP support added.
4452 ** Fix test suite portability problems.
4455 * Noteworthy changes in release 1.33 (2002-02-07)
4458 Groff could not be compiled for the definition of size_t was lacking
4459 under some conditions.
4465 * Noteworthy changes in release 1.32 (2002-01-23)
4467 ** Fix Yacc output file names
4469 ** Portability fixes
4471 ** Italian, Dutch translations
4474 * Noteworthy changes in release 1.31 (2002-01-14)
4478 ** GNU Gettext and %expect
4479 GNU Gettext asserts 10 s/r conflicts, but there are 7. Now that
4480 Bison dies on incorrect %expectations, we fear there will be
4481 too many bug reports for Gettext, so _for the time being_, %expect
4482 does not trigger an error when the input file is named "plural.y".
4484 ** Use of alloca in parsers
4485 If YYSTACK_USE_ALLOCA is defined to 0, then the parsers will use
4486 malloc exclusively. Since 1.29, but was not NEWS'ed.
4488 alloca is used only when compiled with GCC, to avoid portability
4491 ** yyparse now returns 2 if memory is exhausted; formerly it dumped core.
4493 ** When the generated parser lacks debugging code, YYDEBUG is now 0
4494 (as POSIX requires) instead of being undefined.
4497 Bison has always permitted actions such as { $$ = $1 }: it adds the
4498 ending semicolon. Now if in Yacc compatibility mode, the semicolon
4499 is no longer output: one has to write { $$ = $1; }.
4501 ** Better C++ compliance
4502 The output parsers try to respect C++ namespaces.
4503 [This turned out to be a failed experiment, and it was reverted later.]
4506 Fixed bugs when reporting useless nonterminals.
4509 The parsers work properly on 64 bit hosts.
4512 Some calls to strerror resulted in scrambled or missing error messages.
4515 When the number of shift/reduce conflicts is correct, don't issue
4518 ** The verbose report includes the rule line numbers.
4520 ** Rule line numbers are fixed in traces.
4522 ** Swedish translation
4525 Verbose parse error messages from the parsers are better looking.
4526 Before: parse error: unexpected `'/'', expecting `"number"' or `'-'' or `'(''
4527 Now: parse error: unexpected '/', expecting "number" or '-' or '('
4529 ** Fixed parser memory leaks.
4530 When the generated parser was using malloc to extend its stacks, the
4531 previous allocations were not freed.
4533 ** Fixed verbose output file.
4534 Some newlines were missing.
4535 Some conflicts in state descriptions were missing.
4537 ** Fixed conflict report.
4538 Option -v was needed to get the result.
4542 Mismatches are errors, not warnings.
4544 ** Fixed incorrect processing of some invalid input.
4546 ** Fixed CPP guards: 9foo.h uses BISON_9FOO_H instead of 9FOO_H.
4548 ** Fixed some typos in the documentation.
4550 ** %token MY_EOF 0 is supported.
4551 Before, MY_EOF was silently renumbered as 257.
4553 ** doc/refcard.tex is updated.
4555 ** %output, %file-prefix, %name-prefix.
4559 New, aliasing "--output-file".
4562 * Noteworthy changes in release 1.30 (2001-10-26)
4564 ** "--defines" and "--graph" have now an optional argument which is the
4565 output file name. "-d" and "-g" do not change; they do not take any
4568 ** "%source_extension" and "%header_extension" are removed, failed
4571 ** Portability fixes.
4574 * Noteworthy changes in release 1.29 (2001-09-07)
4576 ** The output file does not define const, as this caused problems when used
4577 with common autoconfiguration schemes. If you still use ancient compilers
4578 that lack const, compile with the equivalent of the C compiler option
4579 "-Dconst=". Autoconf's AC_C_CONST macro provides one way to do this.
4581 ** Added "-g" and "--graph".
4583 ** The Bison manual is now distributed under the terms of the GNU FDL.
4585 ** The input and the output files has automatically a similar extension.
4587 ** Russian translation added.
4589 ** NLS support updated; should hopefully be less troublesome.
4591 ** Added the old Bison reference card.
4593 ** Added "--locations" and "%locations".
4595 ** Added "-S" and "--skeleton".
4597 ** "%raw", "-r", "--raw" is disabled.
4599 ** Special characters are escaped when output. This solves the problems
4600 of the #line lines with path names including backslashes.
4603 "%yacc", "%fixed_output_files", "%defines", "%no_parser", "%verbose",
4604 "%debug", "%source_extension" and "%header_extension".
4607 Automatic location tracking.
4610 * Noteworthy changes in release 1.28 (1999-07-06)
4612 ** Should compile better now with K&R compilers.
4616 ** Fixed a problem with escaping the double quote character.
4618 ** There is now a FAQ.
4621 * Noteworthy changes in release 1.27
4623 ** The make rule which prevented bison.simple from being created on
4624 some systems has been fixed.
4627 * Noteworthy changes in release 1.26
4629 ** Bison now uses Automake.
4631 ** New mailing lists: <bug-bison@gnu.org> and <help-bison@gnu.org>.
4633 ** Token numbers now start at 257 as previously documented, not 258.
4635 ** Bison honors the TMPDIR environment variable.
4637 ** A couple of buffer overruns have been fixed.
4639 ** Problems when closing files should now be reported.
4641 ** Generated parsers should now work even on operating systems which do
4642 not provide alloca().
4645 * Noteworthy changes in release 1.25 (1995-10-16)
4647 ** Errors in the input grammar are not fatal; Bison keeps reading
4648 the grammar file, and reports all the errors found in it.
4650 ** Tokens can now be specified as multiple-character strings: for
4651 example, you could use "<=" for a token which looks like <=, instead
4652 of choosing a name like LESSEQ.
4654 ** The %token_table declaration says to write a table of tokens (names
4655 and numbers) into the parser file. The yylex function can use this
4656 table to recognize multiple-character string tokens, or for other
4659 ** The %no_lines declaration says not to generate any #line preprocessor
4660 directives in the parser file.
4662 ** The %raw declaration says to use internal Bison token numbers, not
4663 Yacc-compatible token numbers, when token names are defined as macros.
4665 ** The --no-parser option produces the parser tables without including
4666 the parser engine; a project can now use its own parser engine.
4667 The actions go into a separate file called NAME.act, in the form of
4668 a switch statement body.
4671 * Noteworthy changes in release 1.23
4673 The user can define YYPARSE_PARAM as the name of an argument to be
4674 passed into yyparse. The argument should have type void *. It should
4675 actually point to an object. Grammar actions can access the variable
4676 by casting it to the proper pointer type.
4678 Line numbers in output file corrected.
4681 * Noteworthy changes in release 1.22
4683 --help option added.
4686 * Noteworthy changes in release 1.20
4688 Output file does not redefine const for C++.
4692 LocalWords: yacc YYBACKUP glr GCC lalr ArrayIndexOutOfBoundsException nullptr
4693 LocalWords: cplusplus liby rpl fprintf mfcalc Wyacc stmt cond expr mk sym lr
4694 LocalWords: IELR ielr Lookahead YYERROR nonassoc LALR's api lookaheads yychar
4695 LocalWords: destructor lookahead YYRHSLOC YYLLOC Rhs ifndef YYFAIL cpp sr rr
4696 LocalWords: preprocessor initializer Wno Wnone Werror FreeBSD prec livelocks
4697 LocalWords: Solaris AIX UX RHEL Tru LHS gcc's Wundef YYENABLE NLS YYLTYPE VCG
4698 LocalWords: yyerror cpp's Wunused yylval yylloc prepend yyparse yylex yypush
4699 LocalWords: Graphviz xml nonterminals midrule destructor's YYSTYPE typedef ly
4700 LocalWords: CHR chr printf stdout namespace preprocessing enum pre include's
4701 LocalWords: YYRECOVERING nonfree destructors YYABORT YYACCEPT params enums de
4702 LocalWords: struct yystype DJGPP lex param Haible NUM alloca YYSTACK NUL goto
4703 LocalWords: YYMAXDEPTH Unescaped UCNs YYLTYPE's yyltype typedefs inline Yaccs
4704 LocalWords: Heriyanto Reenable dprec Hilfinger Eggert MYEOF Folle Menezes EOF
4705 LocalWords: Lackovic define's itemset Groff Gettext malloc NEWS'ed YYDEBUG YY
4706 LocalWords: namespaces strerror const autoconfiguration Dconst Autoconf's FDL
4707 LocalWords: Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
4708 LocalWords: extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
4709 LocalWords: lang yyoutput dvi html ps POSIX lvalp llocp Wother nterm arg init
4710 LocalWords: TOK calc yyo fval Wconflicts parsers yystackp yyval yynerrs
4711 LocalWords: Théophile Ranquet Santet fno fnone stype associativity Tolmer
4712 LocalWords: Wprecedence Rassoul Wempty Paolo Bonzini parser's Michiel loc
4713 LocalWords: redeclaration sval fcaret reentrant XSLT xsl Wmaybe yyvsp Tedi
4714 LocalWords: pragmas noreturn untyped Rozenman unexpanded Wojciech Polak
4715 LocalWords: Alexandre MERCHANTABILITY yytype emplace ptr automove lvalues
4716 LocalWords: nonterminal yy args Pragma dereference yyformat rhs docdir bw
4717 LocalWords: Redeclarations rpcalc Autoconf YFLAGS Makefiles PROG DECL num
4718 LocalWords: Heimbigner AST src ast Makefile srcdir MinGW xxlex XXSTYPE CVE
4719 LocalWords: XXLTYPE strictfp IDEs ffixit fdiagnostics parseable fixits
4720 LocalWords: Wdeprecated yytext Variadic variadic yyrhs yyphrs RCS README
4721 LocalWords: noexcept constexpr ispell american deprecations backend Teoh
4722 LocalWords: YYPRINT Mangold Bonzini's Wdangling exVal baz checkable gcc
4723 LocalWords: fsanitize Vogelsgesang lis redeclared stdint automata yytname
4724 LocalWords: yysymbol yytnamerr yyreport ctx ARGMAX yysyntax stderr LPAREN
4725 LocalWords: symrec yypcontext TOKENMAX yyexpected YYEMPTY yypstate YYEOF
4726 LocalWords: autocompletion bistromathic submessages Cayuela lexcalc hoc
4727 LocalWords: yytoken YYUNDEF YYerror basename Automake's UTF ifdef ffile
4728 LocalWords: gotos readline Imbimbo Wcounterexamples Wcex Nonunifying rcex
4729 LocalWords: Vais xsltproc YYNOMEM YYLOCATION signedness YYBISON MITRE's
4730 LocalWords: libreadline YYMALLOC YYFREE MSVC redefinitions POSIXLY
4733 ispell-dictionary: "american"
4738 Copyright (C) 1995-2015, 2018-2021 Free Software Foundation, Inc.
4740 This file is part of Bison, the GNU Parser Generator.
4742 Permission is granted to copy, distribute and/or modify this document
4743 under the terms of the GNU Free Documentation License, Version 1.3 or
4744 any later version published by the Free Software Foundation; with no
4745 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
4746 Texts. A copy of the license is included in the "GNU Free
4747 Documentation License" file as part of this distribution.