Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #1131
| From | Anthony Williams <awgold70@gmail.com> |
|---|---|
| Newsgroups | comp.compilers |
| Subject | Language translation |
| Date | 2014-03-05 06:27 -0800 |
| Organization | Compilers Central |
| Message-ID | <14-03-009@comp.compilers> (permalink) |
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]
Back to comp.compilers | Previous | Next — Next in thread | Find similar | Unroll thread
Language translation Anthony Williams <awgold70@gmail.com> - 2014-03-05 06:27 -0800
Re: Language translation Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2014-03-05 16:42 +0100
Re: Language translation Kaz Kylheku <kaz@kylheku.com> - 2014-03-05 16:08 +0000
Re: Language translation Jens Kallup <jkallup@web.de> - 2014-03-06 20:31 +0100
Re: Language translation Nor Jaidi Tuah <norjaidi.tuah@ubd.edu.bn> - 2014-03-10 08:37 +0800
Re: Language translation Anthony Williams <awgold70@gmail.com> - 2014-03-10 10:23 -0700
csiph-web