Related articles |
---|
How to parse and call c++ constructors? groleo@gmail.com (Groleo) (2005-09-17) |
Re: How to parse and call c++ constructors? Meyer-Eltz@t-online.de (Detlef Meyer-Eltz) (2005-09-18) |
Re: How to parse and call c++ constructors? Juergen.Kahrs@vr-web.de (=?ISO-8859-1?Q?J=FCrgen_Kahrs?=) (2005-09-22) |
Re: How to parse and call c++ constructors? pohjalai@cc.helsinki.fi (A Pietu Pohjalainen) (2005-09-22) |
Re: How to parse and call c++ constructors? DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2005-09-22) |
Re: How to parse and call c++ constructors? groleo@gmail.com (Groleo) (2005-09-22) |
Re: How to parse and call c++ constructors? cfc@shell01.TheWorld.com (Chris F Clark) (2005-09-23) |
From: | "Groleo" <groleo@gmail.com> |
Newsgroups: | comp.compilers |
Date: | 17 Sep 2005 13:54:50 -0400 |
Organization: | http://groups.google.com |
Keywords: | C++, parse, question |
Posted-Date: | 17 Sep 2005 13:54:50 EDT |
Hi.
I have the following problem:
Given a file,:
A {
B {
text="cucu"
}
}
it;s parsed like:
text=cucu
B
A.
But to make this usefull, I wanted to fill up a datastructure:
struct B {
char* text;
};
struct A {
struct B _b;
};
So, to show the actions too:
A { <-- a =new A();
B { <-- a->_b =new B();
text="cucu" <-- a->_b->text = $2;
}
}
So again this is translated into:
a->_b->text = $2; //error: a was not allocated, b was not allocated
a->_b =new B(); //error: a was not allocated.
a =new A();// too late :)
How can this be done without errors?
Return to the
comp.compilers page.
Search the
comp.compilers archives again.