[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bugs in Bison 2.0: YYSTYPE and yylval

From: Paul Eggert
Subject: Re: Bugs in Bison 2.0: YYSTYPE and yylval
Date: Fri, 22 Jul 2005 13:59:25 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

In <http://lists.gnu.org/archive/html/bug-bison/2005-06/msg00036.html>
evilfred <address@hidden> writes:

> I'm using Bison 2.0 with Flex 2.5.27 in MinGW in Windows....
> - in the generated c file, just after the part where it says
> "initialize stack pointers", there is a line that says "yyvsp[0] =
> yylval;". this kills my program as yylval is not initialized yet.

Thanks for reporting that.  This has been fixed in Bison CVS here
and the fix should appear in the next Bison release.

> - I have stuff at the top of my grammar like so:
>      %{
>       #define YYSTYPE double
>       ...
>      %}
>      %defines
>   yet this is never copied into the generated header file.

That's the intended behavior.  Here's a quote from the documentation
that may explain things.

Unless @code{YYSTYPE} is already defined as a macro, the output header
declares @code{YYSTYPE}.  Therefore, if you are using a @code{%union}
(@pxref{Multiple Types, ,More Than One Value Type}) with components
that require other definitions, or if you have defined a
@code{YYSTYPE} macro (@pxref{Value Type, ,Data Types of Semantic
Values}), you need to arrange for these definitions to be propagated to
all modules, e.g., by putting them in a
prerequisite header that is included both by your parser and by any
other module that needs @code{YYSTYPE}.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]