bug-bison
[Top][All Lists]
Advanced

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

Re: Bison H file generation


From: Paul Eggert
Subject: Re: Bison H file generation
Date: Tue, 25 May 2004 00:29:33 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

"Yair Grosu" <address@hidden> writes:

> I have been using Bison with the -d option to generate a header file to be
> used by flex.
>
> I have defined the '#define YYSTYPE double' in the grammar file, but the
> output ignores this and the header file only contains the type as int as
> follows:

Bison can't parse your C program well enough to know where the YYSTYPE
macro is defined.  For example, a C program might conditionally
#define YYSTYPE depending on an #if.  So there's no straightforward
way for Bison to copy the "#define YYSTYPE double" line into your
header file.

I suggest that you put the '#define YYSTYPE double' line into a new
header YYSTYPE.h, and then include YYSTYPE.h before any use of
YYSTYPE.  That is, your grammar file's prolog should include
"YYSTYPE.h", and every source file that includes the Bison-generated
header should first include "YYSTYPE.h".




reply via email to

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