[comp.compilers] reverse compilation

FELDBUSCH%iravcl.ira.uka.de@RELAY.CS.NET (07/19/89)

Does anyone have references to literature about, or better have experience in
"reverse compilation" or "decompilation" ? I've heard that there were attempts
to construct programs in high-level languages from assembler programs, but 
I can't find any books or articles about it.

Please send your mail to FELDBUSCH@IRA.UKA.DE. I'll sumarize your mails and 
put it into the news.
                                      Thanks a lot, Fridtjof Feldbusch
[I've seen Autocoder (an assembler for a 1960 vintage IBM mini) to Cobol
translators, but nothing recently.  -John]
[From FELDBUSCH%iravcl.ira.uka.de@RELAY.CS.NET]
--
Send compilers articles to compilers@ima.isc.com or, perhaps, Levine@YALE.EDU
Plausible paths are { decvax | harvard | yale | bbn}!ima
Please send responses to the originator of the message -- I cannot forward
mail accidentally sent back to compilers.  Meta-mail to ima!compilers-request

FELDBUSCH@iravcl.ira.uka.de (07/29/89)

I recently posted a news message because I was looking for information about 
decompilation. Many thanks to all the people sending me email, they helped me
a lot. I promised to summarize the answers in comp.compilers. I found some 
additional sources of information about structuring of programs that I want to
include as well.

Robert S. Arnold
Software Restructuring
Proc. of the IEEE, Vol. 77, No. 4, April 1989, pp. 607 - 617

Edward Ashcroft, Zohar Manna
The Translation of `GOTO` Programs to `WHILE` Programs
Information Processing 71, North Holland Publishing Company, 1972, pp. 250 - 255

R. C. Linger, H. D. Mills, B. I. Witt
Structured Programming: Theory and Practice
Addison Wesley, 1979, pp 118 - 126

Fridtjof Feldbusch, FELDBUSCH@IRA.UKA.DE
==============================================================================
Reply-to:	IN%"pardo@june.cs.washington.EDU" "David Keppel" 20-JUL-1989 07:37:34.77

There is a very VAX and PCC C-specific decompiler.  You can get a copy by
anonymous ftp from june.cs.washington.edu (128.95.1.4).  Login `anonymous'
password == your user name, get the file pub/decomp.ar.Z.  Be sure to use
`binary' mode.  If you are lacking anonymous ftp, `ar' or `compress', I can
send you a copy in your favorite format.

To give credit where due, the program was written by Jim Reuter for porting
`Empire' from Un*x to VMS (!).

The output is not a syntactically correct C program, but gets pretty close.

