Re: How to parse and call c++ constructors?

Hans-Peter Diettrich <DrDiettrich@compuserve.de>
22 Sep 2005 23:42:14 -0400

          From comp.compilers

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)
| List of all articles for this month |
From: Hans-Peter Diettrich <DrDiettrich@compuserve.de>
Newsgroups: comp.compilers
Date: 22 Sep 2005 23:42:14 -0400
Organization: Compilers Central
References: 05-09-072
Keywords: parse
Posted-Date: 22 Sep 2005 23:42:14 EDT

Groleo wrote:


> 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?


Use an LL parser instead of an LR parser?


In general you'll have to delay the *use* of the constructed items,
until the outer semantic code becomes active (return them as function
results...).


DoDi


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.