[comp.lang.c] Assembly language to C translation?

andrsonj@motcid.UUCP (John Anderson) (08/30/90)

Assembly Language to C Translation Questions
--------------------------------------------

I have a large Assembly language program that I want to convert to
C code.  Does anyone have any information about Assembly language to C
translation ?  I have heard that translators exist and that several
companies perform this service.

    1). Are there tools that do this translation automatically ?
        Or, does this translation done have to be done "by hand" ?

    2). If there are tools to perform this translation automatically, does
        anyone have information about these tools ?

    3). Does anyone have information about the companies that perform
        this translation service ?

    Thanks in advance,

        John    (..uunet!motcid!andrsonj)

-- 

------------------------------------------------------------------------------
|   John D. Anderson                    |                                    |
|   ..uunet!motcid!andrsonj             |                                    |
|   Motorola Inc.                       |                                    |
|   Cellular Infrastructure Division    |                                    |
|   Arlington Heights, Illinois, USA    |                                    |
------------------------------------------------------------------------------

mjd@central.cis.upenn.edu (Mark-Jason Dominus) (09/06/90)

In article <4535@buff7.UUCP> andrsonj@motcid.UUCP (John Anderson) writes:
   I have a large Assembly language program that I want to convert to
   C code.  Does anyone have any information about Assembly language to C
   translation ?  I have heard that translators exist and that several
   companies perform this service.

	A long time ago I worked for XYZ corporation ,which
manufactures BIGDB, a very large database-4GL-kitchensink
product.  It was originally written in Fortran and 370
Assembler to run under CMS or MVS or some other one of those
three-letter jobs.

	The UNIX port was rather difficult from what I hear,
and when I left they were considering just what you suggest.
Thy wanted to compile the Fortran on their IBM 3090, take
the resulting 370 assembly code, mail it to their Unix
machines, run it through their 370 Assembly-to-C translator,
and voila.  If they could fabricate a good enough
Assembly-to-C translator, the 370 assembly code would be
portable.  Like, gag me with a statistics package, OK?

	I asked how they planned to do the assembly-to-C
translation.  I was surprised to learn that they had a
prototype written already.  This was a company that spend no
money, and I mean none at all, on development or research or
anything except new creeping features.  They wouldn't even
buy new manuals: The entire Mainframe division, some thirty
or thirty-five programmers, had *one* copy of Principles of
Operation to share.

	``How does the translator work?'' I asked.

	``Well,'' said my friend in the Unix division, ``It
starts off by mallocing a lot of core, and by declaring
sixteen register int *'s, called R0, R1, R2...''

	I choked.  I guess my eyes probably bugged out.
They were going to simulate a 370 machine in C.  When the
`translator' saw the instruction to load register 7 with the
contents of memory location 0x3574, lo, it would generate
	*R7=memory[0x3574];

	My friend, mistaking the cause of the choke, looked
at me and shrugged.  ``I guess you think it'll be hard to
read,'' he said.  ``But really it won't be any harder to
read than the original assembly language was.''

	I wish I'd learned something from the experience,
but the best thing I can come up with is never to work for a
database company.
--

 In some sense a stochastic process can do better; at least it has a chance.
Mark-Jason Dominus 	  			    mjd@central.cis.upenn.edu 

jfriedl@frf.omron.co.jp (Jeffrey E.F. Friedl) (09/06/90)

> I have a large Assembly language program that I want to convert to
> C code.  Does anyone have any information about Assembly language to C
> translation ?  I have heard that translators exist and that several
> companies perform this service.

Actually, I have just the opposite request....

I've seen a lot of this->that translaters, but what I really need is
a C to assembler translator.  Such a beast exist, for any machine?

My system is a 16k TRS-80 Color Computer with an audio-casette
drive (saving for that big 160K disk... can't wait!), if that's
somehow important.

	*jeff*

-----------------------------------------------------------------------------
Jeffrey Eric Francis Friedl                          jfriedl@nff.ncl.omron.jp
Direct path from uunet:                             ...!uunet!othello!jfriedl
Omron Electronics, Central R&D Lab, RNA          Nagaokakyo, Kyoto 617, Japan
Fax: 011-81-75-955-2442                        Phone: 011-81-75-951-5111 x154

      "current memory prices are 4600$ a megabyte on VAX (4/22/81)"
                                              -- my '/usr/include/vmparam.h'

[if you need to be told this is a joke, you're a total idiot (-:]

poser@csli.Stanford.EDU (Bill Poser) (09/07/90)

In article <480@frf.omron.co.jp> jfriedl@frf.omron.co.jp (Jeffrey E.F. Friedl) writes:
>I've seen a lot of this->that translaters, but what I really need is
>a C to assembler translator.  Such a beast exist, for any machine?

Unless I misunderstand this query, what you want will be done
by the great majority of C compilers. At least on UNIX systems, if you
give the compiler the -S option (e.g. cc -S foo.c) it will compile
into assembler. Most UNIX C compilers (and at least some for DOS)
generate assembler and then call a separate assembler, but delete
the intermediate assembler file once they are done with it.

martin@mwtech.UUCP (Martin Weitzel) (09/07/90)

In article <480@frf.omron.co.jp> jfriedl@frf.omron.co.jp (Jeffrey E.F. Friedl) writes:
[about language converters]
>I've seen a lot of this->that translaters, but what I really need is
>a C to assembler translator.  Such a beast exist, for any machine?

Yes, on nearly every UNIX machine it exists and is called "cc -S ...." :-)

>My system is a 16k TRS-80 Color Computer with an audio-casette [...]

Oh, that's somthing different ...
-- 
Martin Weitzel, email: martin@mwtech.UUCP, voice: 49-(0)6151-6 56 83