[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: In version 3.0.2, "malformed" YYSTYPE produced with '%defines' if '%
From: |
Gabriel Czernikier |
Subject: |
Re: In version 3.0.2, "malformed" YYSTYPE produced with '%defines' if '%define api.value.type union' in use |
Date: |
Mon, 29 May 2017 12:17:06 -0300 |
Sorry, it was fixed in a later version:
*** %define api.value.type union with %defines (yacc.c, glr.c)
The C parsers were broken when %defines was used together with "%define
api.value.type union".
https://savannah.gnu.org/forum/forum.php?forum_id=8188
On Mon, May 29, 2017 at 11:34 AM, Gabriel Czernikier <address@hidden>
wrote:
> The '%defines' declaration arranges for Bison to produce a header file
> containing among others, a definition for YYSTYPE if it wasn't defined by
> the user.
>
> YYSTYPE members are computed from the semantic type declarations, which at
> user's choice could be a '%define api.value.type union' followed type tags
> being real C types. In this latter case, the definition of YYSTYPE has
> duplicated members, with the obvious outcome that the C compiler will
> reject the "malformed" union.
>
> It suffices to reproduce this to add the '%defines' declaration to the
> mfcalc example showed in Bison's manual, chapter 2. The place where to find
> the "malformed" YYSTYPE is a Bison's output header file named XYZ.tab.h,
> with XYZ.y being the name given to the grammar file.
>