Hope this helps!

	;-D on  ( Don't just *talk* about reverse engineering! )  Pardo -- 
		    pardo@cs.washington.edu
    {rutgers,cornell,ucsd,ubc-cs,tektronix}!uw-beaver!june!pardo
==============================================================================
Reply-to:	IN%"visix!cobra!andyt@uunet.uu.NET"  "Andy Turk" 20-JUL-1989 17:03:46.39

A guy I used to work with came up with a very clever method for decompiling
Prolog.  The technique is based on the WAM (Warren Abstract Machine)
architecture, but could probably be extended to other Prolog implementations
as well.  However, I doubt that his idea would scale up to non-logic based
languages.  Here's the reference:

	Fast Decompilation of Compiled Prolog Clauses
	Kevin A. Buettner
	Proceedings of the 3rd Int'l Conference on Logic Programming
	Springer Verlag (225), 1986

Andy Turk
==============================================================================
Reply-to:	IN%"eggert@twinsun.COM"  "Paul Eggert" 20-JUL-1989 17:03:50.67

Your might try John Banning and Hans Pufal's NLZ program, which is part of
Hunter Systems's XDOS suite.  You can use it to decompile PC applications and
port them to Unix workstations.  Contact

	Hunter Systems
	444 Castro St
	Mountain View, CA 94041, USA
	telephone 415-965-2400

-- Paul Eggert, Twin Sun, Inc. <eggert@twinsun.com>
==============================================================================
Reply-to:	IN%"peterd@june.cs.washington.EDU" "Peter C. Damron" 20-JUL-1989 
18:34:27.14

Here are the few references from my bibliography.

Hope this helps,
Peter.

---------------
Peter C. Damron
Dept. of Computer Science, FR-35
University of Washington
Seattle, WA  98195

peterd@cs.washington.edu
{ucbvax,decvax,etc.}!uw-beaver!uw-june!peterd
(how to get here from Europe I have no idea!)
---------------

%A U. Lichtblau
%T Decompilation of Control Structures by Means of Graph Transformations
%J LNCS; V 185; D 1985; P 284-297
%X lecture notes in computer science, springer-verlag

%A G. L. Hopwood
%T Decompilation
%R Ph.D. Dissertation
%I University of California, Irvine
%D FEB 1978

%T A Study of Decompiling Machine Languages into High-Level Machine Independent 
Languages
%A Barron Cornelius Housel, III
%R Ph.D. Dissertation
%I Purdue University
%D AUG 1973

%T A Definition Optimization Technique Used in a Code Translation Algorithm
%A David M. DeJean; A George W. Zobrist
%J CACM; V 32; N 1; D JAN 1989; P 94-105
==============================================================================
Reply-to:	IN%"cwf@research.att.COM" 21-JUL-1989 00:33:26.60

Your recent submission to the comp.compilers newsgroup
asked for references regarding decompilation.
Here's one:

Frank L. Friedman.
Decompilation and the Transfer of Mini-Computer Operating Systems.
PhD dissertation, Dept of Computer Science, Purdue, 8/74.
==============================================================================
Reply-to:	IN%"worley@compass.COM"  "Dale Worley" 21-JUL-1989 01:03:22.72

There at least used to be (>10 years ago) a product that would take
object programs (for IBM 360s?) and turn them into Cobol.  (Probably
really stupid Cobol.)  Apparently it was for the large number of
operations that had programmed in assembler, but had lost the
source...

Dale
--
Dale Worley, Compass, Inc.                      worley@compass.com
Civilization ends at the water's edge.  On the ocean, you enter the food chain,
and not necessarily at the top.
================================================================================
Reply-to:	IN%"rayt@cognos.cognos" 22-JUL-1989 06:41:04.73

Title: An Algorithm for Structuring Flowgraphs
Author: Brenda S. Baker
Source: JACM 24:1; 98,120 (Jan 1977)

"This paper describes an algorithm which transforms a flowgraph into a
 program containing control constructs such as IF THEN ELSE statements,
 REPEAT (DO FOREVER) statements, multilevel BREAK statements (causing
 jumps out of enclosing REPEATS)."

Regards,

						R.
-- 
Ray Tigg                          |  Cognos Incorporated
                                  |  P.O. Box 9707
(613) 738-1338 x5013              |  3755 Riverside Dr.
UUCP: rayt@cognos.uucp            |  Ottawa, Ontario CANADA K1G 3Z4
================================================================================
Reply-to:	IN%"ndmh!rahe@uni-dortmund.DE" 27-JUL-1989 02:31:29.39

Yes, I have some articles about decompilation. 
At the University of Dortmund, there was a student project
about decompilation from Assembler to Pascal in 1979-1980.
After this project I myself worked on a compiler from Basic to Pascal with
another student as master thesis and
there was at least another project on decompilation (I think it was Cobol
to Pascal).

Here are the articles, we mentioned in our master thesis:
   Friedmann, F.L.
   Decompilation and the Transfer of Mini-Computer Operation Systems
   Diss., Purdue University, Lafayette, 1974

   Hollander, C.R.
   Decompilation of Object Programs
   Diss., Stanford University, 1973

   Housel, B.C.
   A Study of Decompiling Machine Languages into High-Level Machine
   Independent Languages
   Diss., Purdue University, Lafayette, 1973

   Housel, B.C., Halsted, M.H.
   A Methodology for Machine Language Decompilation
   Proceedings of the ACM Annual Conference, 1974
   pp. 254-260

   Sassaman, W.A.
   A Computer Program to Translate Machine Language into FORTRAN
   AFIPS Conference Proceedings, Vol. 28, S.J.C.C., 1966
   pp. 235-239

and two articles in German:

   Endbericht der Projektgruppe Umkehrcompilierung I
   University of Dortmund, W-Germany, Abteilung Informatik, Lehrstuhl II, 1980
   D-4600 Dortmund

   Moellers, P. , Heinemann,R.
   Entwurf und Implementierung eines Compilers von BASIC nach PASCAL
   Diplomarbeit, University of Dortmund, W-Germany, 1980
   D-4600 Dortmund


Best Regards

Ralf Heinemann
Norsk Data GmbH
Solinger Str. 9
D-4330 Muelheim
Tel: ++49 208 4844 253
uunet!mcvax!unido!ndmh!rahe
--
Send compilers articles to compilers@ima.isc.com or, perhaps, Levine@YALE.EDU
{ decvax | harvard | yale | bbn }!ima.  Meta-mail to ima!compilers-request.
Please send responses to the author of the message, not the poster.