Opened 4 years ago

Closed 4 years ago

#4561 closed task (fixed)


Reported by: Bruce Dubbs Owned by: lfs-book
Priority: normal Milestone: 9.1
Component: Book Version: SVN
Severity: normal Keywords:


New minor version.

Change History (2)

comment:1 by Bruce Dubbs, 4 years ago


Noteworthy changes in release 3.5 (2019-12-11) [stable]

  • Backward incompatible changes

Lone carriage-return characters (aka \r or M) in the grammar files are no longer treated as end-of-lines. This changes the diagnostics, and in particular their locations.

In C++, line numbers and columns are now represented as 'int' not 'unsigned', so that integer overflow on positions is easily checkable via 'gcc -fsanitize=undefined' and the like. This affects the API for positions. The default position and location classes now expose 'counter_type' (int), used to define line and column numbers.

  • Deprecated features

The YYPRINT macro, which works only with yacc.c and only for tokens, was obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002). It is deprecated and its support will be removed eventually.

  • New features
  • Lookahead correction in C++

The C++ deterministic skeleton ( now supports LAC, via the %define variable parse.lac.

  • Variable api.token.raw: Optimized token numbers (all skeletons)

In the generated parsers, tokens have two numbers: the "external" token number as returned by yylex (which starts at 257), and the "internal" symbol number (which starts at 3). Each time yylex is called, a table lookup maps the external token number to the internal symbol number.

When the %define variable api.token.raw is set, tokens are assigned their internal number, which saves one table lookup per token, and also saves the generation of the mapping table.

The gain is typically moderate, but in extreme cases (very simple user actions), a 10% improvement can be observed.

  • Generated parsers use better types for states

Stacks now use the best integral type for state numbers, instead of always using 15 bits. As a result "small" parsers now have a smaller memory footprint (they use 8 bits), and there is support for large automata (16 bits), and extra large (using int, i.e., typically 31 bits).

  • Generated parsers prefer signed integer types

Bison skeletons now prefer signed to unsigned integer types when either will do, as the signed types are less error-prone and allow for better checking with 'gcc -fsanitize=undefined'. Also, the types chosen are now portable to unusual machines where char, short and int are all the same width. On non-GNU platforms this may entail including <limits.h> and (if available) <stdint.h> to define integer types and constants.

  • A skeleton for the D programming language

For the last few releases, Bison has shipped a stealth experimental skeleton: lalr1.d. It was first contributed by Oliver Mangold, based on Paolo Bonzini's, and was cleaned and improved thanks to

  1. S. Teoh.

However, because nobody has committed to improving, testing, and documenting this skeleton, it is not clear that it will be supported in the future.

The lalr1.d skeleton *is functional*, and works well, as demonstrated in examples/d/calc.d. Please try it, enjoy it, and... commit to support it.

  • Debug traces in Java

The Java backend no longer emits code and data for parser tracing if the %define variable parse.trace is not defined.

  • Diagnostics
  • New diagnostic: -Wdangling-alias

String literals, which allow for better error messages, are (too) liberally accepted by Bison, which might result in silent errors.

The -Wall option does not (yet?) include -Wdangling-alias.

  • Better POSIX Yacc compatibility diagnostics

POSIX Yacc restricts %type to nonterminals. This is now diagnosed by -Wyacc.

  • Diagnostics with insertion

The diagnostics now display the suggestion below the underlined source. Replacement for undeclared symbols are now also suggested.

  • Diagnostics about long lines

Quoted sources may now be truncated to fit the screen.

  • Changes
  • Debugging glr.c and

The glr.c skeleton always had asserts to check its own behavior (not the user's). These assertions are now under the control of the parse.assert %define variable (disabled by default).

  • Clean up

Several new compiler warnings in the generated output have been avoided. Some unused features are no longer emitted. Cleaner generated code in general.

  • Bug Fixes

Portability issues in the test suite.

In theory, parsers using %nonassoc could crash when reporting verbose error messages. This unlikely bug has been fixed.

In Java, %define api.prefix was ignored. It now behaves as expected.

comment:2 by Bruce Dubbs, 4 years ago

Resolution: fixed
Status: newclosed

Fixed at revision 11710.

Note: See TracTickets for help on using tickets.