3 * Noteworthy changes in release ?.? (????-??-??) [?]
5 The `cex.timeout` %define variable allows to control when we give up
6 finding a unifying counterexample. For instance `bison -Wcex
7 -Dcex.timeout=.5 gram.y` to limit to 1/2s.
9 The C++ skeletons now expose copy and move operators for symbols.
11 Fixed portability issues of the test suite on Solaris.
13 Fixed spurious warnings about input containing `m4_` or `b4_`.
15 Fixed assertion violations found by fuzzing.
17 Fixed issues with the D skeleton.
19 Fixed new compiler warnings in the generated parsers (yacc.c, lalr1.cc,
22 * Noteworthy changes in release 3.8.2 (2021-09-25) [stable]
24 Fixed portability issues of bison on Cygwin.
26 Improvements in glr2.cc: add support for custom error messages (`%define
27 parse.error custom`), allow linking several parsers together.
29 * Noteworthy changes in release 3.8.1 (2021-09-11) [stable]
31 The generation of prototypes for yylex and yyerror in Yacc mode is
32 breaking existing grammar files. To avoid breaking too many grammars, the
33 prototypes are now generated when `-y/--yacc` is used *and* the
34 `POSIXLY_CORRECT` environment variable is defined.
36 Avoid using `-y`/`--yacc` simply to comply with Yacc's file name
37 conventions, rather, use `-o y.tab.c`. Autoconf's AC_PROG_YACC macro uses
38 `-y`. Avoid it if possible, for instance by using gnulib's gl_PROG_BISON.
40 * Noteworthy changes in release 3.8 (2021-09-07) [stable]
42 ** Backward incompatible changes
44 In conformance with the recommendations of the Graphviz team
45 (https://marc.info/?l=graphviz-devel&m=129418103126092), `-g`/`--graph`
46 now generates a *.gv file by default, instead of *.dot. A transition
49 To comply with the latest POSIX standard, in Yacc compatibility mode
50 (options `-y`/`--yacc`) Bison now generates prototypes for yyerror and
51 yylex. In some situations, this is breaking compatibility: if the user
52 has already declared these functions but with some differences (e.g., to
53 declare them as static, or to use specific attributes), the generated
54 parser will fail to compile. To disable these prototypes, #define yyerror
55 (to `yyerror`), and likewise for yylex.
57 ** Deprecated features
59 Support for the YYPRINT macro is removed. It worked only with yacc.c and
60 only for tokens. It was obsoleted by %printer, introduced in Bison 1.50
63 It has always been recommended to prefer `%define api.value.type foo` to
64 `#define YYSTYPE foo`. The latter is supported in C for compatibility
65 with Yacc, but not in C++. Warnings are now issued if `#define YYSTYPE`
66 is used in C++, and eventually support will be removed.
68 In C++ code, prefer value_type to semantic_type to denote the semantic
69 value type, which is specified by the `api.value.type` %define variable.
73 *** A skeleton for the D programming language
75 The "lalr1.d" skeleton is now officially part of Bison.
77 It was originally contributed by Oliver Mangold, based on Paolo Bonzini's
78 lalr1.java, and was improved by H. S. Teoh. Adela Vais then took over
79 maintenance and invested a lot of efforts to complete, test and document
82 It now supports all the bells and whistles of the other deterministic
83 parsers, which include: pull/push interfaces, verbose and custom error
84 messages, lookahead correction, token constructors, internationalization,
85 locations, printers, token and symbol prefixes, etc.
87 Two examples demonstrate the D parsers: a basic one (examples/d/simple),
88 and an advanced one (examples/d/calc).
90 *** Option -H, --header and directive %header
92 The option `-H`/`--header` supersedes the option `--defines`, and the
93 directive %header supersedes %defines. Both `--defines` and `%defines`
94 are, of course, maintained for backward compatibility.
98 Since version 2.4 Bison can be used to generate HTML reports. However it
99 was a two-step process: first bison must be invoked with option `--xml`,
100 and then xsltproc must be run to the convert the XML reports into HTML.
102 The new option `--html` combines these steps. The xsltproc program must
105 *** A C++ native GLR parser
107 A new version of the C++ GLR parser was added: "glr2.cc". It generates
108 "true C++11", instead of a C++ wrapper around a C parser as does the
109 existing "glr.cc" parser. As a first significant consequence, it supports
110 `%define api.value.type variant`, contrary to glr.cc.
112 It should be upward compatible in terms of interface, feature and
113 performance to "glr.cc". To try it out, simply use
117 It will eventually replace "glr.cc". However we need user feedback on
118 this skeleton. _Please_ report your results and comments about it.
122 Counterexamples now show the rule numbers, and always show ε for rules
123 with an empty right-hand side. For instance
135 *** Lookahead correction in Java
137 The Java skeleton (lalr1.java) now supports LAC, via the `parse.lac`
140 *** Abort parsing for memory exhaustion (C)
142 User actions may now use `YYNOMEM` (similar to `YYACCEPT` and `YYABORT`)
143 to abort the current parse with memory exhaustion.
145 *** Printing locations in debug traces (C)
147 The `YYLOCATION_PRINT(File, Loc)` macro prints a location. It is defined
148 when (i) locations are enabled, (ii) the default type for locations is
149 used, (iii) debug traces are enabled, and (iv) `YYLOCATION_PRINT` is not
152 Users may define `YYLOCATION_PRINT` to cover other cases.
156 There were no debug traces for deferred calls to user actions. They are
160 * Noteworthy changes in release 3.7.6 (2021-03-08) [stable]
164 *** Reused Push Parsers
166 When a push-parser state structure is used for multiple parses, it was
167 possible for some state to leak from one run into the following one.
169 *** Fix Table Generation
171 In some very rare conditions, when there are many useless tokens, it was
172 possible to generate incorrect parsers.
175 * Noteworthy changes in release 3.7.5 (2021-01-24) [stable]
179 *** Counterexample Generation
181 In some cases counterexample generation could crash. This is fixed.
183 *** Fix Table Generation
185 In some very rare conditions, when there are many useless tokens, it was
186 possible to generate incorrect parsers.
188 *** GLR parsers now support %merge together with api.value.type=union.
190 *** C++ parsers use noexcept in more places.
192 *** Generated parsers avoid some warnings about signedness issues.
194 *** C-language parsers now avoid warnings from pedantic clang.
196 *** C-language parsers now work around quirks of HP-UX 11.23 (2003).
199 * Noteworthy changes in release 3.7.4 (2020-11-14) [stable]
203 *** Bug fixes in yacc.c
205 In Yacc mode, all the tokens are defined twice: once as an enum, and then
206 as a macro. YYEMPTY was missing its macro.
208 *** Bug fixes in lalr1.cc
210 The lalr1.cc skeleton used to emit internal assertions (using YY_ASSERT)
211 even when the `parse.assert` %define variable is not enabled. It no
214 The private internal macro YY_ASSERT now obeys the `api.prefix` %define
217 When there is a very large number of tokens, some assertions could be long
218 enough to hit arbitrary limits in Visual C++. They have been rewritten to
219 work around this limitation.
223 The YYBISON macro in generated "regular C parsers" (from the "yacc.c"
224 skeleton) used to be defined to 1. It is now defined to the version of
225 Bison as an integer (e.g., 30704 for version 3.7.4).
228 * Noteworthy changes in release 3.7.3 (2020-10-13) [stable]
232 Fix concurrent build issues.
234 The bison executable is no longer linked uselessly against libreadline.
236 Fix incorrect use of yytname in glr.cc.
239 * Noteworthy changes in release 3.7.2 (2020-09-05) [stable]
241 This release of Bison fixes all known bugs reported for Bison in MITRE's
242 Common Vulnerabilities and Exposures (CVE) system. These vulnerabilities
243 are only about bison-the-program itself, not the generated code.
245 Although these bugs are typically irrelevant to how Bison is used, they
246 are worth fixing if only to give users peace of mind.
248 There is no known vulnerability in the generated parsers.
252 Fix concurrent build issues (introduced in Bison 3.5).
254 Push parsers always use YYMALLOC/YYFREE (no direct calls to malloc/free).
256 Fix portability issues of the test suite, and of bison itself.
258 Some unlikely crashes found by fuzzing have been fixed. This is only
259 about bison itself, not the generated parsers.
262 * Noteworthy changes in release 3.7.1 (2020-08-02) [stable]
266 Crash when a token alias contains a NUL byte.
268 Portability issues with libtextstyle.
270 Portability issues of Bison itself with MSVC.
274 Improvements and fixes in the documentation.
276 More precise location about symbol type redefinitions.
279 * Noteworthy changes in release 3.7 (2020-07-23) [stable]
281 ** Deprecated features
283 The YYPRINT macro, which works only with yacc.c and only for tokens, was
284 obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
285 It is deprecated and its support will be removed eventually.
287 In conformance with the recommendations of the Graphviz team, in the next
288 version Bison the option `--graph` will generate a *.gv file by default,
289 instead of *.dot. A transition started in Bison 3.4.
293 *** Counterexample Generation
295 Contributed by Vincent Imbimbo.
297 When given `-Wcounterexamples`/`-Wcex`, bison will now output
298 counterexamples for conflicts.
300 **** Unifying Counterexamples
302 Unifying counterexamples are strings which can be parsed in two ways due
303 to the conflict. For example on a grammar that contains the usual
304 "dangling else" ambiguity:
307 else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
308 else.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
311 else.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
312 else.y: warning: shift/reduce conflict on token "else" [-Wcounterexamples]
313 Example: "if" exp "then" "if" exp "then" exp • "else" exp
316 ↳ "if" exp "then" exp
317 ↳ "if" exp "then" exp • "else" exp
318 Example: "if" exp "then" "if" exp "then" exp • "else" exp
321 ↳ "if" exp "then" exp "else" exp
322 ↳ "if" exp "then" exp •
324 When text styling is enabled, colors are used in the examples and the
325 derivations to highlight the structure of both analyses. In this case,
327 "if" exp "then" [ "if" exp "then" exp • ] "else" exp
331 "if" exp "then" [ "if" exp "then" exp • "else" exp ]
334 The counterexamples are "focused", in two different ways. First, they do
335 not clutter the output with all the derivations from the start symbol,
336 rather they start on the "conflicted nonterminal". They go straight to the
337 point. Second, they don't "expand" nonterminal symbols uselessly.
339 **** Nonunifying Counterexamples
341 In the case of the dangling else, Bison found an example that can be
342 parsed in two ways (therefore proving that the grammar is ambiguous).
343 When it cannot find such an example, it instead generates two examples
344 that are the same up until the dot:
347 foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
348 foo.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
349 foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
354 foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
355 foo.y: warning: shift/reduce conflict on token ID [-Wcounterexamples]
356 First example: expr • ID ',' ID $end
363 Second example: expr • ID $end
369 foo.y:4.4-7: warning: rule useless in parser due to conflicts [-Wother]
373 In these cases, the parser usually doesn't have enough lookahead to
374 differentiate the two given examples.
378 Counterexamples are also included in the report when given
379 `--report=counterexamples`/`-rcex` (or `--report=all`), with more
384 1 exp: "if" exp "then" exp • [$end, "then", "else"]
385 2 | "if" exp "then" exp • "else" exp
387 "else" shift, and go to state 8
389 "else" [reduce using rule 1 (exp)]
390 $default reduce using rule 1 (exp)
392 shift/reduce conflict on token "else":
393 1 exp: "if" exp "then" exp •
394 2 exp: "if" exp "then" exp • "else" exp
395 Example: "if" exp "then" "if" exp "then" exp • "else" exp
398 ↳ "if" exp "then" exp
399 ↳ "if" exp "then" exp • "else" exp
400 Example: "if" exp "then" "if" exp "then" exp • "else" exp
403 ↳ "if" exp "then" exp "else" exp
404 ↳ "if" exp "then" exp •
406 *** File prefix mapping
408 Contributed by Joshua Watt.
410 Bison learned a new argument, `--file-prefix-map OLD=NEW`. Any file path
411 in the output (specifically `#line` directives and `#ifdef` header guards)
412 that begins with the prefix OLD will have it replaced with the prefix NEW,
413 similar to the `-ffile-prefix-map` in GCC. This option can be used to
414 make bison output reproducible.
420 When text styling is enabled and the terminal supports it, the warnings
421 now include hyperlinks to the documentation.
423 *** Relocatable installation
425 When installed to be relocatable (via `configure --enable-relocatable`),
426 bison will now also look for a relocated m4.
430 The `filename_type` %define variable was renamed `api.filename.type`.
433 %define filename_type "symbol"
437 %define api.filename.type {symbol}
439 (Or let `bison --update` do it for you).
441 It now defaults to `const std::string` instead of `std::string`.
443 *** Deprecated %define variable names
445 The following variables have been renamed for consistency. Backward
446 compatibility is ensured, but upgrading is recommended.
448 filename_type -> api.filename.type
449 package -> api.package
451 *** Push parsers no longer clear their state when parsing is finished
453 Previously push-parsers cleared their state when parsing was finished (on
454 success and on failure). This made it impossible to check if there were
455 parse errors, since `yynerrs` was also reset. This can be especially
456 troublesome when used in autocompletion, since a parser with error
457 recovery would suggest (irrelevant) expected tokens even if there were
460 Now the parser state can be examined when parsing is finished. The parser
461 state is reset when starting a new parse.
467 The bistromathic demonstrates %param and how to quote sources in the error
471 1.5-7: syntax error: expected end of file or + or - or * or / or ^ before number
477 *** Include the generated header (yacc.c)
479 Historically, when --defines was used, bison generated a header and pasted
480 an exact copy of it into the generated parser implementation file. Since
481 Bison 3.4 it is possible to specify that the header should be `#include`d,
482 and how. For instance
484 %define api.header.include {"parse.h"}
488 %define api.header.include {<parser/parse.h>}
490 Now api.header.include defaults to `"header-basename"`, as was intended in
491 Bison 3.4, where `header-basename` is the basename of the generated
492 header. This is disabled when the generated header is `y.tab.h`, to
493 comply with Automake's ylwrap.
495 *** String aliases are faithfully propagated
497 Bison used to interpret user strings (i.e., decoding backslash escapes)
498 when reading them, and to escape them (i.e., issue non-printable
499 characters as backslash escapes, taking the locale into account) when
500 outputting them. As a consequence non-ASCII strings (say in UTF-8) ended
501 up "ciphered" as sequences of backslash escapes. This happened not only
502 in the generated sources (where the compiler will reinterpret them), but
503 also in all the generated reports (text, xml, html, dot, etc.). Reports
504 were therefore not readable when string aliases were not pure ASCII.
505 Worse yet: the output depended on the user's locale.
507 Now Bison faithfully treats the string aliases exactly the way the user
508 spelled them. This fixes all the aforementioned problems. However, now,
509 string aliases semantically equivalent but syntactically different (e.g.,
510 "A", "\x41", "\101") are considered to be different.
512 *** Crash when generating IELR
514 An old, well hidden, bug in the generation of IELR parsers was fixed.
517 * Noteworthy changes in release 3.6.4 (2020-06-15) [stable]
521 In glr.cc some internal macros leaked in the user's code, and could damage
522 access to the token kinds.
525 * Noteworthy changes in release 3.6.3 (2020-06-03) [stable]
529 Incorrect comments in the generated parsers.
531 Warnings in push parsers (yacc.c).
533 Incorrect display of gotos in LAC traces (lalr1.cc).
536 * Noteworthy changes in release 3.6.2 (2020-05-17) [stable]
540 Some tests were fixed.
542 When token aliases contain comment delimiters:
544 %token FOO "/* foo */"
546 bison used to emit "nested" comments, which is invalid C.
549 * Noteworthy changes in release 3.6.1 (2020-05-10) [stable]
553 Restored ANSI-C compliance in yacc.c.
555 GNU readline portability issues.
557 In C++, yy::parser::symbol_name is now a public member, as was intended.
561 In C++, yy::parser::symbol_type now has a public name() member function.
564 * Noteworthy changes in release 3.6 (2020-05-08) [stable]
566 ** Backward incompatible changes
568 TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose".
570 The YYERROR_VERBOSE macro is no longer supported; the parsers that still
571 depend on it will now produce Yacc-like error messages (just "syntax
572 error"). It was superseded by the "%error-verbose" directive in Bison
573 1.875 (2003-01-01). Bison 2.6 (2012-07-19) clearly announced that support
574 for YYERROR_VERBOSE would be removed. Note that since Bison 3.0
575 (2013-07-25), "%error-verbose" is deprecated in favor of "%define
576 parse.error verbose".
578 ** Deprecated features
580 The YYPRINT macro, which works only with yacc.c and only for tokens, was
581 obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
582 It is deprecated and its support will be removed eventually.
586 *** Improved syntax error messages
588 Two new values for the %define parse.error variable offer more control to
589 the user. Available in all the skeletons (C, C++, Java).
591 **** %define parse.error detailed
593 The behavior of "%define parse.error detailed" is closely resembling that
594 of "%define parse.error verbose" with a few exceptions. First, it is safe
595 to use non-ASCII characters in token aliases (with 'verbose', the result
596 depends on the locale with which bison was run). Second, a yysymbol_name
597 function is exposed to the user, instead of the yytnamerr function and the
598 yytname table. Third, token internationalization is supported (see
601 **** %define parse.error custom
603 With this directive, the user forges and emits the syntax error message
604 herself by defining the yyreport_syntax_error function. A new type,
605 yypcontext_t, captures the circumstances of the error, and provides the
606 user with functions to get details, such as yypcontext_expected_tokens to
607 get the list of expected token kinds.
609 A possible implementation of yyreport_syntax_error is:
612 yyreport_syntax_error (const yypcontext_t *ctx)
615 YY_LOCATION_PRINT (stderr, *yypcontext_location (ctx));
616 fprintf (stderr, ": syntax error");
617 // Report the tokens expected at this point.
619 enum { TOKENMAX = 10 };
620 yysymbol_kind_t expected[TOKENMAX];
621 int n = yypcontext_expected_tokens (ctx, expected, TOKENMAX);
623 // Forward errors to yyparse.
626 for (int i = 0; i < n; ++i)
627 fprintf (stderr, "%s %s",
628 i == 0 ? ": expected" : " or", yysymbol_name (expected[i]));
630 // Report the unexpected token.
632 yysymbol_kind_t lookahead = yypcontext_token (ctx);
633 if (lookahead != YYSYMBOL_YYEMPTY)
634 fprintf (stderr, " before %s", yysymbol_name (lookahead));
636 fprintf (stderr, "\n");
640 **** Token aliases internationalization
642 When the %define variable parse.error is set to `custom` or `detailed`,
643 one may specify which token aliases are to be translated using _(). For
655 In that case the user must define _() and N_(), and yysymbol_name returns
656 the translated symbol (i.e., it returns '_("variable")' rather that
657 '"variable"'). In Java, the user must provide an i18n() function.
659 *** List of expected tokens (yacc.c)
661 Push parsers may invoke yypstate_expected_tokens at any point during
662 parsing (including even before submitting the first token) to get the list
663 of possible tokens. This feature can be used to propose autocompletion
664 (see below the "bistromathic" example).
666 It makes little sense to use this feature without enabling LAC (lookahead
669 *** Returning the error token
671 When the scanner returns an invalid token or the undefined token
672 (YYUNDEF), the parser generates an error message and enters error
673 recovery. Because of that error message, most scanners that find lexical
674 errors generate an error message, and then ignore the invalid input
675 without entering the error-recovery.
677 The scanners may now return YYerror, the error token, to enter the
678 error-recovery mode without triggering an additional error message. See
679 the bistromathic for an example.
681 *** Deep overhaul of the symbol and token kinds
683 To avoid the confusion with types in programming languages, we now refer
684 to token and symbol "kinds" instead of token and symbol "types". The
685 documentation and error messages have been revised.
687 All the skeletons have been updated to use dedicated enum types rather
688 than integral types. Special symbols are now regular citizens, instead of
689 being declared in ad hoc ways.
693 The "token kind" is what is returned by the scanner, e.g., PLUS, NUMBER,
694 LPAREN, etc. While backward compatibility is of course ensured, users are
695 nonetheless invited to replace their uses of "enum yytokentype" by
698 This type now also includes tokens that were previously hidden: YYEOF (end
699 of input), YYUNDEF (undefined token), and YYerror (error token). They
700 now have string aliases, internationalized when internationalization is
701 enabled. Therefore, by default, error messages now refer to "end of file"
702 (internationalized) rather than the cryptic "$end", or to "invalid token"
703 rather than "$undefined".
705 Therefore in most cases it is now useless to define the end-of-line token
708 %token T_EOF 0 "end of file"
710 Rather simply use "YYEOF" in your scanner.
714 The "symbol kinds" is what the parser actually uses. (Unless the
715 api.token.raw %define variable is used, the symbol kind of a terminal
716 differs from the corresponding token kind.)
718 They are now exposed as a enum, "yysymbol_kind_t".
720 This allows users to tailor the error messages the way they want, or to
721 process some symbols in a specific way in autocompletion (see the
722 bistromathic example below).
724 *** Modernize display of explanatory statements in diagnostics
726 Since Bison 2.7, output was indented four spaces for explanatory
727 statements. For example:
729 input.y:2.7-13: error: %type redeclaration for exp
730 input.y:1.7-11: previous declaration
732 Since the introduction of caret-diagnostics, it became less clear. This
733 indentation has been removed and submessages are displayed similarly as in
736 input.y:2.7-13: error: %type redeclaration for exp
737 2 | %type <float> exp
739 input.y:1.7-11: note: previous declaration
743 Contributed by Victor Morales Cayuela.
747 The token and symbol kinds are yy::parser::token_kind_type and
748 yy::parser::symbol_kind_type.
750 The symbol_type::kind() member function allows to get the kind of a
751 symbol. This can be used to write unit tests for scanners, e.g.,
753 yy::parser::symbol_type t = make_NUMBER ("123");
754 assert (t.kind () == yy::parser::symbol_kind::S_NUMBER);
755 assert (t.value.as<int> () == 123);
761 In order to avoid ambiguities with "type" as in "typing", we now refer to
762 the "token kind" (e.g., `PLUS`, `NUMBER`, etc.) rather than the "token
763 type". We now also refer to the "symbol type" (e.g., `PLUS`, `expr`,
768 There are now examples/java: a very simple calculator, and a more complete
769 one (push-parser, location tracking, and debug traces).
771 The lexcalc example (a simple example in C based on Flex and Bison) now
772 also demonstrates location tracking.
775 A new C example, bistromathic, is a fully featured interactive calculator
776 using many Bison features: pure interface, push parser, autocompletion
777 based on the current parser state (using yypstate_expected_tokens),
778 location tracking, internationalized custom error messages, lookahead
779 correction, rich debug traces, etc.
781 It shows how to depend on the symbol kinds to tailor autocompletion. For
782 instance it recognizes the symbol kind "VARIABLE" to propose
783 autocompletion on the existing variables, rather than of the word
787 * Noteworthy changes in release 3.5.4 (2020-04-05) [stable]
789 ** WARNING: Future backward-incompatibilities!
791 TL;DR: replace "#define YYERROR_VERBOSE 1" by "%define parse.error verbose".
793 Bison 3.6 will no longer support the YYERROR_VERBOSE macro; the parsers
794 that still depend on it will produce Yacc-like error messages (just
795 "syntax error"). It was superseded by the "%error-verbose" directive in
796 Bison 1.875 (2003-01-01). Bison 2.6 (2012-07-19) clearly announced that
797 support for YYERROR_VERBOSE would be removed. Note that since Bison 3.0
798 (2013-07-25), "%error-verbose" is deprecated in favor of "%define
799 parse.error verbose".
803 Fix portability issues of the package itself on old compilers.
805 Fix api.token.raw support in Java.
808 * Noteworthy changes in release 3.5.3 (2020-03-08) [stable]
812 Error messages could quote lines containing zero-width characters (such as
813 \005) with incorrect styling. Fixes for similar issues with unexpectedly
814 short lines (e.g., the file was changed between parsing and diagnosing).
816 Some unlikely crashes found by fuzzing have been fixed. This is only
817 about bison itself, not the generated parsers.
820 * Noteworthy changes in release 3.5.2 (2020-02-13) [stable]
824 Portability issues and minor cosmetic issues.
826 The lalr1.cc skeleton properly rejects unsupported values for parse.lac
830 * Noteworthy changes in release 3.5.1 (2020-01-19) [stable]
836 Fix compiler warnings.
839 * Noteworthy changes in release 3.5 (2019-12-11) [stable]
841 ** Backward incompatible changes
843 Lone carriage-return characters (aka \r or ^M) in the grammar files are no
844 longer treated as end-of-lines. This changes the diagnostics, and in
845 particular their locations.
847 In C++, line numbers and columns are now represented as 'int' not
848 'unsigned', so that integer overflow on positions is easily checkable via
849 'gcc -fsanitize=undefined' and the like. This affects the API for
850 positions. The default position and location classes now expose
851 'counter_type' (int), used to define line and column numbers.
853 ** Deprecated features
855 The YYPRINT macro, which works only with yacc.c and only for tokens, was
856 obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
857 It is deprecated and its support will be removed eventually.
861 *** Lookahead correction in C++
863 Contributed by Adrian Vogelsgesang.
865 The C++ deterministic skeleton (lalr1.cc) now supports LAC, via the
866 %define variable parse.lac.
868 *** Variable api.token.raw: Optimized token numbers (all skeletons)
870 In the generated parsers, tokens have two numbers: the "external" token
871 number as returned by yylex (which starts at 257), and the "internal"
872 symbol number (which starts at 3). Each time yylex is called, a table
873 lookup maps the external token number to the internal symbol number.
875 When the %define variable api.token.raw is set, tokens are assigned their
876 internal number, which saves one table lookup per token, and also saves
877 the generation of the mapping table.
879 The gain is typically moderate, but in extreme cases (very simple user
880 actions), a 10% improvement can be observed.
882 *** Generated parsers use better types for states
884 Stacks now use the best integral type for state numbers, instead of always
885 using 15 bits. As a result "small" parsers now have a smaller memory
886 footprint (they use 8 bits), and there is support for large automata (16
887 bits), and extra large (using int, i.e., typically 31 bits).
889 *** Generated parsers prefer signed integer types
891 Bison skeletons now prefer signed to unsigned integer types when either
892 will do, as the signed types are less error-prone and allow for better
893 checking with 'gcc -fsanitize=undefined'. Also, the types chosen are now
894 portable to unusual machines where char, short and int are all the same
895 width. On non-GNU platforms this may entail including <limits.h> and (if
896 available) <stdint.h> to define integer types and constants.
898 *** A skeleton for the D programming language
900 For the last few releases, Bison has shipped a stealth experimental
901 skeleton: lalr1.d. It was first contributed by Oliver Mangold, based on
902 Paolo Bonzini's lalr1.java, and was cleaned and improved thanks to
905 However, because nobody has committed to improving, testing, and
906 documenting this skeleton, it is not clear that it will be supported in
909 The lalr1.d skeleton *is functional*, and works well, as demonstrated in
910 examples/d/calc.d. Please try it, enjoy it, and... commit to support it.
912 *** Debug traces in Java
914 The Java backend no longer emits code and data for parser tracing if the
915 %define variable parse.trace is not defined.
919 *** New diagnostic: -Wdangling-alias
921 String literals, which allow for better error messages, are (too)
922 liberally accepted by Bison, which might result in silent errors. For
925 %type <exVal> cond "condition"
927 does not define "condition" as a string alias to 'cond' (nonterminal
928 symbols do not have string aliases). It is rather equivalent to
931 %token <exVal> "condition"
933 i.e., it gives the type 'exVal' to the "condition" token, which was
934 clearly not the intention.
936 Also, because string aliases need not be defined, typos such as "baz"
937 instead of "bar" will be not reported.
939 The option `-Wdangling-alias` catches these situations. On
942 %type <ival> foo "foo"
946 bison -Wdangling-alias reports
948 warning: string literal not attached to a symbol
949 | %type <ival> foo "foo"
951 warning: string literal not attached to a symbol
955 The `-Wall` option does not (yet?) include `-Wdangling-alias`.
957 *** Better POSIX Yacc compatibility diagnostics
959 POSIX Yacc restricts %type to nonterminals. This is now diagnosed by
963 %type <ival> TOKEN1 TOKEN2 't'
970 input.y:2.15-20: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
971 2 | %type <ival> TOKEN1 TOKEN2 't'
973 input.y:2.29-31: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
974 2 | %type <ival> TOKEN1 TOKEN2 't'
976 input.y:2.22-27: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
977 2 | %type <ival> TOKEN1 TOKEN2 't'
980 *** Diagnostics with insertion
982 The diagnostics now display the suggestion below the underlined source.
983 Replacement for undeclared symbols are now also suggested.
990 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'?
994 foo.y:2.16: warning: empty rule without %empty [-Wempty-rule]
998 foo.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
1000 *** Diagnostics about long lines
1002 Quoted sources may now be truncated to fit the screen. For instance, on a
1003 30-column wide terminal:
1010 foo.y:1.34-36: warning: symbol FOO redeclared [-Wother]
1013 foo.y:1.8-10: previous declaration
1016 foo.y:1.62-64: warning: symbol FOO redeclared [-Wother]
1019 foo.y:1.8-10: previous declaration
1025 *** Debugging glr.c and glr.cc
1027 The glr.c skeleton always had asserts to check its own behavior (not the
1028 user's). These assertions are now under the control of the parse.assert
1029 %define variable (disabled by default).
1033 Several new compiler warnings in the generated output have been avoided.
1034 Some unused features are no longer emitted. Cleaner generated code in
1039 Portability issues in the test suite.
1041 In theory, parsers using %nonassoc could crash when reporting verbose
1042 error messages. This unlikely bug has been fixed.
1044 In Java, %define api.prefix was ignored. It now behaves as expected.
1047 * Noteworthy changes in release 3.4.2 (2019-09-12) [stable]
1051 In some cases, when warnings are disabled, bison could emit tons of white
1052 spaces as diagnostics.
1054 When running out of memory, bison could crash (found by fuzzing).
1056 When defining twice the EOF token, bison would crash.
1058 New warnings from recent compilers have been addressed in the generated
1059 parsers (yacc.c, glr.c, glr.cc).
1061 When lone carriage-return characters appeared in the input file,
1062 diagnostics could hang forever.
1065 * Noteworthy changes in release 3.4.1 (2019-05-22) [stable]
1072 * Noteworthy changes in release 3.4 (2019-05-19) [stable]
1074 ** Deprecated features
1076 The %pure-parser directive is deprecated in favor of '%define api.pure'
1077 since Bison 2.3b (2008-05-27), but no warning was issued; there is one
1078 now. Note that since Bison 2.7 you are strongly encouraged to use
1079 '%define api.pure full' instead of '%define api.pure'.
1083 *** Colored diagnostics
1085 As an experimental feature, diagnostics are now colored, controlled by the
1086 new options --color and --style.
1088 To use them, install the libtextstyle library before configuring Bison.
1089 It is available from
1091 https://alpha.gnu.org/gnu/gettext/
1095 https://alpha.gnu.org/gnu/gettext/libtextstyle-0.8.tar.gz
1097 The option --color supports the following arguments:
1098 - always, yes: Enable colors.
1099 - never, no: Disable colors.
1100 - auto, tty (default): Enable colors if the output device is a tty.
1102 To customize the styles, create a CSS file similar to
1106 .error { font-weight: 800; text-decoration: underline; }
1109 then invoke bison with --style=bison-bw.css, or set the BISON_STYLE
1110 environment variable to "bison-bw.css".
1112 *** Disabling output
1114 When given -fsyntax-only, the diagnostics are reported, but no output is
1117 The name of this option is somewhat misleading as bison does more than
1118 just checking the syntax: every stage is run (including checking for
1119 conflicts for instance), except the generation of the output files.
1121 *** Include the generated header (yacc.c)
1123 Before, when --defines is used, bison generated a header, and pasted an
1124 exact copy of it into the generated parser implementation file. If the
1125 header name is not "y.tab.h", it is now #included instead of being
1128 To use an '#include' even if the header name is "y.tab.h" (which is what
1129 happens with --yacc, or when using the Autotools' ylwrap), define
1130 api.header.include to the exact argument to pass to #include. For
1133 %define api.header.include {"parse.h"}
1137 %define api.header.include {<parser/parse.h>}
1139 *** api.location.type is now supported in C (yacc.c, glr.c)
1141 The %define variable api.location.type defines the name of the type to use
1142 for locations. When defined, Bison no longer defines YYLTYPE.
1144 This can be used in programs with several parsers to factor their
1145 definition of locations: let one of them generate them, and the others
1152 In conformance with the recommendations of the Graphviz team, if %require
1153 "3.4" (or better) is specified, the option --graph generates a *.gv file
1154 by default, instead of *.dot.
1156 *** Diagnostics overhaul
1158 Column numbers were wrong with multibyte characters, which would also
1159 result in skewed diagnostics with carets. Beside, because we were
1160 indenting the quoted source with a single space, lines with tab characters
1161 were incorrectly underlined.
1163 To address these issues, and to be clearer, Bison now issues diagnostics
1164 as GCC9 does. For instance it used to display (there's a tab before the
1167 foo.y:3.37-38: error: $2 of ‘expr’ has no declared type
1168 expr: expr '+' "number" { $$ = $1 + $2; }
1172 foo.y:3.37-38: error: $2 of ‘expr’ has no declared type
1173 3 | expr: expr '+' "number" { $$ = $1 + $2; }
1176 Other constructs now also have better locations, resulting in more precise
1179 *** Fix-it hints for %empty
1181 Running Bison with -Wempty-rules and --update will remove incorrect %empty
1182 annotations, and add the missing ones.
1184 *** Generated reports
1186 The format of the reports (parse.output) was improved for readability.
1188 *** Better support for --no-line.
1190 When --no-line is used, the generated files are now cleaner: no lines are
1191 generated instead of empty lines. Together with using api.header.include,
1192 that should help people saving the generated files into version control
1193 systems get smaller diffs.
1197 A new example in C shows an simple infix calculator with a hand-written
1198 scanner (examples/c/calc).
1200 A new example in C shows a reentrant parser (capable of recursive calls)
1201 built with Flex and Bison (examples/c/reccalc).
1203 There is a new section about the history of Yaccs and Bison.
1207 A few obscure bugs were fixed, including the second oldest (known) bug in
1208 Bison: it was there when Bison was entered in the RCS version control
1209 system, in December 1987. See the NEWS of Bison 3.3 for the previous
1213 * Noteworthy changes in release 3.3.2 (2019-02-03) [stable]
1217 Bison 3.3 failed to generate parsers for grammars with unused nonterminal
1221 * Noteworthy changes in release 3.3.1 (2019-01-27) [stable]
1225 The option -y/--yacc used to imply -Werror=yacc, which turns uses of Bison
1226 extensions into errors. It now makes them simple warnings (-Wyacc).
1229 * Noteworthy changes in release 3.3 (2019-01-26) [stable]
1231 A new mailing list was created, Bison Announce. It is low traffic, and is
1232 only about announcing new releases and important messages (e.g., polls
1233 about major decisions to make).
1235 https://lists.gnu.org/mailman/listinfo/bison-announce
1237 ** Backward incompatible changes
1239 Support for DJGPP, which has been unmaintained and untested for years, is
1242 ** Deprecated features
1244 A new feature, --update (see below) helps adjusting existing grammars to
1247 *** Deprecated directives
1249 The %error-verbose directive is deprecated in favor of '%define
1250 parse.error verbose' since Bison 3.0, but no warning was issued.
1252 The '%name-prefix "xx"' directive is deprecated in favor of '%define
1253 api.prefix {xx}' since Bison 3.0, but no warning was issued. These
1254 directives are slightly different, you might need to adjust your code.
1255 %name-prefix renames only symbols with external linkage, while api.prefix
1256 also renames types and macros, including YYDEBUG, YYTOKENTYPE,
1257 yytokentype, YYSTYPE, YYLTYPE, etc.
1259 Users of Flex that move from '%name-prefix "xx"' to '%define api.prefix
1260 {xx}' will typically have to update YY_DECL from
1262 #define YY_DECL int xxlex (YYSTYPE *yylval, YYLTYPE *yylloc)
1266 #define YY_DECL int xxlex (XXSTYPE *yylval, XXLTYPE *yylloc)
1268 *** Deprecated %define variable names
1270 The following variables, mostly related to parsers in Java, have been
1271 renamed for consistency. Backward compatibility is ensured, but upgrading
1274 abstract -> api.parser.abstract
1275 annotations -> api.parser.annotations
1276 extends -> api.parser.extends
1277 final -> api.parser.final
1278 implements -> api.parser.implements
1279 parser_class_name -> api.parser.class
1280 public -> api.parser.public
1281 strictfp -> api.parser.strictfp
1285 *** Generation of fix-its for IDEs/Editors
1287 When given the new option -ffixit (aka -fdiagnostics-parseable-fixits),
1288 bison now generates machine readable editing instructions to fix some
1289 issues. Currently, this is mostly limited to updating deprecated
1290 directives and removing duplicates. For instance:
1294 %define parser_class_name "Parser"
1295 %define api.parser.class "Parser"
1299 See the "fix-it:" lines below:
1301 $ bison -ffixit foo.y
1302 foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated]
1305 fix-it:"foo.y":{1:1-1:15}:"%define parse.error verbose"
1306 foo.y:2.1-34: warning: deprecated directive, use '%define api.parser.class {Parser}' [-Wdeprecated]
1307 %define parser_class_name "Parser"
1308 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1309 fix-it:"foo.y":{2:1-2:35}:"%define api.parser.class {Parser}"
1310 foo.y:3.1-33: error: %define variable 'api.parser.class' redefined
1311 %define api.parser.class "Parser"
1312 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1313 foo.y:2.1-34: previous definition
1314 %define parser_class_name "Parser"
1315 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1316 fix-it:"foo.y":{3:1-3:34}:""
1317 foo.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
1319 This uses the same output format as GCC and Clang.
1321 *** Updating grammar files
1323 Fixes can be applied on the fly. The previous example ends with the
1324 suggestion to re-run bison with the option -u/--update, which results in a
1325 cleaner grammar file.
1327 $ bison --update foo.y
1329 bison: file 'foo.y' was updated (backup: 'foo.y~')
1332 %define parse.error verbose
1333 %define api.parser.class {Parser}
1337 *** Bison is now relocatable
1339 If you pass '--enable-relocatable' to 'configure', Bison is relocatable.
1341 A relocatable program can be moved or copied to a different location on
1342 the file system. It can also be used through mount points for network
1343 sharing. It is possible to make symbolic links to the installed and moved
1344 programs, and invoke them through the symbolic link.
1346 *** %expect and %expect-rr modifiers on individual rules
1348 One can now document (and check) which rules participate in shift/reduce
1349 and reduce/reduce conflicts. This is particularly important GLR parsers,
1350 where conflicts are a normal occurrence. For example,
1366 | argument_list ',' expression
1371 Looking at the output from -v, one can see that the shift/reduce conflict
1372 here is due to the fact that the parser does not know whether to reduce
1373 arguments to argument_list until it sees the token _after_ the following
1374 ','. By marking the rule with %expect 1 (because there is a conflict in
1375 one state), we document the source of the 1 overall shift/reduce conflict.
1377 In GLR parsers, we can use %expect-rr in a rule for reduce/reduce
1378 conflicts. In this case, we mark each of the conflicting rules. For
1387 target_list '=' expr ';'
1393 | target ',' target_list
1402 | expr ',' expr_list
1410 In a statement such as
1414 the parser must reduce x to a target or an expr, but does not know which
1415 until it sees the '='. So we notate the two possible reductions to
1416 indicate that each conflicts in one rule.
1418 This feature needs user feedback, and might evolve in the future.
1420 *** C++: Actual token constructors
1422 When variants and token constructors are enabled, in addition to the
1423 type-safe named token constructors (make_ID, make_INT, etc.), we now
1424 generate genuine constructors for symbol_type.
1426 For instance with these declarations
1432 you may use these constructors:
1434 symbol_type (int token, const std::string&);
1435 symbol_type (int token, const int&);
1436 symbol_type (int token);
1438 Correct matching between token types and value types is checked via
1439 'assert'; for instance, 'symbol_type (ID, 42)' would abort. Named
1440 constructors are preferable, as they offer better type safety (for
1441 instance 'make_ID (42)' would not even compile), but symbol_type
1442 constructors may help when token types are discovered at run-time, e.g.,
1445 if (auto i = lookup_keyword (yytext))
1446 return yy::parser::symbol_type (i);
1448 return yy::parser::make_ID (yytext);
1451 *** C++: Variadic emplace
1453 If your application requires C++11 and you don't use symbol constructors,
1454 you may now use a variadic emplace for semantic values:
1456 %define api.value.type variant
1457 %token <std::pair<int, int>> PAIR
1461 int yylex (parser::semantic_type *lvalp)
1463 lvalp->emplace <std::pair<int, int>> (1, 2);
1464 return parser::token::PAIR;
1467 *** C++: Syntax error exceptions in GLR
1469 The glr.cc skeleton now supports syntax_error exceptions thrown from user
1470 actions, or from the scanner.
1472 *** More POSIX Yacc compatibility warnings
1474 More Bison specific directives are now reported with -y or -Wyacc. This
1475 change was ready since the release of Bison 3.0 in September 2015. It was
1476 delayed because Autoconf used to define YACC as `bison -y`, which resulted
1477 in numerous warnings for Bison users that use the GNU Build System.
1479 If you still experience that problem, either redefine YACC as `bison -o
1480 y.tab.c`, or pass -Wno-yacc to Bison.
1482 *** The tables yyrhs and yyphrs are back
1484 Because no Bison skeleton uses them, these tables were removed (no longer
1485 passed to the skeletons, not even computed) in 2008. However, some users
1486 have expressed interest in being able to use them in their own skeletons.
1490 *** Incorrect number of reduce/reduce conflicts
1492 On a grammar such as
1494 exp: "num" | "num" | "num"
1496 bison used to report a single RR conflict, instead of two. This is now
1497 fixed. This was the oldest (known) bug in Bison: it was there when Bison
1498 was entered in the RCS version control system, in December 1987.
1500 Some grammar files might have to adjust their %expect-rr.
1502 *** Parser directives that were not careful enough
1504 Passing invalid arguments to %nterm, for instance character literals, used
1505 to result in unclear error messages.
1509 The examples/ directory (installed in .../share/doc/bison/examples) has
1510 been restructured per language for clarity. The examples come with a
1511 README and a Makefile. Not only can they be used to toy with Bison, they
1512 can also be starting points for your own grammars.
1514 There is now a Java example, and a simple example in C based on Flex and
1515 Bison (examples/c/lexcalc/).
1521 They now use noexcept and constexpr. Please, report missing annotations.
1523 *** Symbol Declarations
1525 The syntax of the variation directives to declare symbols was overhauled
1526 for more consistency, and also better POSIX Yacc compliance (which, for
1527 instance, allows "%type" without actually providing a type). The %nterm
1528 directive, supported by Bison since its inception, is now documented and
1529 officially supported.
1531 The syntax is now as follows:
1533 %token TAG? ( ID NUMBER? STRING? )+ ( TAG ( ID NUMBER? STRING? )+ )*
1534 %left TAG? ( ID NUMBER? )+ ( TAG ( ID NUMBER? )+ )*
1535 %type TAG? ( ID | CHAR | STRING )+ ( TAG ( ID | CHAR | STRING )+ )*
1536 %nterm TAG? ID+ ( TAG ID+ )*
1538 where TAG denotes a type tag such as ‘<ival>’, ID denotes an identifier
1539 such as ‘NUM’, NUMBER a decimal or hexadecimal integer such as ‘300’ or
1540 ‘0x12d’, CHAR a character literal such as ‘'+'’, and STRING a string
1541 literal such as ‘"number"’. The post-fix quantifiers are ‘?’ (zero or
1542 one), ‘*’ (zero or more) and ‘+’ (one or more).
1545 * Noteworthy changes in release 3.2.4 (2018-12-24) [stable]
1549 Fix the move constructor of symbol_type.
1551 Always provide a copy constructor for symbol_type, even in modern C++.
1554 * Noteworthy changes in release 3.2.3 (2018-12-18) [stable]
1558 Properly support token constructors in C++ with types that include commas
1559 (e.g., std::pair<int, int>). A regression introduced in Bison 3.2.
1562 * Noteworthy changes in release 3.2.2 (2018-11-21) [stable]
1566 C++ portability issues.
1569 * Noteworthy changes in release 3.2.1 (2018-11-09) [stable]
1573 Several portability issues have been fixed in the build system, in the
1574 test suite, and in the generated parsers in C++.
1577 * Noteworthy changes in release 3.2 (2018-10-29) [stable]
1579 ** Backward incompatible changes
1581 Support for DJGPP, which has been unmaintained and untested for years, is
1582 obsolete. Unless there is activity to revive it, it will be removed.
1586 %printers should use yyo rather than yyoutput to denote the output stream.
1588 Variant-based symbols in C++ should use emplace() rather than build().
1590 In C++ parsers, parser::operator() is now a synonym for the parser::parse.
1594 A new section, "A Simple C++ Example", is a tutorial for parsers in C++.
1596 A comment in the generated code now emphasizes that users should not
1597 depend upon non-documented implementation details, such as macros starting
1602 *** C++: Support for move semantics (lalr1.cc)
1604 The lalr1.cc skeleton now fully supports C++ move semantics, while
1605 maintaining compatibility with C++98. You may now store move-only types
1606 when using Bison's variants. For instance:
1613 %skeleton "lalr1.cc"
1614 %define api.value.type variant
1618 %token <int> INT "int";
1619 %type <std::unique_ptr<int>> int;
1620 %type <std::vector<std::unique_ptr<int>>> list;
1624 | list int { $$ = std::move($1); $$.emplace_back(std::move($2)); }
1626 int: "int" { $$ = std::make_unique<int>($1); }
1628 *** C++: Implicit move of right-hand side values (lalr1.cc)
1630 In modern C++ (C++11 and later), you should always use 'std::move' with
1631 the values of the right-hand side symbols ($1, $2, etc.), as they will be
1632 popped from the stack anyway. Using 'std::move' is mandatory for
1633 move-only types such as unique_ptr, and it provides a significant speedup
1634 for large types such as std::string, or std::vector, etc.
1636 If '%define api.value.automove' is set, every occurrence '$n' is replaced
1637 by 'std::move ($n)'. The second rule in the previous grammar can be
1640 list: list int { $$ = $1; $$.emplace_back($2); }
1642 With automove enabled, the semantic values are no longer lvalues, so do
1643 not use the swap idiom:
1645 list: list int { std::swap($$, $1); $$.emplace_back($2); }
1647 This idiom is anyway obsolete: it is preferable to move than to swap.
1649 A warning is issued when automove is enabled, and a value is used several
1652 input.yy:16.31-32: warning: multiple occurrences of $2 with api.value.automove enabled [-Wother]
1653 exp: "twice" exp { $$ = $2 + $2; }
1656 Enabling api.value.automove does not require support for modern C++. The
1657 generated code is valid C++98/03, but will use copies instead of moves.
1659 The new examples/c++/variant-11.yy shows these features in action.
1661 *** C++: The implicit default semantic action is always run
1663 When variants are enabled, the default action was not run, so
1671 It now behaves like in all the other cases, as
1673 exp: "number" { $$ = $1; }
1675 possibly using std::move if automove is enabled.
1677 We do not expect backward compatibility issues. However, beware of
1678 forward compatibility issues: if you rely on default actions with
1679 variants, be sure to '%require "3.2"' to avoid older versions of Bison to
1680 generate incorrect parsers.
1682 *** C++: Renaming location.hh
1684 When both %defines and %locations are enabled, Bison generates a
1685 location.hh file. If you don't use locations outside of the parser, you
1686 may avoid its creation with:
1688 %define api.location.file none
1690 However this file is useful if, for instance, your parser builds an AST
1691 decorated with locations: you may use Bison's location independently of
1692 Bison's parser. You can now give it another name, for instance:
1694 %define api.location.file "my-location.hh"
1696 This name can have directory components, and even be absolute. The name
1697 under which the location file is included is controlled by
1698 api.location.include.
1700 This way it is possible to have several parsers share the same location
1703 For instance, in src/foo/parser.hh, generate the include/ast/loc.hh file:
1706 %define api.namespace {foo}
1707 %define api.location.file "include/ast/loc.hh"
1708 %define api.location.include {<ast/loc.hh>}
1710 and use it in src/bar/parser.hh:
1713 %define api.namespace {bar}
1714 %code requires {#include <ast/loc.hh>}
1715 %define api.location.type {bar::location}
1717 Absolute file names are supported, so in your Makefile, passing the flag
1718 -Dapi.location.file='"$(top_srcdir)/include/ast/location.hh"' to bison is
1721 *** C++: stack.hh and position.hh are deprecated
1723 When asked to generate a header file (%defines), the lalr1.cc skeleton
1724 generates a stack.hh file. This file had no interest for users; it is now
1725 made useless: its content is included in the parser definition. It is
1726 still generated for backward compatibility.
1728 When in addition to %defines, location support is requested (%locations),
1729 the file position.hh is also generated. It is now also useless: its
1730 content is now included in location.hh.
1732 These files are no longer generated when your grammar file requires at
1733 least Bison 3.2 (%require "3.2").
1737 Portability issues on MinGW and VS2015.
1739 Portability issues in the test suite.
1741 Portability/warning issues with Flex.
1744 * Noteworthy changes in release 3.1 (2018-08-27) [stable]
1746 ** Backward incompatible changes
1748 Compiling Bison now requires a C99 compiler---as announced during the
1749 release of Bison 3.0, five years ago. Generated parsers do not require a
1752 Support for DJGPP, which has been unmaintained and untested for years, is
1753 obsolete. Unless there is activity to revive it, the next release of Bison
1754 will have it removed.
1758 *** Typed midrule actions
1760 Because their type is unknown to Bison, the values of midrule actions are
1761 not treated like the others: they don't have %printer and %destructor
1762 support. It also prevents C++ (Bison) variants to handle them properly.
1764 Typed midrule actions address these issues. Instead of:
1766 exp: { $<ival>$ = 1; } { $<ival>$ = 2; } { $$ = $<ival>1 + $<ival>2; }
1770 exp: <ival>{ $$ = 1; } <ival>{ $$ = 2; } { $$ = $1 + $2; }
1772 *** Reports include the type of the symbols
1774 The sections about terminal and nonterminal symbols of the '*.output' file
1775 now specify their declared type. For instance, for:
1779 the report now shows '<ival>':
1781 Terminals, with rules where they appear
1785 *** Diagnostics about useless rules
1787 In the following grammar, the 'exp' nonterminal is trivially useless. So,
1788 of course, its rules are useless too.
1792 exp: exp '+' exp | exp '-' exp | '(' exp ')'
1794 Previously all the useless rules were reported, including those whose
1795 left-hand side is the 'exp' nonterminal:
1797 warning: 1 nonterminal useless in grammar [-Wother]
1798 warning: 4 rules useless in grammar [-Wother]
1799 2.14-16: warning: nonterminal useless in grammar: exp [-Wother]
1802 2.14-16: warning: rule useless in grammar [-Wother]
1805 3.6-16: warning: rule useless in grammar [-Wother]
1806 exp: exp '+' exp | exp '-' exp | '(' exp ')'
1808 3.20-30: warning: rule useless in grammar [-Wother]
1809 exp: exp '+' exp | exp '-' exp | '(' exp ')'
1811 3.34-44: warning: rule useless in grammar [-Wother]
1812 exp: exp '+' exp | exp '-' exp | '(' exp ')'
1815 Now, rules whose left-hand side symbol is useless are no longer reported
1816 as useless. The locations of the errors have also been adjusted to point
1817 to the first use of the nonterminal as a left-hand side of a rule:
1819 warning: 1 nonterminal useless in grammar [-Wother]
1820 warning: 4 rules useless in grammar [-Wother]
1821 3.1-3: warning: nonterminal useless in grammar: exp [-Wother]
1822 exp: exp '+' exp | exp '-' exp | '(' exp ')'
1824 2.14-16: warning: rule useless in grammar [-Wother]
1828 *** C++: Generated parsers can be compiled with -fno-exceptions (lalr1.cc)
1830 When compiled with exceptions disabled, the generated parsers no longer
1831 uses try/catch clauses.
1833 Currently only GCC and Clang are supported.
1837 *** A demonstration of variants
1839 A new example was added (installed in .../share/doc/bison/examples),
1840 'variant.yy', which shows how to use (Bison) variants in C++.
1842 The other examples were made nicer to read.
1844 *** Some features are no longer 'experimental'
1846 The following features, mature enough, are no longer flagged as
1847 experimental in the documentation: push parsers, default %printer and
1848 %destructor (typed: <*> and untyped: <>), %define api.value.type union and
1849 variant, Java parsers, XML output, LR family (lr, ielr, lalr), and
1850 semantic predicates (%?).
1854 *** GLR: Predicates support broken by #line directives
1856 Predicates (%?) in GLR such as
1859 %? {new_syntax} 'w' id new_args
1860 | %?{!new_syntax} 'w' id old_args
1862 were issued with #lines in the middle of C code.
1864 *** Printer and destructor with broken #line directives
1866 The #line directives were not properly escaped when emitting the code for
1867 %printer/%destructor, which resulted in compiler errors if there are
1868 backslashes or double-quotes in the grammar file name.
1870 *** Portability on ICC
1872 The Intel compiler claims compatibility with GCC, yet rejects its _Pragma.
1873 Generated parsers now work around this.
1877 There were several small fixes in the test suite and in the build system,
1878 many warnings in bison and in the generated parsers were eliminated. The
1879 documentation also received its share of minor improvements.
1881 Useless code was removed from C++ parsers, and some of the generated
1882 constructors are more 'natural'.
1885 * Noteworthy changes in release 3.0.5 (2018-05-27) [stable]
1889 *** C++: Fix support of 'syntax_error'
1891 One incorrect 'inline' resulted in linking errors about the constructor of
1892 the syntax_error exception.
1894 *** C++: Fix warnings
1896 GCC 7.3 (with -O1 or -O2 but not -O0 or -O3) issued null-dereference
1897 warnings about yyformat being possibly null. It also warned about the
1898 deprecated implicit definition of copy constructors when there's a
1899 user-defined (copy) assignment operator.
1901 *** Location of errors
1903 In C++ parsers, out-of-bounds errors can happen when a rule with an empty
1904 ride-hand side raises a syntax error. The behavior of the default parser
1905 (yacc.c) in such a condition was undefined.
1907 Now all the parsers match the behavior of glr.c: @$ is used as the
1908 location of the error. This handles gracefully rules with and without
1911 *** Portability fixes in the test suite
1913 On some platforms, some Java and/or C++ tests were failing.
1916 * Noteworthy changes in release 3.0.4 (2015-01-23) [stable]
1920 *** C++ with Variants (lalr1.cc)
1922 Fix a compiler warning when no %destructor use $$.
1926 Several portability issues in tests were fixed.
1929 * Noteworthy changes in release 3.0.3 (2015-01-15) [stable]
1933 *** C++ with Variants (lalr1.cc)
1935 Problems with %destructor and '%define parse.assert' have been fixed.
1937 *** Named %union support (yacc.c, glr.c)
1939 Bison 3.0 introduced a regression on named %union such as
1941 %union foo { int ival; };
1943 The possibility to use a name was introduced "for Yacc compatibility".
1944 It is however not required by POSIX Yacc, and its usefulness is not clear.
1946 *** %define api.value.type union with %defines (yacc.c, glr.c)
1948 The C parsers were broken when %defines was used together with "%define
1949 api.value.type union".
1951 *** Redeclarations are reported in proper order
1959 bison used to report:
1961 foo.yy:2.10-11: error: %printer redeclaration for FOO
1964 foo.yy:3.10-11: previous declaration
1968 Now, the "previous" declaration is always the first one.
1973 Bison now installs various files in its docdir (which defaults to
1974 '/usr/local/share/doc/bison'), including the three fully blown examples
1975 extracted from the documentation:
1978 Reverse Polish Calculator, a simple introductory example.
1980 Multi-function Calc, a calculator with memory and functions and located
1983 a calculator in C++ using variant support and token constructors.
1986 * Noteworthy changes in release 3.0.2 (2013-12-05) [stable]
1990 *** Generated source files when errors are reported
1992 When warnings are issued and -Werror is set, bison would still generate
1993 the source files (*.c, *.h...). As a consequence, some runs of "make"
1994 could fail the first time, but not the second (as the files were generated
1997 This is fixed: bison no longer generates this source files, but, of
1998 course, still produces the various reports (*.output, *.xml, etc.).
2000 *** %empty is used in reports
2002 Empty right-hand sides are denoted by '%empty' in all the reports (text,
2003 dot, XML and formats derived from it).
2005 *** YYERROR and variants
2007 When C++ variant support is enabled, an error triggered via YYERROR, but
2008 not caught via error recovery, resulted in a double deletion.
2011 * Noteworthy changes in release 3.0.1 (2013-11-12) [stable]
2015 *** Errors in caret diagnostics
2017 On some platforms, some errors could result in endless diagnostics.
2019 *** Fixes of the -Werror option
2021 Options such as "-Werror -Wno-error=foo" were still turning "foo"
2022 diagnostics into errors instead of warnings. This is fixed.
2024 Actually, for consistency with GCC, "-Wno-error=foo -Werror" now also
2025 leaves "foo" diagnostics as warnings. Similarly, with "-Werror=foo
2026 -Wno-error", "foo" diagnostics are now errors.
2030 As demonstrated in the documentation, one can now leave spaces between
2035 The yacc.1 man page is no longer installed if --disable-yacc was
2038 *** Fixes in the test suite
2040 Bugs and portability issues.
2043 * Noteworthy changes in release 3.0 (2013-07-25) [stable]
2045 ** WARNING: Future backward-incompatibilities!
2047 Like other GNU packages, Bison will start using some of the C99 features
2048 for its own code, especially the definition of variables after statements.
2049 The generated C parsers still aim at C90.
2051 ** Backward incompatible changes
2053 *** Obsolete features
2055 Support for YYFAIL is removed (deprecated in Bison 2.4.2): use YYERROR.
2057 Support for yystype and yyltype is removed (deprecated in Bison 1.875):
2058 use YYSTYPE and YYLTYPE.
2060 Support for YYLEX_PARAM and YYPARSE_PARAM is removed (deprecated in Bison
2061 1.875): use %lex-param, %parse-param, or %param.
2063 Missing semicolons at the end of actions are no longer added (as announced
2064 in the release 2.5).
2066 *** Use of YACC='bison -y'
2068 TL;DR: With Autoconf <= 2.69, pass -Wno-yacc to (AM_)YFLAGS if you use
2071 Traditional Yacc generates 'y.tab.c' whatever the name of the input file.
2072 Therefore Makefiles written for Yacc expect 'y.tab.c' (and possibly
2073 'y.tab.h' and 'y.output') to be generated from 'foo.y'.
2075 To this end, for ages, AC_PROG_YACC, Autoconf's macro to look for an
2076 implementation of Yacc, was using Bison as 'bison -y'. While it does
2077 ensure compatible output file names, it also enables warnings for
2078 incompatibilities with POSIX Yacc. In other words, 'bison -y' triggers
2079 warnings for Bison extensions.
2081 Autoconf 2.70+ fixes this incompatibility by using YACC='bison -o y.tab.c'
2082 (which also generates 'y.tab.h' and 'y.output' when needed).
2083 Alternatively, disable Yacc warnings by passing '-Wno-yacc' to your Yacc
2084 flags (YFLAGS, or AM_YFLAGS with Automake).
2088 *** The epilogue is no longer affected by internal #defines (glr.c)
2090 The glr.c skeleton uses defines such as #define yylval (yystackp->yyval) in
2091 generated code. These weren't properly undefined before the inclusion of
2092 the user epilogue, so functions such as the following were butchered by the
2093 preprocessor expansion:
2095 int yylex (YYSTYPE *yylval);
2097 This is fixed: yylval, yynerrs, yychar, and yylloc are now valid
2098 identifiers for user-provided variables.
2100 *** stdio.h is no longer needed when locations are enabled (yacc.c)
2102 Changes in Bison 2.7 introduced a dependency on FILE and fprintf when
2103 locations are enabled. This is fixed.
2105 *** Warnings about useless %pure-parser/%define api.pure are restored
2107 ** Diagnostics reported by Bison
2109 Most of these features were contributed by Théophile Ranquet and Victor
2114 Version 2.7 introduced caret errors, for a prettier output. These are now
2115 activated by default. The old format can still be used by invoking Bison
2116 with -fno-caret (or -fnone).
2118 Some error messages that reproduced excerpts of the grammar are now using
2119 the caret information only. For instance on:
2126 in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2127 in.y:2.12-14: warning: rule useless in parser due to conflicts: exp: 'a' [-Wother]
2131 in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2132 in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
2136 and "bison -fno-caret" reports:
2138 in.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
2139 in.y:2.12-14: warning: rule useless in parser due to conflicts [-Wother]
2141 *** Enhancements of the -Werror option
2143 The -Werror=CATEGORY option is now recognized, and will treat specified
2144 warnings as errors. The warnings need not have been explicitly activated
2145 using the -W option, this is similar to what GCC 4.7 does.
2147 For example, given the following command line, Bison will treat both
2148 warnings related to POSIX Yacc incompatibilities and S/R conflicts as
2149 errors (and only those):
2151 $ bison -Werror=yacc,error=conflicts-sr input.y
2153 If no categories are specified, -Werror will make all active warnings into
2154 errors. For example, the following line does the same the previous example:
2156 $ bison -Werror -Wnone -Wyacc -Wconflicts-sr input.y
2158 (By default -Wconflicts-sr,conflicts-rr,deprecated,other is enabled.)
2160 Note that the categories in this -Werror option may not be prefixed with
2161 "no-". However, -Wno-error[=CATEGORY] is valid.
2163 Note that -y enables -Werror=yacc. Therefore it is now possible to require
2164 Yacc-like behavior (e.g., always generate y.tab.c), but to report
2165 incompatibilities as warnings: "-y -Wno-error=yacc".
2167 *** The display of warnings is now richer
2169 The option that controls a given warning is now displayed:
2171 foo.y:4.6: warning: type clash on default action: <foo> != <bar> [-Wother]
2173 In the case of warnings treated as errors, the prefix is changed from
2174 "warning: " to "error: ", and the suffix is displayed, in a manner similar
2175 to GCC, as [-Werror=CATEGORY].
2177 For instance, where the previous version of Bison would report (and exit
2180 bison: warnings being treated as errors
2181 input.y:1.1: warning: stray ',' treated as white space
2185 input.y:1.1: error: stray ',' treated as white space [-Werror=other]
2187 *** Deprecated constructs
2189 The new 'deprecated' warning category flags obsolete constructs whose
2190 support will be discontinued. It is enabled by default. These warnings
2191 used to be reported as 'other' warnings.
2193 *** Useless semantic types
2195 Bison now warns about useless (uninhabited) semantic types. Since
2196 semantic types are not declared to Bison (they are defined in the opaque
2197 %union structure), it is %printer/%destructor directives about useless
2198 types that trigger the warning:
2202 %printer {} <type1> <type3>
2203 %destructor {} <type2> <type4>
2205 nterm: term { $$ = $1; };
2207 3.28-34: warning: type <type3> is used, but is not associated to any symbol
2208 4.28-34: warning: type <type4> is used, but is not associated to any symbol
2210 *** Undefined but unused symbols
2212 Bison used to raise an error for undefined symbols that are not used in
2213 the grammar. This is now only a warning.
2216 %destructor {} symbol2
2217 %type <type> symbol3
2221 *** Useless destructors or printers
2223 Bison now warns about useless destructors or printers. In the following
2224 example, the printer for <type1>, and the destructor for <type2> are
2225 useless: all symbols of <type1> (token1) already have a printer, and all
2226 symbols of type <type2> (token2) already have a destructor.
2228 %token <type1> token1
2232 %printer {} token1 <type1> <type3>
2233 %destructor {} token2 <type2> <type4>
2237 The warnings and error messages about shift/reduce and reduce/reduce
2238 conflicts have been normalized. For instance on the following foo.y file:
2242 exp: exp '+' exp | '0' | '0';
2244 compare the previous version of bison:
2247 foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2248 $ bison -Werror foo.y
2249 bison: warnings being treated as errors
2250 foo.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2252 with the new behavior:
2255 foo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
2256 foo.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
2257 $ bison -Werror foo.y
2258 foo.y: error: 1 shift/reduce conflict [-Werror=conflicts-sr]
2259 foo.y: error: 2 reduce/reduce conflicts [-Werror=conflicts-rr]
2261 When %expect or %expect-rr is used, such as with bar.y:
2266 exp: exp '+' exp | '0' | '0';
2271 bar.y: conflicts: 1 shift/reduce, 2 reduce/reduce
2272 bar.y: expected 0 shift/reduce conflicts
2273 bar.y: expected 0 reduce/reduce conflicts
2278 bar.y: error: shift/reduce conflicts: 1 found, 0 expected
2279 bar.y: error: reduce/reduce conflicts: 2 found, 0 expected
2281 ** Incompatibilities with POSIX Yacc
2283 The 'yacc' category is no longer part of '-Wall', enable it explicitly
2286 ** Additional yylex/yyparse arguments
2288 The new directive %param declares additional arguments to both yylex and
2289 yyparse. The %lex-param, %parse-param, and %param directives support one
2290 or more arguments. Instead of
2292 %lex-param {arg1_type *arg1}
2293 %lex-param {arg2_type *arg2}
2294 %parse-param {arg1_type *arg1}
2295 %parse-param {arg2_type *arg2}
2299 %param {arg1_type *arg1} {arg2_type *arg2}
2301 ** Types of values for %define variables
2303 Bison used to make no difference between '%define foo bar' and '%define
2304 foo "bar"'. The former is now called a 'keyword value', and the latter a
2305 'string value'. A third kind was added: 'code values', such as '%define
2308 Keyword variables are used for fixed value sets, e.g.,
2310 %define lr.type lalr
2312 Code variables are used for value in the target language, e.g.,
2314 %define api.value.type {struct semantic_type}
2316 String variables are used remaining cases, e.g. file names.
2318 ** Variable api.token.prefix
2320 The variable api.token.prefix changes the way tokens are identified in
2321 the generated files. This is especially useful to avoid collisions
2322 with identifiers in the target language. For instance
2324 %token FILE for ERROR
2325 %define api.token.prefix {TOK_}
2327 start: FILE for ERROR;
2329 will generate the definition of the symbols TOK_FILE, TOK_for, and
2330 TOK_ERROR in the generated sources. In particular, the scanner must
2331 use these prefixed token names, although the grammar itself still
2332 uses the short names (as in the sample rule given above).
2334 ** Variable api.value.type
2336 This new %define variable supersedes the #define macro YYSTYPE. The use
2337 of YYSTYPE is discouraged. In particular, #defining YYSTYPE *and* either
2338 using %union or %defining api.value.type results in undefined behavior.
2340 Either define api.value.type, or use "%union":
2347 %token <ival> INT "integer"
2348 %token <sval> STRING "string"
2349 %printer { fprintf (yyo, "%d", $$); } <ival>
2350 %destructor { free ($$); } <sval>
2353 yylval.ival = 42; return INT;
2354 yylval.sval = "42"; return STRING;
2356 The %define variable api.value.type supports both keyword and code values.
2358 The keyword value 'union' means that the user provides genuine types, not
2359 union member names such as "ival" and "sval" above (WARNING: will fail if
2360 -y/--yacc/%yacc is enabled).
2362 %define api.value.type union
2363 %token <int> INT "integer"
2364 %token <char *> STRING "string"
2365 %printer { fprintf (yyo, "%d", $$); } <int>
2366 %destructor { free ($$); } <char *>
2369 yylval.INT = 42; return INT;
2370 yylval.STRING = "42"; return STRING;
2372 The keyword value variant is somewhat equivalent, but for C++ special
2373 provision is made to allow classes to be used (more about this below).
2375 %define api.value.type variant
2376 %token <int> INT "integer"
2377 %token <std::string> STRING "string"
2379 Code values (in braces) denote user defined types. This is where YYSTYPE
2397 %define api.value.type {struct my_value}
2398 %token <u.ival> INT "integer"
2399 %token <u.sval> STRING "string"
2400 %printer { fprintf (yyo, "%d", $$); } <u.ival>
2401 %destructor { free ($$); } <u.sval>
2404 yylval.u.ival = 42; return INT;
2405 yylval.u.sval = "42"; return STRING;
2407 ** Variable parse.error
2409 This variable controls the verbosity of error messages. The use of the
2410 %error-verbose directive is deprecated in favor of "%define parse.error
2413 ** Deprecated %define variable names
2415 The following variables have been renamed for consistency. Backward
2416 compatibility is ensured, but upgrading is recommended.
2418 lr.default-reductions -> lr.default-reduction
2419 lr.keep-unreachable-states -> lr.keep-unreachable-state
2420 namespace -> api.namespace
2421 stype -> api.value.type
2423 ** Semantic predicates
2425 Contributed by Paul Hilfinger.
2427 The new, experimental, semantic-predicate feature allows actions of the
2428 form "%?{ BOOLEAN-EXPRESSION }", which cause syntax errors (as for
2429 YYERROR) if the expression evaluates to 0, and are evaluated immediately
2430 in GLR parsers, rather than being deferred. The result is that they allow
2431 the programmer to prune possible parses based on the values of run-time
2434 ** The directive %expect-rr is now an error in non GLR mode
2436 It used to be an error only if used in non GLR mode, _and_ if there are
2437 reduce/reduce conflicts.
2439 ** Tokens are numbered in their order of appearance
2441 Contributed by Valentin Tolmer.
2443 With '%token A B', A had a number less than the one of B. However,
2444 precedence declarations used to generate a reversed order. This is now
2445 fixed, and introducing tokens with any of %token, %left, %right,
2446 %precedence, or %nonassoc yields the same result.
2448 When mixing declarations of tokens with a literal character (e.g., 'a') or
2449 with an identifier (e.g., B) in a precedence declaration, Bison numbered
2450 the literal characters first. For example
2454 would lead to the tokens declared in this order: 'c' 'd' A B. Again, the
2455 input order is now preserved.
2457 These changes were made so that one can remove useless precedence and
2458 associativity declarations (i.e., map %nonassoc, %left or %right to
2459 %precedence, or to %token) and get exactly the same output.
2461 ** Useless precedence and associativity
2463 Contributed by Valentin Tolmer.
2465 When developing and maintaining a grammar, useless associativity and
2466 precedence directives are common. They can be a nuisance: new ambiguities
2467 arising are sometimes masked because their conflicts are resolved due to
2468 the extra precedence or associativity information. Furthermore, it can
2469 hinder the comprehension of a new grammar: one will wonder about the role
2470 of a precedence, where in fact it is useless. The following changes aim
2471 at detecting and reporting these extra directives.
2473 *** Precedence warning category
2475 A new category of warning, -Wprecedence, was introduced. It flags the
2476 useless precedence and associativity directives.
2478 *** Useless associativity
2480 Bison now warns about symbols with a declared associativity that is never
2481 used to resolve conflicts. In that case, using %precedence is sufficient;
2482 the parsing tables will remain unchanged. Solving these warnings may raise
2483 useless precedence warnings, as the symbols no longer have associativity.
2497 warning: useless associativity for '+', use %precedence [-Wprecedence]
2501 *** Useless precedence
2503 Bison now warns about symbols with a declared precedence and no declared
2504 associativity (i.e., declared with %precedence), and whose precedence is
2505 never used. In that case, the symbol can be safely declared with %token
2506 instead, without modifying the parsing tables. For example:
2510 exp: "var" '=' "number";
2514 warning: useless precedence for '=' [-Wprecedence]
2518 *** Useless precedence and associativity
2520 In case of both useless precedence and associativity, the issue is flagged
2525 exp: "var" '=' "number";
2529 warning: useless precedence and associativity for '=' [-Wprecedence]
2535 With help from Joel E. Denny and Gabriel Rassoul.
2537 Empty rules (i.e., with an empty right-hand side) can now be explicitly
2538 marked by the new %empty directive. Using %empty on a non-empty rule is
2539 an error. The new -Wempty-rule warning reports empty rules without
2540 %empty. On the following grammar:
2550 3.4-5: warning: empty rule without %empty [-Wempty-rule]
2553 5.8-13: error: %empty on non-empty rule
2557 ** Java skeleton improvements
2559 The constants for token names were moved to the Lexer interface. Also, it
2560 is possible to add code to the parser's constructors using "%code init"
2561 and "%define init_throws".
2562 Contributed by Paolo Bonzini.
2564 The Java skeleton now supports push parsing.
2565 Contributed by Dennis Heimbigner.
2567 ** C++ skeletons improvements
2569 *** The parser header is no longer mandatory (lalr1.cc, glr.cc)
2571 Using %defines is now optional. Without it, the needed support classes
2572 are defined in the generated parser, instead of additional files (such as
2573 location.hh, position.hh and stack.hh).
2575 *** Locations are no longer mandatory (lalr1.cc, glr.cc)
2577 Both lalr1.cc and glr.cc no longer require %location.
2579 *** syntax_error exception (lalr1.cc)
2581 The C++ parser features a syntax_error exception, which can be
2582 thrown from the scanner or from user rules to raise syntax errors.
2583 This facilitates reporting errors caught in sub-functions (e.g.,
2584 rejecting too large integral literals from a conversion function
2585 used by the scanner, or rejecting invalid combinations from a
2586 factory invoked by the user actions).
2588 *** %define api.value.type variant
2590 This is based on a submission from Michiel De Wilde. With help
2591 from Théophile Ranquet.
2593 In this mode, complex C++ objects can be used as semantic values. For
2596 %token <::std::string> TEXT;
2597 %token <int> NUMBER;
2598 %token SEMICOLON ";"
2599 %type <::std::string> item;
2600 %type <::std::list<std::string>> list;
2603 list { std::cout << $1 << std::endl; }
2607 %empty { /* Generates an empty string list. */ }
2608 | list item ";" { std::swap ($$, $1); $$.push_back ($2); }
2612 TEXT { std::swap ($$, $1); }
2613 | NUMBER { $$ = string_cast ($1); }
2616 *** %define api.token.constructor
2618 When variants are enabled, Bison can generate functions to build the
2619 tokens. This guarantees that the token type (e.g., NUMBER) is consistent
2620 with the semantic value (e.g., int):
2622 parser::symbol_type yylex ()
2624 parser::location_type loc = ...;
2626 return parser::make_TEXT ("Hello, world!", loc);
2628 return parser::make_NUMBER (42, loc);
2630 return parser::make_SEMICOLON (loc);
2636 There are operator- and operator-= for 'location'. Negative line/column
2637 increments can no longer underflow the resulting value.
2640 * Noteworthy changes in release 2.7.1 (2013-04-15) [stable]
2644 *** Fix compiler attribute portability (yacc.c)
2646 With locations enabled, __attribute__ was used unprotected.
2648 *** Fix some compiler warnings (lalr1.cc)
2651 * Noteworthy changes in release 2.7 (2012-12-12) [stable]
2655 Warnings about uninitialized yylloc in yyparse have been fixed.
2657 Restored C90 compliance (yet no report was ever made).
2659 ** Diagnostics are improved
2661 Contributed by Théophile Ranquet.
2663 *** Changes in the format of error messages
2665 This used to be the format of many error reports:
2667 input.y:2.7-12: %type redeclaration for exp
2668 input.y:1.7-12: previous declaration
2672 input.y:2.7-12: error: %type redeclaration for exp
2673 input.y:1.7-12: previous declaration
2675 *** New format for error reports: carets
2677 Caret errors have been added to Bison:
2679 input.y:2.7-12: error: %type redeclaration for exp
2682 input.y:1.7-12: previous declaration
2688 input.y:3.20-23: error: ambiguous reference: '$exp'
2689 exp: exp '+' exp { $exp = $1 + $3; };
2691 input.y:3.1-3: refers to: $exp at $$
2692 exp: exp '+' exp { $exp = $1 + $3; };
2694 input.y:3.6-8: refers to: $exp at $1
2695 exp: exp '+' exp { $exp = $1 + $3; };
2697 input.y:3.14-16: refers to: $exp at $3
2698 exp: exp '+' exp { $exp = $1 + $3; };
2701 The default behavior for now is still not to display these unless
2702 explicitly asked with -fcaret (or -fall). However, in a later release, it
2703 will be made the default behavior (but may still be deactivated with
2706 ** New value for %define variable: api.pure full
2708 The %define variable api.pure requests a pure (reentrant) parser. However,
2709 for historical reasons, using it in a location-tracking Yacc parser
2710 resulted in a yyerror function that did not take a location as a
2711 parameter. With this new value, the user may request a better pure parser,
2712 where yyerror does take a location as a parameter (in location-tracking
2715 The use of "%define api.pure true" is deprecated in favor of this new
2716 "%define api.pure full".
2718 ** New %define variable: api.location.type (glr.cc, lalr1.cc, lalr1.java)
2720 The %define variable api.location.type defines the name of the type to use
2721 for locations. When defined, Bison no longer generates the position.hh
2722 and location.hh files, nor does the parser will include them: the user is
2723 then responsible to define her type.
2725 This can be used in programs with several parsers to factor their location
2726 and position files: let one of them generate them, and the others just use
2729 This feature was actually introduced, but not documented, in Bison 2.5,
2730 under the name "location_type" (which is maintained for backward
2733 For consistency, lalr1.java's %define variables location_type and
2734 position_type are deprecated in favor of api.location.type and
2737 ** Exception safety (lalr1.cc)
2739 The parse function now catches exceptions, uses the %destructors to
2740 release memory (the lookahead symbol and the symbols pushed on the stack)
2741 before re-throwing the exception.
2743 This feature is somewhat experimental. User feedback would be
2746 ** Graph improvements in DOT and XSLT
2748 Contributed by Théophile Ranquet.
2750 The graphical presentation of the states is more readable: their shape is
2751 now rectangular, the state number is clearly displayed, and the items are
2752 numbered and left-justified.
2754 The reductions are now explicitly represented as transitions to other
2755 diamond shaped nodes.
2757 These changes are present in both --graph output and xml2dot.xsl XSLT
2758 processing, with minor (documented) differences.
2760 ** %language is no longer an experimental feature.
2762 The introduction of this feature, in 2.4, was four years ago. The
2763 --language option and the %language directive are no longer experimental.
2767 The sections about shift/reduce and reduce/reduce conflicts resolution
2768 have been fixed and extended.
2770 Although introduced more than four years ago, XML and Graphviz reports
2771 were not properly documented.
2773 The translation of midrule actions is now described.
2776 * Noteworthy changes in release 2.6.5 (2012-11-07) [stable]
2778 We consider compiler warnings about Bison generated parsers to be bugs.
2779 Rather than working around them in your own project, please consider
2780 reporting them to us.
2784 Warnings about uninitialized yylval and/or yylloc for push parsers with a
2785 pure interface have been fixed for GCC 4.0 up to 4.8, and Clang 2.9 to
2788 Other issues in the test suite have been addressed.
2790 Null characters are correctly displayed in error messages.
2792 When possible, yylloc is correctly initialized before calling yylex. It
2793 is no longer necessary to initialize it in the %initial-action.
2796 * Noteworthy changes in release 2.6.4 (2012-10-23) [stable]
2798 Bison 2.6.3's --version was incorrect. This release fixes this issue.
2801 * Noteworthy changes in release 2.6.3 (2012-10-22) [stable]
2805 Bugs and portability issues in the test suite have been fixed.
2807 Some errors in translations have been addressed, and --help now directs
2808 users to the appropriate place to report them.
2810 Stray Info files shipped by accident are removed.
2812 Incorrect definitions of YY_, issued by yacc.c when no parser header is
2813 generated, are removed.
2815 All the generated headers are self-contained.
2817 ** Header guards (yacc.c, glr.c, glr.cc)
2819 In order to avoid collisions, the header guards are now
2820 YY_<PREFIX>_<FILE>_INCLUDED, instead of merely <PREFIX>_<FILE>.
2821 For instance the header generated from
2823 %define api.prefix "calc"
2824 %defines "lib/parse.h"
2826 will use YY_CALC_LIB_PARSE_H_INCLUDED as guard.
2828 ** Fix compiler warnings in the generated parser (yacc.c, glr.c)
2830 The compilation of pure parsers (%define api.pure) can trigger GCC
2833 input.c: In function 'yyparse':
2834 input.c:1503:12: warning: 'yylval' may be used uninitialized in this
2835 function [-Wmaybe-uninitialized]
2839 This is now fixed; pragmas to avoid these warnings are no longer needed.
2841 Warnings from clang ("equality comparison with extraneous parentheses" and
2842 "function declared 'noreturn' should not return") have also been
2846 * Noteworthy changes in release 2.6.2 (2012-08-03) [stable]
2850 Buffer overruns, complaints from Flex, and portability issues in the test
2851 suite have been fixed.
2853 ** Spaces in %lex- and %parse-param (lalr1.cc, glr.cc)
2855 Trailing end-of-lines in %parse-param or %lex-param would result in
2856 invalid C++. This is fixed.
2858 ** Spurious spaces and end-of-lines
2860 The generated files no longer end (nor start) with empty lines.
2863 * Noteworthy changes in release 2.6.1 (2012-07-30) [stable]
2865 Bison no longer executes user-specified M4 code when processing a grammar.
2869 In addition to the removal of the features announced in Bison 2.6, the
2870 next major release will remove the "Temporary hack for adding a semicolon
2871 to the user action", as announced in the release 2.5. Instead of:
2873 exp: exp "+" exp { $$ = $1 + $3 };
2877 exp: exp "+" exp { $$ = $1 + $3; };
2881 *** Type names are now properly escaped.
2883 *** glr.cc: set_debug_level and debug_level work as expected.
2885 *** Stray @ or $ in actions
2887 While Bison used to warn about stray $ or @ in action rules, it did not
2888 for other actions such as printers, destructors, or initial actions. It
2891 ** Type names in actions
2893 For consistency with rule actions, it is now possible to qualify $$ by a
2894 type-name in destructors, printers, and initial actions. For instance:
2896 %printer { fprintf (yyo, "(%d, %f)", $<ival>$, $<fval>$); } <*> <>;
2898 will display two values for each typed and untyped symbol (provided
2899 that YYSTYPE has both "ival" and "fval" fields).
2902 * Noteworthy changes in release 2.6 (2012-07-19) [stable]
2906 The next major release of Bison will drop support for the following
2907 deprecated features. Please report disagreements to bug-bison@gnu.org.
2911 Support for generating parsers in K&R C will be removed. Parsers
2912 generated for C support ISO C90, and are tested with ISO C99 and ISO C11
2915 *** Features deprecated since Bison 1.875
2917 The definitions of yystype and yyltype will be removed; use YYSTYPE and
2920 YYPARSE_PARAM and YYLEX_PARAM, deprecated in favor of %parse-param and
2921 %lex-param, will no longer be supported.
2923 Support for the preprocessor symbol YYERROR_VERBOSE will be removed, use
2926 *** The generated header will be included (yacc.c)
2928 Instead of duplicating the content of the generated header (definition of
2929 YYSTYPE, yyparse declaration etc.), the generated parser will include it,
2930 as is already the case for GLR or C++ parsers. This change is deferred
2931 because existing versions of ylwrap (e.g., Automake 1.12.1) do not support
2934 ** Generated Parser Headers
2936 *** Guards (yacc.c, glr.c, glr.cc)
2938 The generated headers are now guarded, as is already the case for C++
2939 parsers (lalr1.cc). For instance, with --defines=foo.h:
2944 #endif /* !YY_FOO_H */
2946 *** New declarations (yacc.c, glr.c)
2948 The generated header now declares yydebug and yyparse. Both honor
2949 --name-prefix=bar_, and yield
2951 int bar_parse (void);
2955 #define yyparse bar_parse
2958 in order to facilitate the inclusion of several parser headers inside a
2959 single compilation unit.
2961 *** Exported symbols in C++
2963 The symbols YYTOKEN_TABLE and YYERROR_VERBOSE, which were defined in the
2964 header, are removed, as they prevent the possibility of including several
2965 generated headers from a single compilation unit.
2969 For the same reasons, the undocumented and unused macro YYLSP_NEEDED is no
2972 ** New %define variable: api.prefix
2974 Now that the generated headers are more complete and properly protected
2975 against multiple inclusions, constant names, such as YYSTYPE are a
2976 problem. While yyparse and others are properly renamed by %name-prefix,
2977 YYSTYPE, YYDEBUG and others have never been affected by it. Because it
2978 would introduce backward compatibility issues in projects not expecting
2979 YYSTYPE to be renamed, instead of changing the behavior of %name-prefix,
2980 it is deprecated in favor of a new %define variable: api.prefix.
2982 The following examples compares both:
2984 %name-prefix "bar_" | %define api.prefix "bar_"
2985 %token <ival> FOO %token <ival> FOO
2986 %union { int ival; } %union { int ival; }
2992 #ifndef BAR_FOO_H #ifndef BAR_FOO_H
2993 # define BAR_FOO_H # define BAR_FOO_H
2995 /* Enabling traces. */ /* Enabling traces. */
2996 # ifndef YYDEBUG | # ifndef BAR_DEBUG
2997 > # if defined YYDEBUG
2999 > # define BAR_DEBUG 1
3001 > # define BAR_DEBUG 0
3004 # define YYDEBUG 0 | # define BAR_DEBUG 0
3008 # if YYDEBUG | # if BAR_DEBUG
3009 extern int bar_debug; extern int bar_debug;
3012 /* Tokens. */ /* Tokens. */
3013 # ifndef YYTOKENTYPE | # ifndef BAR_TOKENTYPE
3014 # define YYTOKENTYPE | # define BAR_TOKENTYPE
3015 enum yytokentype { | enum bar_tokentype {
3020 #if ! defined YYSTYPE \ | #if ! defined BAR_STYPE \
3021 && ! defined YYSTYPE_IS_DECLARED | && ! defined BAR_STYPE_IS_DECLARED
3022 typedef union YYSTYPE | typedef union BAR_STYPE
3025 } YYSTYPE; | } BAR_STYPE;
3026 # define YYSTYPE_IS_DECLARED 1 | # define BAR_STYPE_IS_DECLARED 1
3029 extern YYSTYPE bar_lval; | extern BAR_STYPE bar_lval;
3031 int bar_parse (void); int bar_parse (void);
3033 #endif /* !BAR_FOO_H */ #endif /* !BAR_FOO_H */
3036 * Noteworthy changes in release 2.5.1 (2012-06-05) [stable]
3040 The next major release will drop support for generating parsers in K&R C.
3042 ** yacc.c: YYBACKUP works as expected.
3044 ** glr.c improvements:
3046 *** Location support is eliminated when not requested:
3048 GLR parsers used to include location-related code even when locations were
3049 not requested, and therefore not even usable.
3051 *** __attribute__ is preserved:
3053 __attribute__ is no longer disabled when __STRICT_ANSI__ is defined (i.e.,
3054 when -std is passed to GCC).
3056 ** lalr1.java: several fixes:
3058 The Java parser no longer throws ArrayIndexOutOfBoundsException if the
3059 first token leads to a syntax error. Some minor clean ups.
3063 *** C++11 compatibility:
3065 C and C++ parsers use "nullptr" instead of "0" when __cplusplus is 201103L
3070 The header files such as "parser.hh", "location.hh", etc. used a constant
3071 name for preprocessor guards, for instance:
3073 #ifndef BISON_LOCATION_HH
3074 # define BISON_LOCATION_HH
3076 #endif // !BISON_LOCATION_HH
3078 The inclusion guard is now computed from "PREFIX/FILE-NAME", where lower
3079 case characters are converted to upper case, and series of
3080 non-alphanumerical characters are converted to an underscore.
3082 With "bison -o lang++/parser.cc", "location.hh" would now include:
3084 #ifndef YY_LANG_LOCATION_HH
3085 # define YY_LANG_LOCATION_HH
3087 #endif // !YY_LANG_LOCATION_HH
3091 The position and location constructors (and their initialize methods)
3092 accept new arguments for line and column. Several issues in the
3093 documentation were fixed.
3095 ** liby is no longer asking for "rpl_fprintf" on some platforms.
3097 ** Changes in the manual:
3099 *** %printer is documented
3101 The "%printer" directive, supported since at least Bison 1.50, is finally
3102 documented. The "mfcalc" example is extended to demonstrate it.
3104 For consistency with the C skeletons, the C++ parsers now also support
3105 "yyoutput" (as an alias to "debug_stream ()").
3107 *** Several improvements have been made:
3109 The layout for grammar excerpts was changed to a more compact scheme.
3110 Named references are motivated. The description of the automaton
3111 description file (*.output) is updated to the current format. Incorrect
3112 index entries were fixed. Some other errors were fixed.
3116 *** Conflicting prototypes with recent/modified Flex.
3118 Fixed build problems with the current, unreleased, version of Flex, and
3119 some modified versions of 2.5.35, which have modified function prototypes.
3121 *** Warnings during the build procedure have been eliminated.
3123 *** Several portability problems in the test suite have been fixed:
3125 This includes warnings with some compilers, unexpected behavior of tools
3126 such as diff, warning messages from the test suite itself, etc.
3128 *** The install-pdf target works properly:
3130 Running "make install-pdf" (or -dvi, -html, -info, and -ps) no longer
3131 halts in the middle of its course.
3134 * Noteworthy changes in release 2.5 (2011-05-14)
3136 ** Grammar symbol names can now contain non-initial dashes:
3138 Consistently with directives (such as %error-verbose) and with
3139 %define variables (e.g. push-pull), grammar symbol names may contain
3140 dashes in any position except the beginning. This is a GNU
3141 extension over POSIX Yacc. Thus, use of this extension is reported
3142 by -Wyacc and rejected in Yacc mode (--yacc).
3144 ** Named references:
3146 Historically, Yacc and Bison have supported positional references
3147 ($n, $$) to allow access to symbol values from inside of semantic
3150 Starting from this version, Bison can also accept named references.
3151 When no ambiguity is possible, original symbol names may be used
3152 as named references:
3154 if_stmt : "if" cond_expr "then" then_stmt ';'
3155 { $if_stmt = mk_if_stmt($cond_expr, $then_stmt); }
3157 In the more common case, explicit names may be declared:
3159 stmt[res] : "if" expr[cond] "then" stmt[then] "else" stmt[else] ';'
3160 { $res = mk_if_stmt($cond, $then, $else); }
3162 Location information is also accessible using @name syntax. When
3163 accessing symbol names containing dots or dashes, explicit bracketing
3164 ($[sym.1]) must be used.
3166 These features are experimental in this version. More user feedback
3167 will help to stabilize them.
3168 Contributed by Alex Rozenman.
3170 ** IELR(1) and canonical LR(1):
3172 IELR(1) is a minimal LR(1) parser table generation algorithm. That
3173 is, given any context-free grammar, IELR(1) generates parser tables
3174 with the full language-recognition power of canonical LR(1) but with
3175 nearly the same number of parser states as LALR(1). This reduction
3176 in parser states is often an order of magnitude. More importantly,
3177 because canonical LR(1)'s extra parser states may contain duplicate
3178 conflicts in the case of non-LR(1) grammars, the number of conflicts
3179 for IELR(1) is often an order of magnitude less as well. This can
3180 significantly reduce the complexity of developing of a grammar.
3182 Bison can now generate IELR(1) and canonical LR(1) parser tables in
3183 place of its traditional LALR(1) parser tables, which remain the
3184 default. You can specify the type of parser tables in the grammar
3185 file with these directives:
3187 %define lr.type lalr
3188 %define lr.type ielr
3189 %define lr.type canonical-lr
3191 The default-reduction optimization in the parser tables can also be
3192 adjusted using "%define lr.default-reductions". For details on both
3193 of these features, see the new section "Tuning LR" in the Bison
3196 These features are experimental. More user feedback will help to
3199 ** LAC (Lookahead Correction) for syntax error handling
3201 Contributed by Joel E. Denny.
3203 Canonical LR, IELR, and LALR can suffer from a couple of problems
3204 upon encountering a syntax error. First, the parser might perform
3205 additional parser stack reductions before discovering the syntax
3206 error. Such reductions can perform user semantic actions that are
3207 unexpected because they are based on an invalid token, and they
3208 cause error recovery to begin in a different syntactic context than
3209 the one in which the invalid token was encountered. Second, when
3210 verbose error messages are enabled (with %error-verbose or the
3211 obsolete "#define YYERROR_VERBOSE"), the expected token list in the
3212 syntax error message can both contain invalid tokens and omit valid
3215 The culprits for the above problems are %nonassoc, default
3216 reductions in inconsistent states, and parser state merging. Thus,
3217 IELR and LALR suffer the most. Canonical LR can suffer only if
3218 %nonassoc is used or if default reductions are enabled for
3219 inconsistent states.
3221 LAC is a new mechanism within the parsing algorithm that solves
3222 these problems for canonical LR, IELR, and LALR without sacrificing
3223 %nonassoc, default reductions, or state merging. When LAC is in
3224 use, canonical LR and IELR behave almost exactly the same for both
3225 syntactically acceptable and syntactically unacceptable input.
3226 While LALR still does not support the full language-recognition
3227 power of canonical LR and IELR, LAC at least enables LALR's syntax
3228 error handling to correctly reflect LALR's language-recognition
3231 Currently, LAC is only supported for deterministic parsers in C.
3232 You can enable LAC with the following directive:
3234 %define parse.lac full
3236 See the new section "LAC" in the Bison manual for additional
3237 details including a few caveats.
3239 LAC is an experimental feature. More user feedback will help to
3242 ** %define improvements:
3244 *** Can now be invoked via the command line:
3246 Each of these command-line options
3249 --define=NAME[=VALUE]
3252 --force-define=NAME[=VALUE]
3254 is equivalent to this grammar file declaration
3256 %define NAME ["VALUE"]
3258 except that the manner in which Bison processes multiple definitions
3259 for the same NAME differs. Most importantly, -F and --force-define
3260 quietly override %define, but -D and --define do not. For further
3261 details, see the section "Bison Options" in the Bison manual.
3263 *** Variables renamed:
3265 The following %define variables
3268 lr.keep_unreachable_states
3270 have been renamed to
3273 lr.keep-unreachable-states
3275 The old names are now deprecated but will be maintained indefinitely
3276 for backward compatibility.
3278 *** Values no longer need to be quoted in the grammar file:
3280 If a %define value is an identifier, it no longer needs to be placed
3281 within quotations marks. For example,
3283 %define api.push-pull "push"
3287 %define api.push-pull push
3289 *** Unrecognized variables are now errors not warnings.
3291 *** Multiple invocations for any variable is now an error not a warning.
3293 ** Unrecognized %code qualifiers are now errors not warnings.
3295 ** Character literals not of length one:
3297 Previously, Bison quietly converted all character literals to length
3298 one. For example, without warning, Bison interpreted the operators in
3299 the following grammar to be the same token:
3305 Bison now warns when a character literal is not of length one. In
3306 some future release, Bison will start reporting an error instead.
3308 ** Destructor calls fixed for lookaheads altered in semantic actions:
3310 Previously for deterministic parsers in C, if a user semantic action
3311 altered yychar, the parser in some cases used the old yychar value to
3312 determine which destructor to call for the lookahead upon a syntax
3313 error or upon parser return. This bug has been fixed.
3315 ** C++ parsers use YYRHSLOC:
3317 Similarly to the C parsers, the C++ parsers now define the YYRHSLOC
3318 macro and use it in the default YYLLOC_DEFAULT. You are encouraged
3319 to use it. If, for instance, your location structure has "first"
3320 and "last" members, instead of
3322 # define YYLLOC_DEFAULT(Current, Rhs, N) \
3326 (Current).first = (Rhs)[1].location.first; \
3327 (Current).last = (Rhs)[N].location.last; \
3331 (Current).first = (Current).last = (Rhs)[0].location.last; \
3337 # define YYLLOC_DEFAULT(Current, Rhs, N) \
3341 (Current).first = YYRHSLOC (Rhs, 1).first; \
3342 (Current).last = YYRHSLOC (Rhs, N).last; \
3346 (Current).first = (Current).last = YYRHSLOC (Rhs, 0).last; \
3350 ** YYLLOC_DEFAULT in C++:
3352 The default implementation of YYLLOC_DEFAULT used to be issued in
3353 the header file. It is now output in the implementation file, after
3354 the user %code sections so that its #ifndef guard does not try to
3355 override the user's YYLLOC_DEFAULT if provided.
3357 ** YYFAIL now produces warnings and Java parsers no longer implement it:
3359 YYFAIL has existed for many years as an undocumented feature of
3360 deterministic parsers in C generated by Bison. More recently, it was
3361 a documented feature of Bison's experimental Java parsers. As
3362 promised in Bison 2.4.2's NEWS entry, any appearance of YYFAIL in a
3363 semantic action now produces a deprecation warning, and Java parsers
3364 no longer implement YYFAIL at all. For further details, including a
3365 discussion of how to suppress C preprocessor warnings about YYFAIL
3366 being unused, see the Bison 2.4.2 NEWS entry.
3368 ** Temporary hack for adding a semicolon to the user action:
3370 Previously, Bison appended a semicolon to every user action for
3371 reductions when the output language defaulted to C (specifically, when
3372 neither %yacc, %language, %skeleton, or equivalent command-line
3373 options were specified). This allowed actions such as
3375 exp: exp "+" exp { $$ = $1 + $3 };
3379 exp: exp "+" exp { $$ = $1 + $3; };
3381 As a first step in removing this misfeature, Bison now issues a
3382 warning when it appends a semicolon. Moreover, in cases where Bison
3383 cannot easily determine whether a semicolon is needed (for example, an
3384 action ending with a cpp directive or a braced compound initializer),
3385 it no longer appends one. Thus, the C compiler might now complain
3386 about a missing semicolon where it did not before. Future releases of
3387 Bison will cease to append semicolons entirely.
3389 ** Verbose syntax error message fixes:
3391 When %error-verbose or the obsolete "#define YYERROR_VERBOSE" is
3392 specified, syntax error messages produced by the generated parser
3393 include the unexpected token as well as a list of expected tokens.
3394 The effect of %nonassoc on these verbose messages has been corrected
3395 in two ways, but a more complete fix requires LAC, described above:
3397 *** When %nonassoc is used, there can exist parser states that accept no
3398 tokens, and so the parser does not always require a lookahead token
3399 in order to detect a syntax error. Because no unexpected token or
3400 expected tokens can then be reported, the verbose syntax error
3401 message described above is suppressed, and the parser instead
3402 reports the simpler message, "syntax error". Previously, this
3403 suppression was sometimes erroneously triggered by %nonassoc when a
3404 lookahead was actually required. Now verbose messages are
3405 suppressed only when all previous lookaheads have already been
3406 shifted or discarded.
3408 *** Previously, the list of expected tokens erroneously included tokens
3409 that would actually induce a syntax error because conflicts for them
3410 were resolved with %nonassoc in the current parser state. Such
3411 tokens are now properly omitted from the list.
3413 *** Expected token lists are still often wrong due to state merging
3414 (from LALR or IELR) and default reductions, which can both add
3415 invalid tokens and subtract valid tokens. Canonical LR almost
3416 completely fixes this problem by eliminating state merging and
3417 default reductions. However, there is one minor problem left even
3418 when using canonical LR and even after the fixes above. That is,
3419 if the resolution of a conflict with %nonassoc appears in a later
3420 parser state than the one at which some syntax error is
3421 discovered, the conflicted token is still erroneously included in
3422 the expected token list. Bison's new LAC implementation,
3423 described above, eliminates this problem and the need for
3424 canonical LR. However, LAC is still experimental and is disabled
3427 ** Java skeleton fixes:
3429 *** A location handling bug has been fixed.
3431 *** The top element of each of the value stack and location stack is now
3432 cleared when popped so that it can be garbage collected.
3434 *** Parser traces now print the top element of the stack.
3436 ** -W/--warnings fixes:
3438 *** Bison now properly recognizes the "no-" versions of categories:
3440 For example, given the following command line, Bison now enables all
3441 warnings except warnings for incompatibilities with POSIX Yacc:
3443 bison -Wall,no-yacc gram.y
3445 *** Bison now treats S/R and R/R conflicts like other warnings:
3447 Previously, conflict reports were independent of Bison's normal
3448 warning system. Now, Bison recognizes the warning categories
3449 "conflicts-sr" and "conflicts-rr". This change has important
3450 consequences for the -W and --warnings command-line options. For
3453 bison -Wno-conflicts-sr gram.y # S/R conflicts not reported
3454 bison -Wno-conflicts-rr gram.y # R/R conflicts not reported
3455 bison -Wnone gram.y # no conflicts are reported
3456 bison -Werror gram.y # any conflict is an error
3458 However, as before, if the %expect or %expect-rr directive is
3459 specified, an unexpected number of conflicts is an error, and an
3460 expected number of conflicts is not reported, so -W and --warning
3461 then have no effect on the conflict report.
3463 *** The "none" category no longer disables a preceding "error":
3465 For example, for the following command line, Bison now reports
3466 errors instead of warnings for incompatibilities with POSIX Yacc:
3468 bison -Werror,none,yacc gram.y
3470 *** The "none" category now disables all Bison warnings:
3472 Previously, the "none" category disabled only Bison warnings for
3473 which there existed a specific -W/--warning category. However,
3474 given the following command line, Bison is now guaranteed to
3475 suppress all warnings:
3479 ** Precedence directives can now assign token number 0:
3481 Since Bison 2.3b, which restored the ability of precedence
3482 directives to assign token numbers, doing so for token number 0 has
3483 produced an assertion failure. For example:
3487 This bug has been fixed.
3490 * Noteworthy changes in release 2.4.3 (2010-08-05)
3492 ** Bison now obeys -Werror and --warnings=error for warnings about
3493 grammar rules that are useless in the parser due to conflicts.
3495 ** Problems with spawning M4 on at least FreeBSD 8 and FreeBSD 9 have
3498 ** Failures in the test suite for GCC 4.5 have been fixed.
3500 ** Failures in the test suite for some versions of Sun Studio C++ have
3503 ** Contrary to Bison 2.4.2's NEWS entry, it has been decided that
3504 warnings about undefined %prec identifiers will not be converted to
3505 errors in Bison 2.5. They will remain warnings, which should be
3506 sufficient for POSIX while avoiding backward compatibility issues.
3508 ** Minor documentation fixes.
3511 * Noteworthy changes in release 2.4.2 (2010-03-20)
3513 ** Some portability problems that resulted in failures and livelocks
3514 in the test suite on some versions of at least Solaris, AIX, HP-UX,
3515 RHEL4, and Tru64 have been addressed. As a result, fatal Bison
3516 errors should no longer cause M4 to report a broken pipe on the
3519 ** "%prec IDENTIFIER" requires IDENTIFIER to be defined separately.
3521 POSIX specifies that an error be reported for any identifier that does
3522 not appear on the LHS of a grammar rule and that is not defined by
3523 %token, %left, %right, or %nonassoc. Bison 2.3b and later lost this
3524 error report for the case when an identifier appears only after a
3525 %prec directive. It is now restored. However, for backward
3526 compatibility with recent Bison releases, it is only a warning for
3527 now. In Bison 2.5 and later, it will return to being an error.
3528 [Between the 2.4.2 and 2.4.3 releases, it was decided that this
3529 warning will not be converted to an error in Bison 2.5.]
3531 ** Detection of GNU M4 1.4.6 or newer during configure is improved.
3533 ** Warnings from gcc's -Wundef option about undefined YYENABLE_NLS,
3534 YYLTYPE_IS_TRIVIAL, and __STRICT_ANSI__ in C/C++ parsers are now
3537 ** %code is now a permanent feature.
3539 A traditional Yacc prologue directive is written in the form:
3543 To provide a more flexible alternative, Bison 2.3b introduced the
3544 %code directive with the following forms for C/C++:
3547 %code requires {CODE}
3548 %code provides {CODE}
3551 These forms are now considered permanent features of Bison. See the
3552 %code entries in the section "Bison Declaration Summary" in the Bison
3553 manual for a summary of their functionality. See the section
3554 "Prologue Alternatives" for a detailed discussion including the
3555 advantages of %code over the traditional Yacc prologue directive.
3557 Bison's Java feature as a whole including its current usage of %code
3558 is still considered experimental.
3560 ** YYFAIL is deprecated and will eventually be removed.
3562 YYFAIL has existed for many years as an undocumented feature of
3563 deterministic parsers in C generated by Bison. Previously, it was
3564 documented for Bison's experimental Java parsers. YYFAIL is no longer
3565 documented for Java parsers and is formally deprecated in both cases.
3566 Users are strongly encouraged to migrate to YYERROR, which is
3569 Like YYERROR, you can invoke YYFAIL from a semantic action in order to
3570 induce a syntax error. The most obvious difference from YYERROR is
3571 that YYFAIL will automatically invoke yyerror to report the syntax
3572 error so that you don't have to. However, there are several other
3573 subtle differences between YYERROR and YYFAIL, and YYFAIL suffers from
3574 inherent flaws when %error-verbose or "#define YYERROR_VERBOSE" is
3575 used. For a more detailed discussion, see:
3577 https://lists.gnu.org/r/bison-patches/2009-12/msg00024.html
3579 The upcoming Bison 2.5 will remove YYFAIL from Java parsers, but
3580 deterministic parsers in C will continue to implement it. However,
3581 because YYFAIL is already flawed, it seems futile to try to make new
3582 Bison features compatible with it. Thus, during parser generation,
3583 Bison 2.5 will produce a warning whenever it discovers YYFAIL in a
3584 rule action. In a later release, YYFAIL will be disabled for
3585 %error-verbose and "#define YYERROR_VERBOSE". Eventually, YYFAIL will
3586 be removed altogether.
3588 There exists at least one case where Bison 2.5's YYFAIL warning will
3589 be a false positive. Some projects add phony uses of YYFAIL and other
3590 Bison-defined macros for the sole purpose of suppressing C
3591 preprocessor warnings (from GCC cpp's -Wunused-macros, for example).
3592 To avoid Bison's future warning, such YYFAIL uses can be moved to the
3593 epilogue (that is, after the second "%%") in the Bison input file. In
3594 this release (2.4.2), Bison already generates its own code to suppress
3595 C preprocessor warnings for YYFAIL, so projects can remove their own
3596 phony uses of YYFAIL if compatibility with Bison releases prior to
3597 2.4.2 is not necessary.
3599 ** Internationalization.
3601 Fix a regression introduced in Bison 2.4: Under some circumstances,
3602 message translations were not installed although supported by the
3606 * Noteworthy changes in release 2.4.1 (2008-12-11)
3608 ** In the GLR defines file, unexpanded M4 macros in the yylval and yylloc
3609 declarations have been fixed.
3611 ** Temporary hack for adding a semicolon to the user action.
3613 Bison used to prepend a trailing semicolon at the end of the user
3614 action for reductions. This allowed actions such as
3616 exp: exp "+" exp { $$ = $1 + $3 };
3620 exp: exp "+" exp { $$ = $1 + $3; };
3622 Some grammars still depend on this "feature". Bison 2.4.1 restores
3623 the previous behavior in the case of C output (specifically, when
3624 neither %language or %skeleton or equivalent command-line options
3625 are used) to leave more time for grammars depending on the old
3626 behavior to be adjusted. Future releases of Bison will disable this
3629 ** A few minor improvements to the Bison manual.
3632 * Noteworthy changes in release 2.4 (2008-11-02)
3634 ** %language is an experimental feature.
3636 We first introduced this feature in test release 2.3b as a cleaner
3637 alternative to %skeleton. Since then, we have discussed the possibility of
3638 modifying its effect on Bison's output file names. Thus, in this release,
3639 we consider %language to be an experimental feature that will likely evolve
3642 ** Forward compatibility with GNU M4 has been improved.
3644 ** Several bugs in the C++ skeleton and the experimental Java skeleton have been
3648 * Noteworthy changes in release 2.3b (2008-05-27)
3650 ** The quotes around NAME that used to be required in the following directive
3653 %define NAME "VALUE"
3655 ** The directive "%pure-parser" is now deprecated in favor of:
3659 which has the same effect except that Bison is more careful to warn about
3660 unreasonable usage in the latter case.
3664 Bison can now generate an LALR(1) parser in C with a push interface. That
3665 is, instead of invoking "yyparse", which pulls tokens from "yylex", you can
3666 push one token at a time to the parser using "yypush_parse", which will
3667 return to the caller after processing each token. By default, the push
3668 interface is disabled. Either of the following directives will enable it:
3670 %define api.push_pull "push" // Just push; does not require yylex.
3671 %define api.push_pull "both" // Push and pull; requires yylex.
3673 See the new section "A Push Parser" in the Bison manual for details.
3675 The current push parsing interface is experimental and may evolve. More user
3676 feedback will help to stabilize it.
3678 ** The -g and --graph options now output graphs in Graphviz DOT format,
3679 not VCG format. Like --graph, -g now also takes an optional FILE argument
3680 and thus cannot be bundled with other short options.
3684 Bison can now generate an LALR(1) parser in Java. The skeleton is
3685 "data/lalr1.java". Consider using the new %language directive instead of
3686 %skeleton to select it.
3688 See the new section "Java Parsers" in the Bison manual for details.
3690 The current Java interface is experimental and may evolve. More user
3691 feedback will help to stabilize it.
3692 Contributed by Paolo Bonzini.
3696 This new directive specifies the programming language of the generated
3697 parser, which can be C (the default), C++, or Java. Besides the skeleton
3698 that Bison uses, the directive affects the names of the generated files if
3699 the grammar file's name ends in ".y".
3701 ** XML Automaton Report
3703 Bison can now generate an XML report of the LALR(1) automaton using the new
3704 "--xml" option. The current XML schema is experimental and may evolve. More
3705 user feedback will help to stabilize it.
3706 Contributed by Wojciech Polak.
3708 ** The grammar file may now specify the name of the parser header file using
3709 %defines. For example:
3713 ** When reporting useless rules, useless nonterminals, and unused terminals,
3714 Bison now employs the terms "useless in grammar" instead of "useless",
3715 "useless in parser" instead of "never reduced", and "unused in grammar"
3716 instead of "unused".
3718 ** Unreachable State Removal
3720 Previously, Bison sometimes generated parser tables containing unreachable
3721 states. A state can become unreachable during conflict resolution if Bison
3722 disables a shift action leading to it from a predecessor state. Bison now:
3724 1. Removes unreachable states.
3726 2. Does not report any conflicts that appeared in unreachable states.
3727 WARNING: As a result, you may need to update %expect and %expect-rr
3728 directives in existing grammar files.
3730 3. For any rule used only in such states, Bison now reports the rule as
3731 "useless in parser due to conflicts".
3733 This feature can be disabled with the following directive:
3735 %define lr.keep_unreachable_states
3737 See the %define entry in the "Bison Declaration Summary" in the Bison manual
3738 for further discussion.
3740 ** Lookahead Set Correction in the ".output" Report
3742 When instructed to generate a ".output" file including lookahead sets
3743 (using "--report=lookahead", for example), Bison now prints each reduction's
3744 lookahead set only next to the associated state's one item that (1) is
3745 associated with the same rule as the reduction and (2) has its dot at the end
3746 of its RHS. Previously, Bison also erroneously printed the lookahead set
3747 next to all of the state's other items associated with the same rule. This
3748 bug affected only the ".output" file and not the generated parser source
3751 ** --report-file=FILE is a new option to override the default ".output" file
3754 ** The "=" that used to be required in the following directives is now
3757 %file-prefix "parser"
3761 ** An Alternative to "%{...%}" -- "%code QUALIFIER {CODE}"
3763 Bison 2.3a provided a new set of directives as a more flexible alternative to
3764 the traditional Yacc prologue blocks. Those have now been consolidated into
3765 a single %code directive with an optional qualifier field, which identifies
3766 the purpose of the code and thus the location(s) where Bison should generate
3769 1. "%code {CODE}" replaces "%after-header {CODE}"
3770 2. "%code requires {CODE}" replaces "%start-header {CODE}"
3771 3. "%code provides {CODE}" replaces "%end-header {CODE}"
3772 4. "%code top {CODE}" replaces "%before-header {CODE}"
3774 See the %code entries in section "Bison Declaration Summary" in the Bison
3775 manual for a summary of the new functionality. See the new section "Prologue
3776 Alternatives" for a detailed discussion including the advantages of %code
3777 over the traditional Yacc prologues.
3779 The prologue alternatives are experimental. More user feedback will help to
3780 determine whether they should become permanent features.
3782 ** Revised warning: unset or unused midrule values
3784 Since Bison 2.2, Bison has warned about midrule values that are set but not
3785 used within any of the actions of the parent rule. For example, Bison warns
3788 exp: '1' { $$ = 1; } '+' exp { $$ = $1 + $4; };
3790 Now, Bison also warns about midrule values that are used but not set. For
3791 example, Bison warns about unset $$ in the midrule action in:
3793 exp: '1' { $1 = 1; } '+' exp { $$ = $2 + $4; };
3795 However, Bison now disables both of these warnings by default since they
3796 sometimes prove to be false alarms in existing grammars employing the Yacc
3797 constructs $0 or $-N (where N is some positive integer).
3799 To enable these warnings, specify the option "--warnings=midrule-values" or
3800 "-W", which is a synonym for "--warnings=all".
3802 ** Default %destructor or %printer with "<*>" or "<>"
3804 Bison now recognizes two separate kinds of default %destructor's and
3807 1. Place "<*>" in a %destructor/%printer symbol list to define a default
3808 %destructor/%printer for all grammar symbols for which you have formally
3809 declared semantic type tags.
3811 2. Place "<>" in a %destructor/%printer symbol list to define a default
3812 %destructor/%printer for all grammar symbols without declared semantic
3815 Bison no longer supports the "%symbol-default" notation from Bison 2.3a.
3816 "<*>" and "<>" combined achieve the same effect with one exception: Bison no
3817 longer applies any %destructor to a midrule value if that midrule value is
3818 not actually ever referenced using either $$ or $n in a semantic action.
3820 The default %destructor's and %printer's are experimental. More user
3821 feedback will help to determine whether they should become permanent
3824 See the section "Freeing Discarded Symbols" in the Bison manual for further
3827 ** %left, %right, and %nonassoc can now declare token numbers. This is required
3828 by POSIX. However, see the end of section "Operator Precedence" in the Bison
3829 manual for a caveat concerning the treatment of literal strings.
3831 ** The nonfunctional --no-parser, -n, and %no-parser options have been
3832 completely removed from Bison.
3835 * Noteworthy changes in release 2.3a (2006-09-13)
3837 ** Instead of %union, you can define and use your own union type
3838 YYSTYPE if your grammar contains at least one <type> tag.
3839 Your YYSTYPE need not be a macro; it can be a typedef.
3840 This change is for compatibility with other Yacc implementations,
3841 and is required by POSIX.
3843 ** Locations columns and lines start at 1.
3844 In accordance with the GNU Coding Standards and Emacs.
3846 ** You may now declare per-type and default %destructor's and %printer's:
3850 %union { char *string; }
3851 %token <string> STRING1
3852 %token <string> STRING2
3853 %type <string> string1
3854 %type <string> string2
3855 %union { char character; }
3856 %token <character> CHR
3857 %type <character> chr
3858 %destructor { free ($$); } %symbol-default
3859 %destructor { free ($$); printf ("%d", @$.first_line); } STRING1 string1
3860 %destructor { } <character>
3862 guarantees that, when the parser discards any user-defined symbol that has a
3863 semantic type tag other than "<character>", it passes its semantic value to
3864 "free". However, when the parser discards a "STRING1" or a "string1", it
3865 also prints its line number to "stdout". It performs only the second
3866 "%destructor" in this case, so it invokes "free" only once.
3868 [Although we failed to mention this here in the 2.3a release, the default
3869 %destructor's and %printer's were experimental, and they were rewritten in
3872 ** Except for LALR(1) parsers in C with POSIX Yacc emulation enabled (with "-y",
3873 "--yacc", or "%yacc"), Bison no longer generates #define statements for
3874 associating token numbers with token names. Removing the #define statements
3875 helps to sanitize the global namespace during preprocessing, but POSIX Yacc
3876 requires them. Bison still generates an enum for token names in all cases.
3878 ** Handling of traditional Yacc prologue blocks is now more consistent but
3879 potentially incompatible with previous releases of Bison.
3881 As before, you declare prologue blocks in your grammar file with the
3882 "%{ ... %}" syntax. To generate the pre-prologue, Bison concatenates all
3883 prologue blocks that you've declared before the first %union. To generate
3884 the post-prologue, Bison concatenates all prologue blocks that you've
3885 declared after the first %union.
3887 Previous releases of Bison inserted the pre-prologue into both the header
3888 file and the code file in all cases except for LALR(1) parsers in C. In the
3889 latter case, Bison inserted it only into the code file. For parsers in C++,
3890 the point of insertion was before any token definitions (which associate
3891 token numbers with names). For parsers in C, the point of insertion was
3892 after the token definitions.
3894 Now, Bison never inserts the pre-prologue into the header file. In the code
3895 file, it always inserts it before the token definitions.
3897 ** Bison now provides a more flexible alternative to the traditional Yacc
3898 prologue blocks: %before-header, %start-header, %end-header, and
3901 For example, the following declaration order in the grammar file reflects the
3902 order in which Bison will output these code blocks. However, you are free to
3903 declare these code blocks in your grammar file in whatever order is most
3907 /* Bison treats this block like a pre-prologue block: it inserts it into
3908 * the code file before the contents of the header file. It does *not*
3909 * insert it into the header file. This is a good place to put
3910 * #include's that you want at the top of your code file. A common
3911 * example is '#include "system.h"'. */
3914 /* Bison inserts this block into both the header file and the code file.
3915 * In both files, the point of insertion is before any Bison-generated
3916 * token, semantic type, location type, and class definitions. This is a
3917 * good place to define %union dependencies, for example. */
3920 /* Unlike the traditional Yacc prologue blocks, the output order for the
3921 * new %*-header blocks is not affected by their declaration position
3922 * relative to any %union in the grammar file. */
3925 /* Bison inserts this block into both the header file and the code file.
3926 * In both files, the point of insertion is after the Bison-generated
3927 * definitions. This is a good place to declare or define public
3928 * functions or data structures that depend on the Bison-generated
3932 /* Bison treats this block like a post-prologue block: it inserts it into
3933 * the code file after the contents of the header file. It does *not*
3934 * insert it into the header file. This is a good place to declare or
3935 * define internal functions or data structures that depend on the
3936 * Bison-generated definitions. */
3939 If you have multiple occurrences of any one of the above declarations, Bison
3940 will concatenate the contents in declaration order.
3942 [Although we failed to mention this here in the 2.3a release, the prologue
3943 alternatives were experimental, and they were rewritten in future versions.]
3945 ** The option "--report=look-ahead" has been changed to "--report=lookahead".
3946 The old spelling still works, but is not documented and may be removed
3947 in a future release.
3950 * Noteworthy changes in release 2.3 (2006-06-05)
3952 ** GLR grammars should now use "YYRECOVERING ()" instead of "YYRECOVERING",
3953 for compatibility with LALR(1) grammars.
3955 ** It is now documented that any definition of YYSTYPE or YYLTYPE should
3956 be to a type name that does not contain parentheses or brackets.
3959 * Noteworthy changes in release 2.2 (2006-05-19)
3961 ** The distribution terms for all Bison-generated parsers now permit
3962 using the parsers in nonfree programs. Previously, this permission
3963 was granted only for Bison-generated LALR(1) parsers in C.
3965 ** %name-prefix changes the namespace name in C++ outputs.
3967 ** The C++ parsers export their token_type.
3969 ** Bison now allows multiple %union declarations, and concatenates
3970 their contents together.
3972 ** New warning: unused values
3973 Right-hand side symbols whose values are not used are reported,
3974 if the symbols have destructors. For instance:
3976 exp: exp "?" exp ":" exp { $1 ? $1 : $3; }
3980 will trigger a warning about $$ and $5 in the first rule, and $3 in
3981 the second ($1 is copied to $$ by the default rule). This example
3982 most likely contains three errors, and could be rewritten as:
3984 exp: exp "?" exp ":" exp
3985 { $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); }
3987 { $$ = $1 ? $1 : $3; if ($1) free ($3); }
3990 However, if the original actions were really intended, memory leaks
3991 and all, the warnings can be suppressed by letting Bison believe the
3992 values are used, e.g.:
3994 exp: exp "?" exp ":" exp { $1 ? $1 : $3; (void) ($$, $5); }
3995 | exp "+" exp { $$ = $1; (void) $3; }
3998 If there are midrule actions, the warning is issued if no action
3999 uses it. The following triggers no warning: $1 and $3 are used.
4001 exp: exp { push ($1); } '+' exp { push ($3); sum (); };
4003 The warning is intended to help catching lost values and memory leaks.
4004 If a value is ignored, its associated memory typically is not reclaimed.
4006 ** %destructor vs. YYABORT, YYACCEPT, and YYERROR.
4007 Destructors are now called when user code invokes YYABORT, YYACCEPT,
4008 and YYERROR, for all objects on the stack, other than objects
4009 corresponding to the right-hand side of the current rule.
4011 ** %expect, %expect-rr
4012 Incorrect numbers of expected conflicts are now actual errors,
4013 instead of warnings.
4015 ** GLR, YACC parsers.
4016 The %parse-params are available in the destructors (and the
4017 experimental printers) as per the documentation.
4019 ** Bison now warns if it finds a stray "$" or "@" in an action.
4021 ** %require "VERSION"
4022 This specifies that the grammar file depends on features implemented
4023 in Bison version VERSION or higher.
4025 ** lalr1.cc: The token and value types are now class members.
4026 The tokens were defined as free form enums and cpp macros. YYSTYPE
4027 was defined as a free form union. They are now class members:
4028 tokens are enumerations of the "yy::parser::token" struct, and the
4029 semantic values have the "yy::parser::semantic_type" type.
4031 If you do not want or can update to this scheme, the directive
4032 '%define "global_tokens_and_yystype" "1"' triggers the global
4033 definition of tokens and YYSTYPE. This change is suitable both
4034 for previous releases of Bison, and this one.
4036 If you wish to update, then make sure older version of Bison will
4037 fail using '%require "2.2"'.
4039 ** DJGPP support added.
4042 * Noteworthy changes in release 2.1 (2005-09-16)
4044 ** The C++ lalr1.cc skeleton supports %lex-param.
4046 ** Bison-generated parsers now support the translation of diagnostics like
4047 "syntax error" into languages other than English. The default
4048 language is still English. For details, please see the new
4049 Internationalization section of the Bison manual. Software
4050 distributors should also see the new PACKAGING file. Thanks to
4051 Bruno Haible for this new feature.
4053 ** Wording in the Bison-generated parsers has been changed slightly to
4054 simplify translation. In particular, the message "memory exhausted"
4055 has replaced "parser stack overflow", as the old message was not
4056 always accurate for modern Bison-generated parsers.
4058 ** Destructors are now called when the parser aborts, for all symbols left
4059 behind on the stack. Also, the start symbol is now destroyed after a
4060 successful parse. In both cases, the behavior was formerly inconsistent.
4062 ** When generating verbose diagnostics, Bison-generated parsers no longer
4063 quote the literal strings associated with tokens. For example, for
4064 a syntax error associated with '%token NUM "number"' they might
4065 print 'syntax error, unexpected number' instead of 'syntax error,
4066 unexpected "number"'.
4069 * Noteworthy changes in release 2.0 (2004-12-25)
4071 ** Possibly-incompatible changes
4073 - Bison-generated parsers no longer default to using the alloca function
4074 (when available) to extend the parser stack, due to widespread
4075 problems in unchecked stack-overflow detection. You can "#define
4076 YYSTACK_USE_ALLOCA 1" to require the use of alloca, but please read
4077 the manual to determine safe values for YYMAXDEPTH in that case.
4079 - Error token location.
4080 During error recovery, the location of the syntax error is updated
4081 to cover the whole sequence covered by the error token: it includes
4082 the shifted symbols thrown away during the first part of the error
4083 recovery, and the lookahead rejected during the second part.
4085 - Semicolon changes:
4086 . Stray semicolons are no longer allowed at the start of a grammar.
4087 . Semicolons are now required after in-grammar declarations.
4089 - Unescaped newlines are no longer allowed in character constants or
4090 string literals. They were never portable, and GCC 3.4.0 has
4091 dropped support for them. Better diagnostics are now generated if
4092 forget a closing quote.
4094 - NUL bytes are no longer allowed in Bison string literals, unfortunately.
4098 - GLR grammars now support locations.
4100 - New directive: %initial-action.
4101 This directive allows the user to run arbitrary code (including
4102 initializing @$) from yyparse before parsing starts.
4104 - A new directive "%expect-rr N" specifies the expected number of
4105 reduce/reduce conflicts in GLR parsers.
4107 - %token numbers can now be hexadecimal integers, e.g., "%token FOO 0x12d".
4108 This is a GNU extension.
4110 - The option "--report=lookahead" was changed to "--report=look-ahead".
4111 [However, this was changed back after 2.3.]
4113 - Experimental %destructor support has been added to lalr1.cc.
4115 - New configure option --disable-yacc, to disable installation of the
4116 yacc command and -ly library introduced in 1.875 for POSIX conformance.
4120 - For now, %expect-count violations are now just warnings, not errors.
4121 This is for compatibility with Bison 1.75 and earlier (when there are
4122 reduce/reduce conflicts) and with Bison 1.30 and earlier (when there
4123 are too many or too few shift/reduce conflicts). However, in future
4124 versions of Bison we plan to improve the %expect machinery so that
4125 these violations will become errors again.
4127 - Within Bison itself, numbers (e.g., goto numbers) are no longer
4128 arbitrarily limited to 16-bit counts.
4130 - Semicolons are now allowed before "|" in grammar rules, as POSIX requires.
4133 * Noteworthy changes in release 1.875 (2003-01-01)
4135 ** The documentation license has been upgraded to version 1.2
4136 of the GNU Free Documentation License.
4138 ** syntax error processing
4140 - In Yacc-style parsers YYLLOC_DEFAULT is now used to compute error
4141 locations too. This fixes bugs in error-location computation.
4144 It is now possible to reclaim the memory associated to symbols
4145 discarded during error recovery. This feature is still experimental.
4148 This new directive is preferred over YYERROR_VERBOSE.
4150 - #defining yyerror to steal internal variables is discouraged.
4151 It is not guaranteed to work forever.
4153 ** POSIX conformance
4155 - Semicolons are once again optional at the end of grammar rules.
4156 This reverts to the behavior of Bison 1.33 and earlier, and improves
4157 compatibility with Yacc.
4159 - "parse error" -> "syntax error"
4160 Bison now uniformly uses the term "syntax error"; formerly, the code
4161 and manual sometimes used the term "parse error" instead. POSIX
4162 requires "syntax error" in diagnostics, and it was thought better to
4165 - The documentation now emphasizes that yylex and yyerror must be
4166 declared before use. C99 requires this.
4168 - Bison now parses C99 lexical constructs like UCNs and
4169 backslash-newline within C escape sequences, as POSIX 1003.1-2001 requires.
4171 - File names are properly escaped in C output. E.g., foo\bar.y is
4172 output as "foo\\bar.y".
4174 - Yacc command and library now available
4175 The Bison distribution now installs a "yacc" command, as POSIX requires.
4176 Also, Bison now installs a small library liby.a containing
4177 implementations of Yacc-compatible yyerror and main functions.
4178 This library is normally not useful, but POSIX requires it.
4180 - Type clashes now generate warnings, not errors.
4182 - If the user does not define YYSTYPE as a macro, Bison now declares it
4183 using typedef instead of defining it as a macro.
4184 For consistency, YYLTYPE is also declared instead of defined.
4186 ** Other compatibility issues
4188 - %union directives can now have a tag before the "{", e.g., the
4189 directive "%union foo {...}" now generates the C code
4190 "typedef union foo { ... } YYSTYPE;"; this is for Yacc compatibility.
4191 The default union tag is "YYSTYPE", for compatibility with Solaris 9 Yacc.
4192 For consistency, YYLTYPE's struct tag is now "YYLTYPE" not "yyltype".
4193 This is for compatibility with both Yacc and Bison 1.35.
4195 - ";" is output before the terminating "}" of an action, for
4196 compatibility with Bison 1.35.
4198 - Bison now uses a Yacc-style format for conflict reports, e.g.,
4199 "conflicts: 2 shift/reduce, 1 reduce/reduce".
4201 - "yystype" and "yyltype" are now obsolescent macros instead of being
4202 typedefs or tags; they are no longer documented and are planned to be
4203 withdrawn in a future release.
4208 Users of Bison have to decide how they handle the portability of the
4211 - "parsing stack overflow..." -> "parser stack overflow"
4212 GLR parsers now report "parser stack overflow" as per the Bison manual.
4214 ** %parse-param and %lex-param
4215 The macros YYPARSE_PARAM and YYLEX_PARAM provide a means to pass
4216 additional context to yyparse and yylex. They suffer from several
4219 - a single argument only can be added,
4220 - their types are weak (void *),
4221 - this context is not passed to ancillary functions such as yyerror,
4222 - only yacc.c parsers support them.
4224 The new %parse-param/%lex-param directives provide a more precise control.
4227 %parse-param {int *nastiness}
4228 %lex-param {int *nastiness}
4229 %parse-param {int *randomness}
4231 results in the following signatures:
4233 int yylex (int *nastiness);
4234 int yyparse (int *nastiness, int *randomness);
4236 or, if both %pure-parser and %locations are used:
4238 int yylex (YYSTYPE *lvalp, YYLTYPE *llocp, int *nastiness);
4239 int yyparse (int *nastiness, int *randomness);
4241 ** Bison now warns if it detects conflicting outputs to the same file,
4242 e.g., it generates a warning for "bison -d -o foo.h foo.y" since
4243 that command outputs both code and header to foo.h.
4245 ** #line in output files
4246 - --no-line works properly.
4248 ** Bison can no longer be built by a K&R C compiler; it requires C89 or
4249 later to be built. This change originally took place a few versions
4250 ago, but nobody noticed until we recently asked someone to try
4251 building Bison with a K&R C compiler.
4254 * Noteworthy changes in release 1.75 (2002-10-14)
4256 ** Bison should now work on 64-bit hosts.
4258 ** Indonesian translation thanks to Tedi Heriyanto.
4261 Fix spurious parse errors.
4264 Some people redefine yyerror to steal yyparse' private variables.
4265 Reenable this trick until an official feature replaces it.
4268 In agreement with POSIX and with other Yaccs, leaving a default
4269 action is valid when $$ is untyped, and $1 typed:
4273 but the converse remains an error:
4277 ** Values of midrule actions
4280 foo: { ... } { $$ = $1; } ...
4282 was incorrectly rejected: $1 is defined in the second midrule
4283 action, and is equal to the $$ of the first midrule action.
4286 * Noteworthy changes in release 1.50 (2002-10-04)
4291 causes Bison to produce a Generalized LR (GLR) parser, capable of handling
4292 almost any context-free grammar, ambiguous or not. The new declarations
4293 %dprec and %merge on grammar rules allow parse-time resolution of
4294 ambiguities. Contributed by Paul Hilfinger.
4296 Unfortunately Bison 1.50 does not work properly on 64-bit hosts
4297 like the Alpha, so please stick to 32-bit hosts for now.
4300 When not in Yacc compatibility mode, when the output file was not
4301 specified, running "bison foo/bar.y" created "foo/bar.c". It
4302 now creates "bar.c".
4305 The undefined token was systematically mapped to 2 which prevented
4306 the use of 2 by the user. This is no longer the case.
4308 ** Unknown token numbers
4309 If yylex returned an out of range value, yyparse could die. This is
4313 According to POSIX, the error token must be 256.
4314 Bison extends this requirement by making it a preference: *if* the
4315 user specified that one of her tokens is numbered 256, then error
4316 will be mapped onto another number.
4318 ** Verbose error messages
4319 They no longer report "..., expecting error or..." for states where
4320 error recovery is possible.
4323 Defaults to "$end" instead of "$".
4325 ** Error recovery now conforms to documentation and to POSIX
4326 When a Bison-generated parser encounters a syntax error, it now pops
4327 the stack until it finds a state that allows shifting the error
4328 token. Formerly, it popped the stack until it found a state that
4329 allowed some non-error action other than a default reduction on the
4330 error token. The new behavior has long been the documented behavior,
4331 and has long been required by POSIX. For more details, please see
4332 Paul Eggert, "Reductions during Bison error handling" (2002-05-20)
4333 <https://lists.gnu.org/r/bug-bison/2002-05/msg00038.html>.
4336 Popped tokens and nonterminals are now reported.
4339 Larger grammars are now supported (larger token numbers, larger grammar
4340 size (= sum of the LHS and RHS lengths), larger LALR tables).
4341 Formerly, many of these numbers ran afoul of 16-bit limits;
4342 now these limits are 32 bits on most hosts.
4344 ** Explicit initial rule
4345 Bison used to play hacks with the initial rule, which the user does
4346 not write. It is now explicit, and visible in the reports and
4350 Before, Bison reported the useless rules, but, although not used,
4351 included them in the parsers. They are now actually removed.
4353 ** Useless rules, useless nonterminals
4354 They are now reported, as a warning, with their locations.
4356 ** Rules never reduced
4357 Rules that can never be reduced because of conflicts are now
4360 ** Incorrect "Token not used"
4361 On a grammar such as
4363 %token useless useful
4365 exp: '0' %prec useful;
4367 where a token was used to set the precedence of the last rule,
4368 bison reported both "useful" and "useless" as useless tokens.
4370 ** Revert the C++ namespace changes introduced in 1.31
4371 as they caused too many portability hassles.
4373 ** Default locations
4374 By an accident of design, the default computation of @$ was
4375 performed after another default computation was performed: @$ = @1.
4376 The latter is now removed: YYLLOC_DEFAULT is fully responsible of
4377 the computation of @$.
4379 ** Token end-of-file
4380 The token end of file may be specified by the user, in which case,
4381 the user symbol is used in the reports, the graphs, and the verbose
4382 error messages instead of "$end", which remains being the default.
4386 %token MYEOF 0 "end of file"
4389 This old option, which has been broken for ages, is removed.
4392 Brazilian Portuguese, thanks to Alexandre Folle de Menezes.
4393 Croatian, thanks to Denis Lackovic.
4395 ** Incorrect token definitions
4398 bison used to output
4401 ** Token definitions as enums
4402 Tokens are output both as the traditional #define's, and, provided
4403 the compiler supports ANSI C or is a C++ compiler, as enums.
4404 This lets debuggers display names instead of integers.
4407 In addition to --verbose, bison supports --report=THINGS, which
4408 produces additional information:
4410 complete the core item sets with their closure
4411 - lookahead [changed to "look-ahead" in 1.875e through 2.3, but changed back]
4412 explicitly associate lookahead tokens to items
4414 describe shift/reduce conflicts solving.
4415 Bison used to systematically output this information on top of
4416 the report. Solved conflicts are now attached to their states.
4419 Previous versions don't complain when there is a type clash on
4420 the default action if the rule has a midrule action, such as in:
4428 ** GNU M4 is now required when using Bison.
4431 * Noteworthy changes in release 1.35 (2002-03-25)
4434 Some projects use Bison's C parser with C++ compilers, and define
4435 YYSTYPE as a class. The recent adjustment of C parsers for data
4436 alignment and 64 bit architectures made this impossible.
4438 Because for the time being no real solution for C++ parser
4439 generation exists, kludges were implemented in the parser to
4440 maintain this use. In the future, when Bison has C++ parsers, this
4441 kludge will be disabled.
4443 This kludge also addresses some C++ problems when the stack was
4447 * Noteworthy changes in release 1.34 (2002-03-12)
4449 ** File name clashes are detected
4450 $ bison foo.y -d -o foo.x
4451 fatal error: header and parser would both be named "foo.x"
4453 ** A missing ";" at the end of a rule triggers a warning
4454 In accordance with POSIX, and in agreement with other
4455 Yacc implementations, Bison will mandate this semicolon in the near
4456 future. This eases the implementation of a Bison parser of Bison
4457 grammars by making this grammar LALR(1) instead of LR(2). To
4458 facilitate the transition, this release introduces a warning.
4460 ** Revert the C++ namespace changes introduced in 1.31, as they caused too
4461 many portability hassles.
4463 ** DJGPP support added.
4465 ** Fix test suite portability problems.
4468 * Noteworthy changes in release 1.33 (2002-02-07)
4471 Groff could not be compiled for the definition of size_t was lacking
4472 under some conditions.
4478 * Noteworthy changes in release 1.32 (2002-01-23)
4480 ** Fix Yacc output file names
4482 ** Portability fixes
4484 ** Italian, Dutch translations
4487 * Noteworthy changes in release 1.31 (2002-01-14)
4491 ** GNU Gettext and %expect
4492 GNU Gettext asserts 10 s/r conflicts, but there are 7. Now that
4493 Bison dies on incorrect %expectations, we fear there will be
4494 too many bug reports for Gettext, so _for the time being_, %expect
4495 does not trigger an error when the input file is named "plural.y".
4497 ** Use of alloca in parsers
4498 If YYSTACK_USE_ALLOCA is defined to 0, then the parsers will use
4499 malloc exclusively. Since 1.29, but was not NEWS'ed.
4501 alloca is used only when compiled with GCC, to avoid portability
4504 ** yyparse now returns 2 if memory is exhausted; formerly it dumped core.
4506 ** When the generated parser lacks debugging code, YYDEBUG is now 0
4507 (as POSIX requires) instead of being undefined.
4510 Bison has always permitted actions such as { $$ = $1 }: it adds the
4511 ending semicolon. Now if in Yacc compatibility mode, the semicolon
4512 is no longer output: one has to write { $$ = $1; }.
4514 ** Better C++ compliance
4515 The output parsers try to respect C++ namespaces.
4516 [This turned out to be a failed experiment, and it was reverted later.]
4519 Fixed bugs when reporting useless nonterminals.
4522 The parsers work properly on 64 bit hosts.
4525 Some calls to strerror resulted in scrambled or missing error messages.
4528 When the number of shift/reduce conflicts is correct, don't issue
4531 ** The verbose report includes the rule line numbers.
4533 ** Rule line numbers are fixed in traces.
4535 ** Swedish translation
4538 Verbose parse error messages from the parsers are better looking.
4539 Before: parse error: unexpected `'/'', expecting `"number"' or `'-'' or `'(''
4540 Now: parse error: unexpected '/', expecting "number" or '-' or '('
4542 ** Fixed parser memory leaks.
4543 When the generated parser was using malloc to extend its stacks, the
4544 previous allocations were not freed.
4546 ** Fixed verbose output file.
4547 Some newlines were missing.
4548 Some conflicts in state descriptions were missing.
4550 ** Fixed conflict report.
4551 Option -v was needed to get the result.
4555 Mismatches are errors, not warnings.
4557 ** Fixed incorrect processing of some invalid input.
4559 ** Fixed CPP guards: 9foo.h uses BISON_9FOO_H instead of 9FOO_H.
4561 ** Fixed some typos in the documentation.
4563 ** %token MY_EOF 0 is supported.
4564 Before, MY_EOF was silently renumbered as 257.
4566 ** doc/refcard.tex is updated.
4568 ** %output, %file-prefix, %name-prefix.
4572 New, aliasing "--output-file".
4575 * Noteworthy changes in release 1.30 (2001-10-26)
4577 ** "--defines" and "--graph" have now an optional argument which is the
4578 output file name. "-d" and "-g" do not change; they do not take any
4581 ** "%source_extension" and "%header_extension" are removed, failed
4584 ** Portability fixes.
4587 * Noteworthy changes in release 1.29 (2001-09-07)
4589 ** The output file does not define const, as this caused problems when used
4590 with common autoconfiguration schemes. If you still use ancient compilers
4591 that lack const, compile with the equivalent of the C compiler option
4592 "-Dconst=". Autoconf's AC_C_CONST macro provides one way to do this.
4594 ** Added "-g" and "--graph".
4596 ** The Bison manual is now distributed under the terms of the GNU FDL.
4598 ** The input and the output files has automatically a similar extension.
4600 ** Russian translation added.
4602 ** NLS support updated; should hopefully be less troublesome.
4604 ** Added the old Bison reference card.
4606 ** Added "--locations" and "%locations".
4608 ** Added "-S" and "--skeleton".
4610 ** "%raw", "-r", "--raw" is disabled.
4612 ** Special characters are escaped when output. This solves the problems
4613 of the #line lines with path names including backslashes.
4616 "%yacc", "%fixed_output_files", "%defines", "%no_parser", "%verbose",
4617 "%debug", "%source_extension" and "%header_extension".
4620 Automatic location tracking.
4623 * Noteworthy changes in release 1.28 (1999-07-06)
4625 ** Should compile better now with K&R compilers.
4629 ** Fixed a problem with escaping the double quote character.
4631 ** There is now a FAQ.
4634 * Noteworthy changes in release 1.27
4636 ** The make rule which prevented bison.simple from being created on
4637 some systems has been fixed.
4640 * Noteworthy changes in release 1.26
4642 ** Bison now uses Automake.
4644 ** New mailing lists: <bug-bison@gnu.org> and <help-bison@gnu.org>.
4646 ** Token numbers now start at 257 as previously documented, not 258.
4648 ** Bison honors the TMPDIR environment variable.
4650 ** A couple of buffer overruns have been fixed.
4652 ** Problems when closing files should now be reported.
4654 ** Generated parsers should now work even on operating systems which do
4655 not provide alloca().
4658 * Noteworthy changes in release 1.25 (1995-10-16)
4660 ** Errors in the input grammar are not fatal; Bison keeps reading
4661 the grammar file, and reports all the errors found in it.
4663 ** Tokens can now be specified as multiple-character strings: for
4664 example, you could use "<=" for a token which looks like <=, instead
4665 of choosing a name like LESSEQ.
4667 ** The %token_table declaration says to write a table of tokens (names
4668 and numbers) into the parser file. The yylex function can use this
4669 table to recognize multiple-character string tokens, or for other
4672 ** The %no_lines declaration says not to generate any #line preprocessor
4673 directives in the parser file.
4675 ** The %raw declaration says to use internal Bison token numbers, not
4676 Yacc-compatible token numbers, when token names are defined as macros.
4678 ** The --no-parser option produces the parser tables without including
4679 the parser engine; a project can now use its own parser engine.
4680 The actions go into a separate file called NAME.act, in the form of
4681 a switch statement body.
4684 * Noteworthy changes in release 1.23
4686 The user can define YYPARSE_PARAM as the name of an argument to be
4687 passed into yyparse. The argument should have type void *. It should
4688 actually point to an object. Grammar actions can access the variable
4689 by casting it to the proper pointer type.
4691 Line numbers in output file corrected.
4694 * Noteworthy changes in release 1.22
4696 --help option added.
4699 * Noteworthy changes in release 1.20
4701 Output file does not redefine const for C++.
4705 LocalWords: yacc YYBACKUP glr GCC lalr ArrayIndexOutOfBoundsException nullptr
4706 LocalWords: cplusplus liby rpl fprintf mfcalc Wyacc stmt cond expr mk sym lr
4707 LocalWords: IELR ielr Lookahead YYERROR nonassoc LALR's api lookaheads yychar
4708 LocalWords: destructor lookahead YYRHSLOC YYLLOC Rhs ifndef YYFAIL cpp sr rr
4709 LocalWords: preprocessor initializer Wno Wnone Werror FreeBSD prec livelocks
4710 LocalWords: Solaris AIX UX RHEL Tru LHS gcc's Wundef YYENABLE NLS YYLTYPE VCG
4711 LocalWords: yyerror cpp's Wunused yylval yylloc prepend yyparse yylex yypush
4712 LocalWords: Graphviz xml nonterminals midrule destructor's YYSTYPE typedef ly
4713 LocalWords: CHR chr printf stdout namespace preprocessing enum pre include's
4714 LocalWords: YYRECOVERING nonfree destructors YYABORT YYACCEPT params enums de
4715 LocalWords: struct yystype DJGPP lex param Haible NUM alloca YYSTACK NUL goto
4716 LocalWords: YYMAXDEPTH Unescaped UCNs YYLTYPE's yyltype typedefs inline Yaccs
4717 LocalWords: Heriyanto Reenable dprec Hilfinger Eggert MYEOF Folle Menezes EOF
4718 LocalWords: Lackovic define's itemset Groff Gettext malloc NEWS'ed YYDEBUG YY
4719 LocalWords: namespaces strerror const autoconfiguration Dconst Autoconf's FDL
4720 LocalWords: Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
4721 LocalWords: extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
4722 LocalWords: lang yyoutput dvi html ps POSIX lvalp llocp Wother nterm arg init
4723 LocalWords: TOK calc yyo fval Wconflicts parsers yystackp yyval yynerrs
4724 LocalWords: Théophile Ranquet Santet fno fnone stype associativity Tolmer
4725 LocalWords: Wprecedence Rassoul Wempty Paolo Bonzini parser's Michiel loc
4726 LocalWords: redeclaration sval fcaret reentrant XSLT xsl Wmaybe yyvsp Tedi
4727 LocalWords: pragmas noreturn untyped Rozenman unexpanded Wojciech Polak
4728 LocalWords: Alexandre MERCHANTABILITY yytype emplace ptr automove lvalues
4729 LocalWords: nonterminal yy args Pragma dereference yyformat rhs docdir bw
4730 LocalWords: Redeclarations rpcalc Autoconf YFLAGS Makefiles PROG DECL num
4731 LocalWords: Heimbigner AST src ast Makefile srcdir MinGW xxlex XXSTYPE CVE
4732 LocalWords: XXLTYPE strictfp IDEs ffixit fdiagnostics parseable fixits
4733 LocalWords: Wdeprecated yytext Variadic variadic yyrhs yyphrs RCS README
4734 LocalWords: noexcept constexpr ispell american deprecations backend Teoh
4735 LocalWords: YYPRINT Mangold Bonzini's Wdangling exVal baz checkable gcc
4736 LocalWords: fsanitize Vogelsgesang lis redeclared stdint automata yytname
4737 LocalWords: yysymbol yytnamerr yyreport ctx ARGMAX yysyntax stderr LPAREN
4738 LocalWords: symrec yypcontext TOKENMAX yyexpected YYEMPTY yypstate YYEOF
4739 LocalWords: autocompletion bistromathic submessages Cayuela lexcalc hoc
4740 LocalWords: yytoken YYUNDEF YYerror basename Automake's UTF ifdef ffile
4741 LocalWords: gotos readline Imbimbo Wcounterexamples Wcex Nonunifying rcex
4742 LocalWords: Vais xsltproc YYNOMEM YYLOCATION signedness YYBISON MITRE's
4743 LocalWords: libreadline YYMALLOC YYFREE MSVC redefinitions POSIXLY
4746 ispell-dictionary: "american"
4751 Copyright (C) 1995-2015, 2018-2022 Free Software Foundation, Inc.
4753 This file is part of Bison, the GNU Parser Generator.
4755 Permission is granted to copy, distribute and/or modify this document
4756 under the terms of the GNU Free Documentation License, Version 1.3 or
4757 any later version published by the Free Software Foundation; with no
4758 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
4759 Texts. A copy of the license is included in the "GNU Free
4760 Documentation License" file as part of this distribution.