Re: Translating OO program to procedural program

"Joachim Pimiskern" <JoachimPimiskern@web.de>
12 Oct 2006 15:26:11 -0400

          From comp.compilers

Related articles
[4 earlier articles]
Re: Translating OO program to procedural program mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2006-10-11)
Re: Translating OO program to procedural program torbenm@app-6.diku.dk (2006-10-11)
Re: Translating OO program to procedural program englere_geo@yahoo.com (Eric) (2006-10-11)
Re: Translating OO program to procedural program DrDiettrich1@aol.com (Hans-Peter Diettrich) (2006-10-11)
Re: Translating OO program to procedural program int2k@gmx.net (Wolfram Fenske) (2006-10-11)
Re: Translating OO program to procedural program tommy.thorn@gmail.com (Tommy Thorn) (2006-10-11)
Re: Translating OO program to procedural program JoachimPimiskern@web.de (Joachim Pimiskern) (2006-10-12)
Re: Translating OO program to procedural program gnorik@gmail.com (2006-10-24)
| List of all articles for this month |

From: "Joachim Pimiskern" <JoachimPimiskern@web.de>
Newsgroups: comp.compilers
Date: 12 Oct 2006 15:26:11 -0400
Organization: Compilers Central
References: 06-10-039
Keywords: OOP

"moop" <samhng@gmail.com> schrieb:
> I am working on a project translates OO programs to procedural
> programs, such as translating C++ to C and the like. I hope this
> effort can be spreaded out to other langs, so I am working on to
> abstract the common issues of doing so.


That's the way Perl was made object-oriented:


A function bless(<ptr>,<namespace>) was introduced to connect a
pointer to a namespace. The pointer references a data structure for
the member variables of an object instance. The namespace comprises
all functions that belong to the class (member functions).


Functions were made object-oriented by assuming the first parameter is
always <ptr>, the pointer to the member variable data structure.


Whenever a function call of an oop function is
made, e.g. $o->foo(param1,...), the runtime system searches
for the namespace associated with the reference $o
an then calls in that namespace foo($o, param1, ...).


Regards,
Joachim


Post a followup to this message

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