Hi Rici! > Le 15 oct. 2018 à 18:02, Rici Lake <[email protected]> a écrit : > > I only just noticed that %nterm is a bison directive, although I still > don't fully understand the motivation. I can't find any reference in the > manual, except for its unexplained use in one example. But Akim assures me > that it has been accepted for quite some time, at least since 1993. > […]
Thanks for the full analysis! My personal opinion is that, yes, it seems nice, but it was not exposed. Well, this is not entirely true: I recently had it leak in the documentation. I did not do it intentionally, it just escaped. It turns out that I do like its symmetry with %token (you didn’t report that they have the same length, which I concede is really a minor point, but I liked that things stay aligned :). The first thing is to stop promoting it. This patch does it: commit c69944ff8b31c61dd4cfced84ebc95670cc4f31c Author: Akim Demaille <[email protected]> Date: Mon Oct 15 19:22:40 2018 +0200 doc: do not advertise %nterm Reported by Rici Lake. http://lists.gnu.org/archive/html/bug-bison/2018-10/msg00000.html * NEWS, doc/bison.texi: here. diff --git a/NEWS b/NEWS index 7a039021..d8a21e53 100644 --- a/NEWS +++ b/NEWS @@ -26,8 +26,8 @@ GNU Bison NEWS %% %token <int> INT "int"; - %nterm <std::unique_ptr<int>> int; - %nterm <std::vector<std::unique_ptr<int>>> list; + %type <std::unique_ptr<int>> int; + %type <std::vector<std::unique_ptr<int>>> list; list: %empty {} diff --git a/doc/bison.texi b/doc/bison.texi index f633f1c9..3fddfe50 100644 --- a/doc/bison.texi +++ b/doc/bison.texi @@ -9198,11 +9198,11 @@ The following grammar file, @file{calc.y}, will be used in the sequel: @end group @group %token <ival> NUM -%nterm <ival> exp +%type <ival> exp @end group @group %token <sval> STR -%nterm <sval> useless +%type <sval> useless @end group @group %left '+' '-' Then we should think what we want to do. I like the way you change the grammar to make it more consistent. FWIW, I want to get 3.2 published asap, so I don’t plan to start the changes in master right now. That will be fine in 3.3. AFAICT, 3.2 will be finished when I’m done with deprecated files (https://lists.gnu.org/archive/html/bison-patches/2018-10/msg00065.html) and with the default action made explicit (https://lists.gnu.org/archive/html/bison-patches/2018-10/msg00061.html).
