Hi all! Please, give a try to the following release candidate. You may also extract it directly from the master branch of the git repository.
https://www.lrde.epita.fr/~akim/private/bison/bison-3.0.5.100-de641.tar.gz https://www.lrde.epita.fr/~akim/private/bison/bison-3.0.5.100-de641.tar.xz It would be extremely helpful if you could run the test suite and report problems that you might encounter. I am especially interested in compilers others than GCC and Clang. _Please_, also use this release candidate on your pet project, and, possibly, check the diffs on the generated parsers. Thanks in advance! * Noteworthy changes in release 3.1 ** Backward incompatible changes Compiling Bison now requires a C99 compiler---as announced during the release of Bison 3.0, five years ago. Generated parsers do not require a C99 compiler. Support for DJGPP, which have been unmaintained and untested for years, is obsolete. Unless there is activity to revive it, the next release of Bison will have it removed. ** New features *** Typed midrule actions Because their type is unknown to Bison, the values of midrule actions are not treated like the others: they don't have %printer and %destructor support. It also prevents C++ (Bison) variants to handle them properly. Typed midrule actions address these issues. Instead of: exp: { $<ival>$ = 1; } { $<ival>$ = 2; } { $$ = $<ival>1 + $<ival>2; } write: exp: <ival>{ $$ = 1; } <ival>{ $$ = 2; } { $$ = $1 + $2; } *** Reports include the type of the symbols The sections about terminal and nonterminal symbols of the '*.output' file now specify their declared type. For instance, for: %token <ival> NUM the report now shows '<ival>': Terminals, with rules where they appear NUM <ival> (258) 5 *** Diagnostics about useless rules In the following grammar, the 'exp' nonterminal is trivially useless. So, of course, its rules are useless too. %% input: '0' | exp exp: exp '+' exp | exp '-' exp | '(' exp ')' Previously all the useless rules were reported, including those whose left-hand side is the 'exp' nonterminal: warning: 1 nonterminal useless in grammar [-Wother] warning: 4 rules useless in grammar [-Wother] 2.14-16: warning: nonterminal useless in grammar: exp [-Wother] input: '0' | exp ^^^ 2.14-16: warning: rule useless in grammar [-Wother] input: '0' | exp ^^^ 3.6-16: warning: rule useless in grammar [-Wother] exp: exp '+' exp | exp '-' exp | '(' exp ')' ^^^^^^^^^^^ 3.20-30: warning: rule useless in grammar [-Wother] exp: exp '+' exp | exp '-' exp | '(' exp ')' ^^^^^^^^^^^ 3.34-44: warning: rule useless in grammar [-Wother] exp: exp '+' exp | exp '-' exp | '(' exp ')' ^^^^^^^^^^^ Now, rules whose left-hand side symbol is useless are no longer reported as useless. The locations of the errors have also been adjusted to point to the first use of the nonterminal as a left-hand side of a rule: warning: 1 nonterminal useless in grammar [-Wother] warning: 4 rules useless in grammar [-Wother] 3.1-3: warning: nonterminal useless in grammar: exp [-Wother] exp: exp '+' exp | exp '-' exp | '(' exp ')' ^^^ 2.14-16: warning: rule useless in grammar [-Wother] input: '0' | exp ^^^ *** C++: Generated parsers can be compiled with -fno-exceptions (lalr1.cc) When compiled with exceptions disabled, the generated parsers no longer uses try/catch clauses. Currently only GCC and Clang are supported. ** Documentation *** A demonstration of variants A new example was added (installed in .../share/doc/bison/examples), 'variant.yy', which shows how to use (Bison) variants in C++. The other examples were made nicer to read. *** Some features are no longer 'experimental' The following features, mature enough, are no longer flagged as experimental in the documentation: push parsers, default %printer and %destructor (typed: <*> and untyped: <>), %define api.value.type union and variant, Java parsers, XML output, LR family (lr, ielr, lalr), and semantic predicates (%?). ** Bug fixes *** GLR: Predicates support broken by #line directives Predicates (%?) in GLR such as widget: %? {new_syntax} 'w' id new_args | %?{!new_syntax} 'w' id old_args were issued with #lines in the middle of C code. *** Printer and destructor with broken #line directives The #line directives were not properly escaped when emitting the code for %printer/%destructor, which resulted in compiler errors if there are backslashes or double-quotes in the grammar file name. *** Portability on ICC The Intel compiler claims compatibility with GCC, yet rejects its _Pragma. Generated parsers now work around this. *** Various There were several small fixes in the test suite and in the build system, many warnings in bison and in the generated parsers were eliminated. The documentation also received its share of minor improvements. Useless code was removed from C++ parsers, and some of the generated constructors are more 'natural'.