Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

generating .h with bison

8 views
Skip to first unread message

mike burrell

unread,
Jul 10, 2000, 3:00:00 AM7/10/00
to
i'd like bison to generate a header file for me. e.g. if i have:

%token BAR

%%

/* ... */

%%

/* ... */

and then compile it with 'bison foo.y', i get the definition of BAR at
the top of foo.tab.c:

#define BAR 257

but what i would really like is for it to be defined in a header file (such
as foo.tab.h) so that i can #include it in the flex part of my parser.

sorry, i've just started learning lex and yacc and i'm not entirely sure of
the conventions for these sorts of things, but this would sure be useful :).
i've gone through the man page for bison and can't find any command-line
option that would be useful.

cheers

--
/"\ m i k e b u r r e l l
\ / ASCII RIBBON CAMPAIGN mik...@home.com
X AGAINST HTML MAIL,
/ \ AND NEWS TOO, dammit

Ken Pizzini

unread,
Jul 12, 2000, 3:00:00 AM7/12/00
to
On Mon, 10 Jul 2000 23:27:58 GMT, mike burrell <mik...@home.com> wrote:
>i'd like bison to generate a header file for me. e.g. if i have:
[snip]

>and then compile it with 'bison foo.y', i get the definition of BAR at
>the top of foo.tab.c:
>
> #define BAR 257
>
>but what i would really like is for it to be defined in a header file (such
>as foo.tab.h) so that i can #include it in the flex part of my parser.

bison -d foo.y

--Ken Pizzini

0 new messages