GNU Bison 3.3 released with major bug fixes, yyrhs and yyphrs tables, token constructors and more

4 min read

On Saturday, the team at Bison announced the stable release of Bison 3.3, a general-purpose parser generator. Bison 3.3 comes with yyrhs and yyphrs tables, major bug fixes, parsers and much more.

What’s new in Bison 3.3

DJGPP support

This release comes with support for DJGPP (DJ’s GNU Programming Platform) in Bison, which was unmaintained and untested since a few years.

Generation of fix-its for IDEs/Editors

Bison 3.3 features a new option called ‘ffixit’ which helps Bison in generating machine-readable editing instructions to fix issues. It helps in updating deprecated directives and removing duplicates.

Symbol declaration

The symbol declaration syntax was overhauled in previous releases. In Bison 3.3, the symbol ‘%nterm’, is now an officially supported feature.

Bison is now relocatable

Users can now make Bison relocatable by passing ‘–enable-relocatable’ to ‘configure’. Users can move or copy the relocatable program to a different location on the file system which can also be used through mount points for network sharing. With this release, it is now possible to make symbolic links to the installed and moved programs and invoke them through the symbolic link.

Renaming variable names

In Bison 3.3, few variables, mostly related to parsers in Java, have been renamed for consistency. Following is a list of such variables:  

  • Abstract -> api.parser.abstract
  • Annotations -> api.parser.annotations
  • Extends -> api.parser.extends
  • Final ->
  • Implements -> api.parser.implements
  • Parser_class_name -> api.parser.class
  • Public -> api.parser.public
  • Strictfp -> api.parser.strictfp

%expect and %expect-rr modifiers on individual rules

Users can now document and check which rules participate in shift/reduce and reduce/reduce conflicts. Users can use %expect-rr in a rule for reduce/reduce conflicts in GLR parsers.

C++ Parsers

This release comes with C++ parsers that feature symbol constructors and use noexcept/constexpr. This release also features GLR parsers in C++ that support the syntax_error exceptions.

C++ token constructors

Variants and token constructors are enabled in this release. In addition to the type-safe named token constructors (make_ID, make_INT, etc.), this release features constructors for symbol_type.

C++: Syntax error exceptions in GLR

In this version of Bison, the skeleton now supports syntax_error exceptions thrown from user actions or from the scanner.

More POSIX Yacc compatibility warnings

With this release, directives are now reported with -y or -Wyacc.  

yyrhs and yyphrs tables

Since none of the Bison skeletons used the ‘yyrhs’ and ‘yyphrs’ tables, they were removed in 2008.  But these tables are back again as some users expressed interest in being able to use them in their own skeletons.

Deprecated directives

The %error-verbose directive is deprecated in favor of ‘%define parse.error verbose’ with warnings issued.The ‘%name-prefix “xx”‘ directive is deprecated in favor of ‘%define api.prefix {xx}’ with warnings issued.

Deprecated features

The new release replaces deprecated features with their modern spelling. The grammar files have been updated. Option -u/–updates results in a cleaner grammar file.

Major bug fixes

  • The previous versions of Bison used to report a single RR conflict instead of two. This bug was the oldest one in Bison, it is at least 31 years old, but it has been fixed now.
  • Earlier, passing invalid arguments to %nterm, for instance, character literals, used to result in unclear error messages. This release highlights clear error messages.

Users are skeptical about the fact that a bug can live on for so long and gets addressed after years. One of the users commented on HackerNews, “In a thousand years time will archeologists study us through the bugs left behind in Linux 1300.05 and windows (30)95?”

Some of the users don’t seem to be happy with the UX of Bison. A comment on HackerNews reads, “A big part of why tools move away from Bison and ANTLR isn’t performance, but UX (especially error reporting).” Others are happy with this news and think that Bison makes parsing easy. One of the comments read, “Congrats though! I love it when these tried-and-true tools continue to perform and improve!”

To know more about this Bison 3.3, check out the release notes.

Read Next

GNU Bison 3.2 got rolled out

GNU ed 1.15 released!

Bash 5.0 is here with new features and improvements