Bison 3.3 released
The new option --update replaces deprecated features with their modern spelling, but also applies fixes such as eliminating duplicate directives, etc. It is now possible to annotate rules with their number of expected conflicts. Bison can be made relocatable. The symbol declaration syntax was overhauled, and in particular, %nterm, that exists since the origins of Bison, is now an officially supported (and documented!) feature. C++ parsers now feature genuine symbol constructors, and use noexcept/constexpr. The GLR parsers in C++ now support the syntax_error exceptions. There are also many smaller improvements, including a fix for a bug which is at least 31 years old."
From: | Akim Demaille <akim.demaille-AT-gmail.com> | |
To: | GNU Announcements List <info-gnu-AT-gnu.org> | |
Subject: | Bison 3.3 released [stable] | |
Date: | Sat, 26 Jan 2019 15:47:02 +0100 | |
Message-ID: | <F7384713-7195-4BDD-A99E-ED9226F79AB5@gmail.com> | |
Cc: | Bison Patches <bison-patches-AT-gnu.org>, Bison Help <help-bison-AT-gnu.org>, Benno Schulenberg <coordinator-AT-translationproject.org>, bison-announce-AT-gnu.org, Bison Bugs <bug-bison-AT-gnu.org> | |
Archive-link: | Article |
We are very happy to announce the release of Bison 3.3! The new option --update replaces deprecated features with their modern spelling, but also applies fixes such as eliminating duplicate directives, etc. It is now possible to annotate rules with their number of expected conflicts. Bison can be made relocatable. The symbol declaration syntax was overhauled, and in particular, %nterm, that exists since the origins of Bison, is now an officially supported (and documented!) feature. C++ parsers now feature genuine symbol constructors, and use noexcept/constexpr. The GLR parsers in C++ now support the syntax_error exceptions. There are also many smaller improvements, including a fix for a bug which is at least 31 years old. Please see the NEWS below for more details. Many thanks to Askar Safin, Derek Clegg, Γtienne Renault, Frank Heckenbach, Rici Lake, Wolfgang Thaller and the members of the Bison mailing lists for their feedback during the development of this version. Here are the compressed sources: https://ftp.gnu.org/gnu/bison/bison-3.3.tar.gz (4.1MB) https://ftp.gnu.org/gnu/bison/bison-3.3.tar.xz (2.1MB) Here are the GPG detached signatures[*]: https://ftp.gnu.org/gnu/bison/bison-3.3.tar.gz.sig https://ftp.gnu.org/gnu/bison/bison-3.3.tar.xz.sig Use a mirror for higher download bandwidth: https://www.gnu.org/order/ftp.html [*] Use a .sig file to verify that the corresponding file (without the .sig suffix) is intact. First, be sure to download both the .sig file and the corresponding tarball. Then, run a command like this: gpg --verify bison-3.3.tar.gz.sig If that command fails because you don't have the required public key, then run this command to import it: gpg --keyserver keys.gnupg.net --recv-keys 0DDCAA3278D5264E and rerun the 'gpg --verify' command. This release was bootstrapped with the following tools: Autoconf 2.69 Automake 1.16.1 Flex 2.6.4 Gettext 0.19.8.1 Gnulib v0.1-2382-g34881aff4 NEWS * π Noteworthy changes in release 3.3 (2019-01-26) [stable] A new mailing list was created, Bison Announce. It is low traffic, and is only about announcing new releases and important messages (e.g., polls about major decisions to make). https://lists.gnu.org/mailman/listinfo/bison-announce ** β οΈ Backward incompatible changes Support for DJGPP, which has been unmaintained and untested for years, is removed. ** β°οΈοΈ Deprecated features A new feature, --update (see below) helps adjusting existing grammars to deprecations. *** Deprecated directives The %error-verbose directive is deprecated in favor of '%define parse.error verbose' since Bison 3.0, but no warning was issued. The '%name-prefix "xx"' directive is deprecated in favor of '%define api.prefix {xx}' since Bison 3.0, but no warning was issued. These directives are slightly different, you might need to adjust your code. %name-prefix renames only symbols with external linkage, while api.prefix also renames types and macros, including YYDEBUG, YYTOKENTYPE, yytokentype, YYSTYPE, YYLTYPE, etc. Users of Flex that move from '%name-prefix "xx"' to '%define api.prefix {xx}' will typically have to update YY_DECL from #define YY_DECL int xxlex (YYSTYPE *yylval, YYLTYPE *yylloc) to #define YY_DECL int xxlex (XXSTYPE *yylval, XXLTYPE *yylloc) *** Deprecated %define variable names The following variables, mostly related to parsers in Java, have been renamed for consistency. Backward compatibility is ensured, but upgrading is recommended. abstract -> api.parser.abstract annotations -> api.parser.annotations extends -> api.parser.extends final -> api.parser.final implements -> api.parser.implements parser_class_name -> api.parser.class public -> api.parser.public strictfp -> api.parser.strictfp ** β¨ New features *** π Generation of fix-its for IDEs/Editors When given the new option -ffixit (aka -fdiagnostics-parseable-fixits), bison now generates machine readable editing instructions to fix some issues. Currently, this is mostly limited to updating deprecated directives and removing duplicates. For instance: $ cat foo.y %error-verbose %define parser_class_name "Parser" %define api.parser.class "Parser" %% exp:; See the "fix-it:" lines below: $ bison -ffixit foo.y foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated] %error-verbose ^~~~~~~~~~~~~~ fix-it:"foo.y":{1:1-1:15}:"%define parse.error verbose" foo.y:2.1-34: warning: deprecated directive, use '%define api.parser.class {Parser}' [-Wdeprecated] %define parser_class_name "Parser" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fix-it:"foo.y":{2:1-2:35}:"%define api.parser.class {Parser}" foo.y:3.1-33: error: %define variable 'api.parser.class' redefined %define api.parser.class "Parser" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foo.y:2.1-34: previous definition %define parser_class_name "Parser" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fix-it:"foo.y":{3:1-3:34}:"" foo.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother] This uses the same output format as GCC and Clang. *** βοΈ Updating grammar files Fixes can be applied on the fly. The previous example ends with the suggestion to re-run bison with the option -u/--update, which results in a cleaner grammar file. $ bison --update foo.y [...] bison: file 'foo.y' was updated (backup: 'foo.y~') $ cat foo.y %define parse.error verbose %define api.parser.class {Parser} %% exp:; *** β¨ Bison is now relocatable If you pass '--enable-relocatable' to 'configure', Bison is relocatable. A relocatable program can be moved or copied to a different location on the file system. It can also be used through mount points for network sharing. It is possible to make symbolic links to the installed and moved programs, and invoke them through the symbolic link. *** β¨ %expect and %expect-rr modifiers on individual rules One can now document (and check) which rules participate in shift/reduce and reduce/reduce conflicts. This is particularly important GLR parsers, where conflicts are a normal occurrence. For example, %glr-parser %expect 1 %% ... argument_list: arguments %expect 1 | arguments ',' | %empty ; arguments: expression | argument_list ',' expression ; ... Looking at the output from -v, one can see that the shift-reduce conflict here is due to the fact that the parser does not know whether to reduce arguments to argument_list until it sees the token _after_ the following ','. By marking the rule with %expect 1 (because there is a conflict in one state), we document the source of the 1 overall shift-reduce conflict. In GLR parsers, we can use %expect-rr in a rule for reduce/reduce conflicts. In this case, we mark each of the conflicting rules. For example, %glr-parser %expect-rr 1 %% stmt: target_list '=' expr ';' | expr_list ';' ; target_list: target | target ',' target_list ; target: ID %expect-rr 1 ; expr_list: expr | expr ',' expr_list ; expr: ID %expect-rr 1 | ... ; In a statement such as x, y = 3, 4; the parser must reduce x to a target or an expr, but does not know which until it sees the '='. So we notate the two possible reductions to indicate that each conflicts in one rule. This feature needs user feedback, and might evolve in the future. *** β¨ C++: Actual token constructors When variants and token constructors are enabled, in addition to the type-safe named token constructors (make_ID, make_INT, etc.), we now generate genuine constructors for symbol_type. For instance with these declarations %token ':' <std::string> ID <int> INT; you may use these constructors: symbol_type (int token, const std::string&); symbol_type (int token, const int&); symbol_type (int token); which should be used in a Flex-scanner as follows. %% [a-z]+ return yy::parser::symbol_type (ID, yytext); [0-9]+ return yy::parser::symbol_type (INT, text_to_int (yytext); ":" return yy::parser::symbol_type (β:β); <<EOF>> return yy::parser::symbol_type (0); Correct matching between token types and value types is checked via 'assert'. For instance, 'symbol_type (ID, 42)' would abort (while 'make_ID (42)' would not even compile). *** β¨ C++: Variadic emplace If your application requires C++11 and you don't use symbol constructors, you may now use a variadic emplace for semantic values: %define api.value.type variant %token <std::pair<int, int>> PAIR in your scanner: int yylex (parser::semantic_type *lvalp) { lvalp->emplace <std::pair<int, int>> (1, 2); return parser::token::PAIR; } *** β¨ C++: Syntax error exceptions in GLR The glr.cc skeleton now supports syntax_error exceptions thrown from user actions, or from the scanner. *** π¨ More POSIX Yacc compatibility warnings More Bison specific directives are now reported with -y or -Wyacc. This change was ready since the release of Bison 3.0 in September 2015. It was delayed because Autoconf used to define YACC as `bison -y`, which resulted in numerous warnings for Bison users that use the GNU Build System. If you still experience that problem, either redefine YACC as `bison -o y.tab.c`, or pass -Wno-yacc to Bison. *** π§ββοΈ The tables yyrhs and yyphrs are back Because no Bison skeleton uses them, these tables were removed (no longer passed to the skeletons, not even computed) in 2008. However, some users have expressed interest in being able to use them in their own skeletons. ** π Bug fixes *** Incorrect number of reduce-reduce conflicts On a grammar such as exp: "num" | "num" | "num" bison used to report a single RR conflict, instead of two. This is now fixed. This was the oldest (known) bug in Bison: it was there when Bison was entered in the RCS version control system, in December 1987. Some grammar files might have to adjust their %expect-rr. *** Parser directives that were not careful enough Passing invalid arguments to %nterm, for instance character literals, used to result in unclear error messages. ** π Documentation The examples/ directory (installed in .../share/doc/bison/examples) has been restructured per language for clarity. The examples come with a README and a Makefile. Not only can they be used to toy with Bison, they can also be starting points for your own grammars. There is now a Java example, and a simple example in C based on Flex and Bison (examples/c/lexcalc/). ** π° Changes *** Parsers in C++ They now use noexcept and constexpr. Please, report missing annotations. *** Symbol Declarations The syntax of the variation directives to declare symbols was overhauled for more consistency, and also better POSIX Yacc compliance (which, for instance, allows "%type" without actually providing a type). The %nterm directive, supported by Bison since its inception, is now documented and officially supported. The syntax is now as follows: %token TAG? ( ID NUMBER? STRING? )+ ( TAG ( ID NUMBER? STRING? )+ )* %left TAG? ( ID NUMBER? )+ ( TAG ( ID NUMBER? )+ )* %type TAG? ( ID | CHAR | STRING )+ ( TAG ( ID | CHAR | STRING )+ )* %nterm TAG? ID+ ( TAG ID+ )* where TAG denotes a type tag such as β<ival>β, ID denotes an identifier such as βNUMβ, NUMBER a decimal or hexadecimal integer such as β300β or β0x12dβ, CHAR a character literal such as β'+'β, and STRING a string literal such as β"number"β. The post-fix quantifiers are β?β (zero or one), β*β (zero or more) and β+β (one or more). -- If you have a working or partly working program that you'd like to offer to the GNU project as a GNU package, see https://www.gnu.org/help/evaluation.html.
Posted Jan 27, 2019 19:27 UTC (Sun)
by ballombe (subscriber, #9523)
[Link] (11 responses)
People needing to do bisections on old trees need the ability to rebuild older codebase without installing old bison releases too.
I am a bit concerned that it will be difficult to support both %name-prefix and api.prefix in the same code base, which means that bison --update will not work for this case.
MacOs still shipping bison 2.3 does not help either, though this is not bison dev fault.
Posted Jan 28, 2019 0:40 UTC (Mon)
by tshow (subscriber, #6411)
[Link] (9 responses)
Actually, if you need FSF tools I'd advise avoiding macos entirely, but you may be (as I am) stuck using it because it is the only point of access to a platform that pays the bills.
Although if anyone knows how to do iOS dev on a Linux box, I'm all ears...
Posted Jan 28, 2019 8:38 UTC (Mon)
by josh (subscriber, #17465)
[Link] (4 responses)
Posted Jan 28, 2019 8:55 UTC (Mon)
by oldtomas (guest, #72579)
[Link] (1 responses)
I always told people that this must be Steve Jobs's ghost haunting Apple. It still can't get over that GCC/Objective-C thing back then in NeXT times (I worked in a strange shop, where the desktop folks were Apple acolytes and the backend folks Windows worshippers).
Of course this was in jest, but sometimes I think companies do develop traits which are somehow similar to those people develop -- pathologies and all.
I'd say GPL phobia. GPLV2 they've to put up with (but they shell out quite a bit of money to get rid of that too), but GPLV3... nono. That's too much ;-)
Posted Jan 28, 2019 17:58 UTC (Mon)
by Cyberax (✭ supporter ✭, #52523)
[Link]
Posted Jan 28, 2019 13:44 UTC (Mon)
by ballombe (subscriber, #9523)
[Link]
Posted Jan 28, 2019 16:05 UTC (Mon)
by zwol (guest, #126152)
[Link]
Exactly. As of the original release of GPLv3, Apple's legal department believed that if they shipped any code under that license, they would have to make it possible for end users to install third-party patches to the core of iOS, because of the "anti-tivoization" language. So they didn't, and they still don't. Source: I used to work for a company that had a contract from Apple to do maintenance on their fork of GCC. Right around the time the FSF started to circulate GPLv3 drafts for comment, Apple canceled our contract and plowed all the money into LLVM instead. This was the unofficial explanation they gave our sales lead.
Posted Jan 28, 2019 15:29 UTC (Mon)
by mathstuf (subscriber, #69389)
[Link] (2 responses)
> Although if anyone knows how to do iOS dev on a Linux box, I'm all ears...
I almost had a cross-compilation setup done in 2008 or so by extracting an SDK and a using a cross compiling GCC. Ended up abandoning since I ended up just not caring about macOS at some point. Swift works on Linux now (and I suspect you could get a cross-compile capable setup pretty easily since it is LLVM-based), so that may be one way to do at least compile testing. Making the final package is probably always going to be on a macOS instance though since, AFAIK, the signing tools are macOS-specific. I assume Clang compiles Obj-C, so that may work as well.
Posted Jan 29, 2019 10:34 UTC (Tue)
by ledow (guest, #11753)
[Link] (1 responses)
It just wasn't worth the effort trying to maintain a completely separate path that, without running the entire compilation on an up-to-date MacOS itself, wouldn't do even the simplest of things.
And I'm not prepared to pay Apple hardware prices just to run my own code.
I would have to say that, even if I made a living developing software, I would not even try to support Apple devices purely because of the developer interfaces. I am actually surprised that any developer does bother, to be honest. They can't be doing so willingly, surely (I get the "But we MUST have an iPad app" kind of forced development).
Pretty much the only way I could ever get anything to work reliably was to push XCode tools into Eclipse (which "just works" on Windows and Linux of several flavours) and run it natively on MacOS. Then, literally every time MacOS updated, compilation on un-updated machines would fail or apps couldn't be signed because things weren't up to date, which involved an OS update, which - after a while - required a hardware update.
And XCode doesn't work on any other platform, so you couldn't even go that way and just teach yourself that and move it to Windows/Linux.
Apple went out of their way to tell me that they don't want me using their platform. I took the hint, before I'd ever parted with a penny on anything they offered.
Posted Jan 29, 2019 21:57 UTC (Tue)
by mathstuf (subscriber, #69389)
[Link]
There's apparently lots of money to be had. People do lots of crazy things to get more of it.
But, I understand the sentiment.
Posted Jan 28, 2019 19:08 UTC (Mon)
by atai (subscriber, #10977)
[Link]
Posted Mar 3, 2019 14:25 UTC (Sun)
by ballombe (subscriber, #9523)
[Link]
I hoped bison --update was something you could put in your Makefile to future-proof against the next bison change, but this is not the case.
Posted Jan 28, 2019 22:15 UTC (Mon)
by quotemstr (subscriber, #45331)
[Link] (3 responses)
Posted Jan 29, 2019 16:59 UTC (Tue)
by Wol (subscriber, #4433)
[Link] (2 responses)
I always like to give as my example of trying to parse valid syntax
REM: REM = REM(6,2) ;* This calculates a remainder and puts it in the variable called REM
That is, if you haven't noticed, the token REM used in four different ways in the same statement - as a label, a variable, a function, and a statement. And all those uses are valid in differing dialects of the same computer language.
The option of designing the language/grammar is not always there for the poor sods trying to write the lexer/parser.
Cheers,
Posted Jan 29, 2019 17:10 UTC (Tue)
by quotemstr (subscriber, #45331)
[Link] (1 responses)
Posted Feb 6, 2019 13:46 UTC (Wed)
by branden (guest, #7029)
[Link]
"So you're the reason (Plan 9) awk has 83 reduce-reduce conflicts (and
"As I remember, the original EQN grammar had >300 S/R conflicts and 50 or so RR conflicts. But it mostly did what you wanted. I think Al Aho got faint when he looked it it, though... (It got better when precedence was added...)" -- Steve Johnson
Bison 3.3 released
Bison 3.3 released
Bison 3.3 released
As far as I can tell, most FSF command line tools in macos are whatever was more or less stable in 2006
$ curl -s https://ftp.gnu.org/gnu/bison/bison-2.3.tar.bz2 | tar xjOf - bison-2.3/COPYING | head -n 2
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
$ curl -s https://ftp.gnu.org/gnu/bison/bison-2.4.tar.bz2 | tar xjOf - bison-2.4/COPYING | head -n 2
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Apple ships the last version released under GPLv2. Apple seems allergic to GPLv3 for some reason.
Bison 3.3 released
Bison 3.3 released
Bison 3.3 released
Bison 3.3 released
Bison 3.3 released
Bison 3.3 released
Bison 3.3 released
Bison 3.3 released
Bison 3.3 released
This makes this option fairly useless.
Bison 3.3 released
Bison 3.3 released
Wol
Bison 3.3 released
Bison 3.3 released
42 shift-reduce)." -- Rob Pike