At 13:26 -0500 2005/03/21, Dmitry Podkuiko wrote:
Thanks for your response Hans. Indeed, it had do with #include's being in the right order. The y.tab.h file has to be the last included and I had it first in the list which caused it not to see the definitions of my classes and even the std::string even though I included using namespace std;. Thank You. Dmitry.
-----Original Message----- From: Hans Aberg [mailto:[EMAIL PROTECTED] Sent: Monday, March 21, 2005 1:17 PM To: [EMAIL PROTECTED] Cc: help-bison@gnu.org Subject: Re: %union errors that shouldn't be there
It looks as though the C++ compiler does not see the declaration of the types astNode, string (is it std::string?), nodeList, before it sees the union that the parser implements. So, you have to make sure that info is included somewhere, perhaps in the %{ ... %} segment before the %union in the .y file.
At 16:57 -0500 2005/03/20, DYP wrote:Hello,
My %union is declared in the following way and does have the proper header file included but I still get errors that should not be there.
%union{ float fconst; int type; astNode* node; string* name; nodeList* list; }
Here are the errors that I get when trying to compile the bison generated file
In file included from misery.ll:30: gram.yy:26: error: ISO C++ forbids declaration of `astNode' with no type gram.yy:26: error: expected `;' before '*' token gram.yy:27: error: ISO C++ forbids declaration of `string' with no type gram.yy:27: error: expected `;' before '*' token gram.yy:28: error: ISO C++ forbids declaration of `nodeList' with no type gram.yy:28: error: expected `;' before '*' token
I just don't see what I am doing wrong.
Your help is appreciated.
_______________________________________________ Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison
-- Hans Aberg
_______________________________________________ Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison