Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED!nerds-end From: Anthony Williams Newsgroups: comp.compilers Subject: Language translation Date: Wed, 5 Mar 2014 06:27:56 -0800 (PST) Organization: Compilers Central Lines: 22 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <14-03-009@comp.compilers> NNTP-Posting-Host: news.iecc.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: miucha.iecc.com 1394030671 66899 64.57.183.58 (5 Mar 2014 14:44:31 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Wed, 5 Mar 2014 14:44:31 +0000 (UTC) Keywords: OOP, translator, comment Posted-Date: 05 Mar 2014 09:44:31 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com X-Received-Bytes: 2098 X-Received-Body-CRC: 120775445 Xref: csiph.com comp.compilers:1131 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]