Date: Tue, 15 Apr 1997 10:28:25 +0000 ( ) From: "Gurunandan R. Bhat" To: djgpp AT delorie DOT com Subject: advice on bison required Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk greetings, i need some help with bison. as in any lexer-parser combination, my lexer (lexyy.c generated by flex) returns to the parser yyparse(), a token and sets the semantic value in the variable yylval, which is customarily of type YYSTYPE. in a particular grammar, if yylval is of type double, one usually sets: #define YYSTYPE double at the beginning of the bison source. on doing this and compiling with -d, bison generates a header file which is expected to contain all type information required by the lexer to successfully pass tokens and values to the parser. the header file so generated is then #include'd in the lexer source. in my case, YYSTYPE = double. yet the header file generated by bison -d reads: --------------------------------- #ifndef YYSTYPE #define YYSTYPE int #endif #define NUM 258 extern YYSTYPE yylval; --------------------------------- rather than what i would (naively?) expect: --------------------------------- #define YYSTYPE double #define NUM 258 extern YYSTYPE yylval; --------------------------------- is there a command line switch that will automagically generate the second header file rather than the first? while the first is correct in the event that i combine the bison output and the flex output into a single source module (YYSTYPE is correctly #define'd as double at the beginning of bison output xxxx_t.c), it seems incorrect when the grammar is compiled from separate flex and bison outputs (xxxx_t.c and lexyy.c) in separate source modules. i have so far been manually making the change in the header file generated by bison before #include'ing it in the lex source, but i am sure it can be done automagically. the question is: how? many thanks in advance gurunandan