bug-bison
[Top][All Lists]
Advanced

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

Re: bison -d option generates sparse .h files


From: Hal Brodigan
Subject: Re: bison -d option generates sparse .h files
Date: Tue, 11 Oct 2005 01:02:13 -0700
User-agent: Mozilla Thunderbird 1.0.6 (X11/20050731)

Paul Eggert wrote:

Hal Brodigan <address@hidden> writes:

I've noticed that when creating bison files with C code in the
Prologue section that this code does not show up in the generated .h
files when using "bison -d". This is especially annoying when one is
trying to override the default definitions of bison, such as
YYSTYPE. If one redefines YYSTYPE, the redefinition will not be
included in the generated .h file and any other code that expects the
new definition to be there, such as a flex file, will not find
it.

This behavior seems to be the longstanding tradition, and as far as I
can tell something like it is required by POSIX.  The POSIX spec for
yacc <http://www.opengroup.org/onlinepubs/000095399/utilities/yacc.html>
says:

 Alternatively, given that at least one <tag> construct is used, the
 union can be declared in a header file (which shall be included in
 the declarations section by using a #include construct within %{ and
 %}), and a typedef used to define the symbol YYSTYPE to represent
 this union. The effect of %union is to provide the declaration of
 YYSTYPE directly from the yacc input.

This seems to indicate that in this case it's the programmer's
responsibility to put the definition of YYSTYPE into a .h file that
the .y file includes, and that all other client code includes.

Perhaps I'm not understanding your request; if so, an example might
help.


Ah thank you for clearing up the use of %union, that had slipped my mind. Use of %union tested against 1.875d, 2.0 and 2.1, everything looks good. Looks like I got PEBKACed again.

Hal Brodigan


reply via email to

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