I'm trying to make a " simple " compiler using Flex & Bison, and now, I'm building the AST.
I've programmed all my classes in a header and a source file (pretty ugly but I had inclusion errors when I didn't do that) , and therefore I'm including it in my .y bison file.
The problem comes when I specify the type of the %union fields with class type from my file.
When I'm writing MyClassType field;
, the compiler gives me error since I'm trying to give to the field an abstract class type (that's normal, that's what I expect the compiler to do), and when I'm writing MyClassType* field;
(what I really want to do) , the compiler says he doesn't know a type called MyClassType.
What I find very odd is that he acknoledge the existance of a type, but not the existance of a pointer to this type. Furthermore, I create instances of my classes in the grammar rules, and I don't have any errors (tried without fields of my classes in the %union, so that one error doesn't hide another one). So it's only in the %union that I can't use my classes.
In my .y file, the header for my classes is included between the first %{%}, and the %union is declared just after the preceeding block. I compiled the source file for my classes separately of the flex/bison project and I don't have any errors.
So, what I'm trying to understand is why can't I use my classes inside of bison's %union ?
Thanks in advance for your answers,
Cordially, Jaxon