Re: Translating OO program to procedural program

torbenm@app-6.diku.dk (=?iso-8859-1?q?Torben_=C6gidius_Mogensen?=)
11 Oct 2006 23:19:31 -0400

          From comp.compilers

Related articles
Translating OO program to procedural program samhng@gmail.com (=?iso-8859-1?B?bW9vcJk=?=) (2006-10-10)
Re: Translating OO program to procedural program pjb@informatimago.com (Pascal Bourguignon) (2006-10-11)
Re: Translating OO program to procedural program oliverhunt@gmail.com (oliverhunt@gmail.com) (2006-10-11)
Re: Translating OO program to procedural program napi@axiomsol.com (napi) (2006-10-11)
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: torbenm@app-6.diku.dk (=?iso-8859-1?q?Torben_=C6gidius_Mogensen?=)
Newsgroups: comp.compilers
Date: 11 Oct 2006 23:19:31 -0400
Organization: Department of Computer Science, University of Copenhagen
References: 06-10-039
Keywords: OOP
Posted-Date: 11 Oct 2006 23:19:31 EDT

"moop" <samhng@gmail.com> writes:


> I am working on a project translates OO programs to procedural
> programs, such as translating C++ to C and the like.
>
> My approach is just to rename the methods with the instance name so
> that they can be placed in a single source file and then be compiled
> later by the procedural lang compiler.


This will, at best, give you static method calls, but to handle
dynamic method calls, you need something more. I suggest you look in
a compiler textbook to see how OO languages are compiled and use the
methods presented there. Not all compiler textbooks describe OO, so
look before you buy. Andrew Appel's "Modern Compiler Implementation
in {C | Java | ML}" has a section on OO that should be sufficient for
your needs.


Torben


Post a followup to this message

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