[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bison -d option generates sparse .h files
From: |
Paul Eggert |
Subject: |
Re: bison -d option generates sparse .h files |
Date: |
Mon, 10 Oct 2005 23:30:59 -0700 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
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.