448,691 Members | 1,123 Online
Need help? Post your question and get tips & solutions from a community of 448,691 IT Pros & Developers. It's quick & easy.

# Bison: Problem with %union

 P: 1 Hi! I've included some of my classes in the union in my grammar file: Expand|Select|Wrap|Line Numbers %union {     int int_type;     char* string_type;     PNode* pNode; }   %type      programs  %type            program   Using 'Bison -d program.ypp', what happens is Bison places this in both .hpp and .cpp generated files as Expand|Select|Wrap|Line Numbers typedef union YYSTYPE {     int int_type;     char* string_type;     PNode* pNode; } YYSTYPE;   The problem is the .hpp file doesn't have the #include "PNode.h" that it needs to make sense of PNode* so it produces errors. When I try to put #include "PNode.h" in the .hpp file I get a hundred errors like this: c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstdio(17) : error C2143: syntax error : missing '{' before ':' c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstdio(17) : error C2059: syntax error : ':' Removing this part from the the .hpp file will also produce errors. I'm using VS2003, Bison 2.1 and Flex 2.5.4a. I hope someone can help me with this. Thanks. Sep 7 '07 #1