[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
d:
From: |
Akim Demaille |
Subject: |
d: |
Date: |
Sun, 25 Jul 2021 18:05:26 +0200 |
Hi Adela,
I apologize for not being very responsive currently :(
Let's prepare 3.8 with the D skeleton as foremost feature.
I'm not too fond of using %union, so I suggest to not use it in the "advanced"
D example. Would you agree with that?
Cheers!
commit d19cde6f1828afed55a3add126e4eed41bfebc04
Author: Akim Demaille <akim.demaille@gmail.com>
Date: Wed Jun 23 07:19:20 2021 +0200
d: minor clean up
* doc/bison.texi: Use @samp, not "...", around pieces of code.
* examples/d/calc/calc.y: Don't promote %union.
diff --git a/doc/bison.texi b/doc/bison.texi
index bfa8687bf..0b585739b 100644
--- a/doc/bison.texi
+++ b/doc/bison.texi
@@ -6485,7 +6485,7 @@ with other members of the @code{SymbolKind} class.
@item Default Value:
@code{YYSYMBOL_} in C. @code{S_} in C++ and Java. The default prefix is
-removed from D.
+empty from D.
@item History:
introduced in Bison 3.6.
@end itemize
@@ -6503,9 +6503,9 @@ C++, D
@item Purpose:
Request that symbols be handled as a whole (type, value, and possibly
location) in the scanner. In the case of C++, it works only when
-variant-based semantic values are enabled
-(@pxref{C++ Variants}), @xref{Complete Symbols}, for details. In D,
-token constructor works with both "%union" and "%define api.value.type union".
+variant-based semantic values are enabled (@pxref{C++ Variants}), see
+@ref{Complete Symbols}, for details. In D, token constructors work with both
+@samp{%union} and @samp{%define api.value.type union}.
@item Accepted Values:
Boolean.
diff --git a/examples/d/calc/calc.y b/examples/d/calc/calc.y
index 7273d16c6..f2b0e8b2d 100644
--- a/examples/d/calc/calc.y
+++ b/examples/d/calc/calc.y
@@ -20,17 +20,14 @@
%language "D"
%define api.parser.class {Calc}
-%define parse.error detailed
-%define parse.trace
%define api.push-pull push
%define api.token.constructor
+%define api.value.type union
+%define parse.error detailed
+%define parse.trace
%locations
-%union {
- int ival;
-}
-
/* Bison Declarations */
%token PLUS "+"
MINUS "-"
@@ -39,9 +36,9 @@
LPAR "("
RPAR ")"
EOL "end of line"
-%token <ival> NUM "number"
-%type <ival> exp
-%printer { yyo.write($$); } <ival>
+%token <int> NUM "number"
+%type <int> exp
+%printer { yyo.write($$); } <int>
%left "-" "+"
%left "*" "/"
- d:,
Akim Demaille <=
- Re: d:, Adela Vais, 2021/07/26