[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RFC: news: prepare for 3.5
From: |
Akim Demaille |
Subject: |
RFC: news: prepare for 3.5 |
Date: |
Tue, 10 Dec 2019 07:11:01 +0100 |
If someone could have a look at my prose... TIA!
First the resulting section for 3.5, then the patch I pushed.
---------------------------------------------------------------
GNU Bison NEWS
* Noteworthy changes in release ?.? (????-??-??) [?]
** 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++
Contributed by Adrian Vogelsgesang.
The C++ deterministic skeleton (lalr1.cc) 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 lalr1.java, and was cleaned and improved thanks to
H. 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. For
instance
%type <exVal> cond "condition"
does not define "condition" as a string alias to 'cond' (nonterminal
symbols do not have string aliases). It is rather equivalent to
%nterm <exVal> cond
%token <exVal> "condition"
i.e., it gives the type 'exVal' to the "condition" token, which was
clearly not the intention.
Also, because string aliases need not be defined, typos such as "baz"
instead of "bar" will be not reported.
The option -Wdangling-alias catches these situations. On
%token BAR "bar"
%type <ival> foo "foo"
%%
foo: "baz" {}
bison -Wdangling-alias reports
warning: string literal not attached to a symbol
| %type <ival> foo "foo"
| ^~~~~
warning: string literal not attached to a symbol
| foo: "baz" {}
| ^~~~~
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.
%token TOKEN1
%type <ival> TOKEN1 TOKEN2 't'
%token TOKEN2
%%
expr:
gives with -Wyacc
input.y:2.15-20: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
2 | %type <ival> TOKEN1 TOKEN2 't'
| ^~~~~~
input.y:2.29-31: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
2 | %type <ival> TOKEN1 TOKEN2 't'
| ^~~
input.y:2.22-27: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
2 | %type <ival> TOKEN1 TOKEN2 't'
| ^~~~~~
*** Diagnostics with insertion
The diagnostics now display the suggestion below the underlined source.
Replacement for undeclared symbols are now also suggested.
$ cat /tmp/foo.y
%%
list: lis '.' |
$ bison -Wall foo.y
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'?
2 | list: lis '.' |
| ^~~
| list
foo.y:2.16: warning: empty rule without %empty [-Wempty-rule]
2 | list: lis '.' |
| ^
| %empty
foo.y: warning: fix-its can be applied. Rerun with option '--update'.
[-Wother]
*** Diagnostics about long lines
Quoted sources may now be truncated to fit the screen. For instance, on a
30-column wide terminal:
$ cat foo.y
%token FOO FOO FOO
%%
exp: FOO
$ bison foo.y
foo.y:1.34-36: warning: symbol FOO redeclared [-Wother]
1 | … FOO …
| ^~~
foo.y:1.8-10: previous declaration
1 | %token FOO …
| ^~~
foo.y:1.62-64: warning: symbol FOO redeclared [-Wother]
1 | … FOO
| ^~~
foo.y:1.8-10: previous declaration
1 | %token FOO …
| ^~~
** Changes
*** Debugging glr.c and glr.cc
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.
---------------------------------------------------------------
commit 57503e2165e5fd4fa3e3ccf70c986d2cc72068b3
Author: Akim Demaille <address@hidden>
Date: Tue Dec 10 07:06:04 2019 +0100
news: prepare for 3.5
diff --git a/NEWS b/NEWS
index fccb4b92..b2649999 100644
--- a/NEWS
+++ b/NEWS
@@ -2,8 +2,17 @@ GNU Bison NEWS
* Noteworthy changes in release ?.? (????-??-??) [?]
+** 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.
-* Noteworthy changes in release 3.4.92 (2019-12-08) [beta]
+ 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
@@ -11,7 +20,44 @@ GNU Bison NEWS
obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
It is deprecated and its support will be removed eventually.
-** New Features
+** New features
+
+*** Lookahead correction in C++
+
+ Contributed by Adrian Vogelsgesang.
+
+ The C++ deterministic skeleton (lalr1.cc) 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
@@ -27,30 +73,12 @@ GNU Bison NEWS
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.
-** Changes
-
-*** Debugging glr.c and glr.cc
-
- 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
-
-*** Crashes when reporting verbose error messages
-
- In theory, parsers using %nonassoc could crash. This unlikely bug has been
- fixed.
+*** Debug traces in Java
-* Noteworthy changes in release 3.4.91 (2019-11-20) [beta]
+ The Java backend no longer emits code and data for parser tracing if the
+ %define variable parse.trace is not defined.
-** New Features
+** Diagnostics
*** New diagnostic: -Wdangling-alias
@@ -101,7 +129,7 @@ GNU Bison NEWS
%%
expr:
- gives, with -Wyacc
+ gives with -Wyacc
input.y:2.15-20: warning: POSIX yacc reserves %type to nonterminals
[-Wyacc]
2 | %type <ival> TOKEN1 TOKEN2 't'
@@ -113,50 +141,9 @@ GNU Bison NEWS
2 | %type <ival> TOKEN1 TOKEN2 't'
| ^~~~~~
-* Noteworthy changes in release 3.4.90 (2019-10-29) [beta]
-
-** 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.
-
-** Bug fixes
-
- In Java, %define api.prefix was ignored. It now behaves as expected.
-
-** New features
-
-*** Lookahead correction in C++
-
- Contributed by Adrian Vogelsgesang.
-
- The C++ deterministic skeleton (lalr1.cc) 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.
-
*** Diagnostics with insertion
- The diagnostics now display suggestion below the underlined source.
+ The diagnostics now display the suggestion below the underlined source.
Replacement for undeclared symbols are now also suggested.
$ cat /tmp/foo.y
@@ -197,26 +184,28 @@ GNU Bison NEWS
1 | %token FOO …
| ^~~
-*** Debug traces in Java
+** Changes
- The Java backend no longer emits code and data for parser tracing if the
- %define variable parse.trace is not defined.
+*** Debugging glr.c and glr.cc
-*** Generated parsers prefer signed integer types
+ 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).
- 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.
+*** Clean up
-*** Generated parsers use better types for states
+ Several new compiler warnings in the generated output have been avoided.
+ Some unused features are no longer emitted. Cleaner generated code in
+ general.
- 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).
+** 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.
* Noteworthy changes in release 3.4.2 (2019-09-12) [stable]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- RFC: news: prepare for 3.5,
Akim Demaille <=