Language translation

Anthony Williams <awgold70@gmail.com>
Wed, 5 Mar 2014 06:27:56 -0800 (PST)

          From comp.compilers

Related articles
Language translation awgold70@gmail.com (Anthony Williams) (2014-03-05)
Re: Language translation DrDiettrich1@aol.com (Hans-Peter Diettrich) (2014-03-05)
Re: Language translation kaz@kylheku.com (Kaz Kylheku) (2014-03-05)
Re: Language translation jkallup@web.de (Jens Kallup) (2014-03-06)
Re: Language translation norjaidi.tuah@ubd.edu.bn (Nor Jaidi Tuah) (2014-03-10)
Re: Language translation awgold70@gmail.com (Anthony Williams) (2014-03-10)
| List of all articles for this month |
From: Anthony Williams <awgold70@gmail.com>
Newsgroups: comp.compilers
Date: Wed, 5 Mar 2014 06:27:56 -0800 (PST)
Organization: Compilers Central
Keywords: OOP, translator, comment
Posted-Date: 05 Mar 2014 09:44:31 EST

Dear Group,


I'm facing the problem to translate language A into language B. The
problem is, that A is an object oriented language (it supports
classes, attributes of classes ...). But B is much simpler. It hasn't
support for classes. There is only variables, functions. And my
Question: How Could I Implement Classes in B. (At first it would be
sufficient, if i could "emulate" simple classes, that don't support
inheritance, function hiding, polymorphy ...)


Thank you for your answer,
A.W.
[This is basicallly what compilers for OOP languages do -- they
translate the OOP stuff into equivalent code for a much lower level
language, typically assembler or machine language. There are fairly
standard ways to do low level implemenations of OOP, with a tree of
structures for each class with pointers to all of the class
structures, and each class instance having a structure with a field
for each data member and a pointer back to its class structure, with
more or less extra stuff depending on how complex the inheritance
system is. So you have to do that in language B. If this sounds
really tedious, yes, it is. -John]


Post a followup to this message

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