Re: Decompilable interpreter/compiler hybrid

Martin Ward <Martin.Ward@durham.ac.uk>
4 Jul 2003 00:09:37 -0400

          From comp.compilers

Related articles
Decompilable interpreter/compiler hybrid samir.ribic@alemsistem.com.ba (2003-07-02)
Re: Decompilable interpreter/compiler hybrid tdk@thelbane.com (Timothy Knox) (2003-07-04)
Re: Decompilable interpreter/compiler hybrid alex_mcd@btopenworld.com (Alex McDonald) (2003-07-04)
Re: Decompilable interpreter/compiler hybrid Martin.Ward@durham.ac.uk (Martin Ward) (2003-07-04)
Re: Decompilable interpreter/compiler hybrid vbdis@aol.com (2003-07-13)
| List of all articles for this month |

From: Martin Ward <Martin.Ward@durham.ac.uk>
Newsgroups: comp.compilers
Date: 4 Jul 2003 00:09:37 -0400
Organization: Compilers Central
References: 03-07-022
Keywords: design
Posted-Date: 04 Jul 2003 00:09:37 EDT

On Wednesday 02 Jul 2003 5:44 am, Samir Ribic wrote:
> a) Source code is same as object code (interpreter's idea). In memory
> actually stands only machine object code. When displayed on screen, or
> edited in editor, it will be decompiled to ASCII. Every time when the
> line is entered, it will be compiled to machine code


One way to do this is to write your compiler as a logic
program in prolog or a similar language. Because of the declarative
nature of logic programming, you can feed the object code to
the compiler and recover the source code.
Implementing optimisations to such a compiler is a little tricky
(to say the least!). This paper by Jonathan Bowen
describes one example:


http://www.museophile.sbu.ac.uk/pub/jpb/jsm.pdf


You will need a tiny prolog implementation, go to
http://www.programmersheaven.com/ and search for
"tiny prolog" for an example (the ZIP file contains
a 27Kb .com executable and 49Kb PASCAL source)


--
Martin


Martin.Ward@durham.ac.uk http://www.cse.dmu.ac.uk/~mward/ Erdos number: 4


Post a followup to this message

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