[comp.lang.c] FOO to C translator

greg@utcsri.UUCP (Gregory Smith) (01/26/87)

In article <****> everybody@everywhere (Eve Rybody) writes:
>HELP!  Does anyone know of a software product that will convert FOO
>language code into "C"?  A friend of mine had told me that he knew of a
>product that would do this, but he did not know the name of the product,
>the company or anything else.  If anyone out here knows anything about it,
>PLEASE send mail to me at....

FOO to C translators fall into two broad classes:

(1) Translators which, when given a valid FOO program, produce a valid
C program which does the same thing, but is not maintainable. All comments
will be deleted from the original, variable names may be reinvented, gotos
may be generated copiously. Weird tables may be created from nowhere. The
C code may not be formatted in any useful way.

These convertors are useful if you have a C compiler and don't expect to
able to find a FOO compiler for your machine. You will still have to
maintain your code in FOO and just use the translator as part of the
compilation. You never have to look at the intermediate C code (which is
just as well).

(2) Translators which, given a valid FOO program, produce a valid and
maintainable C program which contains the original programmers comments.
The output is properly indented, and instead of emulating FOO control
statements with if's and goto's, the translator chooses the appropriate
do, while, for, or switch statement. Variables names are preserved as much
as possible. Parts of the code may be restructured to take advantage of
the strengths of C.

You need a type (2) translator if you have 50K lines of FOO code that
you are sick of maintaining in FOO, and you want to use C.
Unfortunately, type (2) translators generally walk, talk and must be
paid money. I think it is very unrealistic to ask for a type (2)
translator program if FOO is LISP, BASIC, COBOL or even FORTRAN. I have
seen a program do a half decent type (2) from Pascal to C, but they are
pretty close to start with.

What I am trying to say is:
	- When you ask for a 'FOO to C' translator, say what you want it for,
	  so that it is clear whether you need a type (1) or (2) translator.
	- If you want a type (2) translator, don't be surprised if you
	  don't get one.

If you need a type (2) translation, and decide to use a human translator,
it may be very useful to get a type (1) translator program so that the
system can be up and running, and get the human to translate from FOO to
real C in chunks. This allows incremental debugging with the whole system
operational.

However, it is sometimes better to restructure the implementation of a
system when rewriting to C, rather than perform a line-for-line or even
routine-for-routine hand translation from FOO to C.

-- 
----------------------------------------------------------------------
Greg Smith     University of Toronto      UUCP: ..utzoo!utcsri!greg
Have vAX, will hack...

jty@intrin.UUCP (Nokari) (02/02/87)

In article <4009@utcsri.UUCP> greg@utcsri.UUCP (Gregory Smith) writes:
->(2) Translators which, given a valid FOO program, produce a valid and
->maintainable C program which contains the original programmers comments.
->The output is properly indented, and instead of emulating FOO control
->statements with if's and goto's, the translator chooses the appropriate
->do, while, for, or switch statement. Variables names are preserved as much
->as possible. Parts of the code may be restructured to take advantage of
->the strengths of C.
...
->I think it is very unrealistic to ask for a type (2)
                ^^^^^^^^^^^^^^^^
->translator program if FOO is LISP, BASIC, COBOL or even FORTRAN.
                                                          ^^^^^^^
                                                          
Not so unrealistic, we sell a full type (2) Fortran-77 to C translator.
Contact me for more info.

(Don't flame me for being commercial, just wanted to straighten this out)
----
Jyrki Yli-Nokari		Usenet:	jty@intrin.UUCP
Intrinsic Oy			EARN:	YLI at FINTUTA
Aleksis Kiven Katu 11 C		ARPA:	YLI@FINTUTA.FI
SF-33100 TAMPERE		tel:	+358 31 132800
-- 
Jyrki Yli-Nokari		Usenet:	jty@intrin.UUCP or jty@tut.UUCP
Intrinsic Oy			EARN:	YLI at FINTUTA
Aleksis Kiven Katu 11 C		FUNET:	TTKKLK::YLI or TUTOR::JTY
SF-33100 TAMPERE		tel:	+358 31 132800

bertanij@orstcs.UUCP (02/13/87)

In article <****> everybody@everywhere (Eve Rybody) writes:
>>HELP!  Does anyone know of a software product that will convert FOO
>>language code into "C"?  A friend of mine had told me that he knew of a
>>product that would do this, but he did not know the name of the product,
>>the company or anything else.  If anyone out here knows anything about it,
>>PLEASE send mail to me at....

>(2) Translators which, given a valid FOO program, produce a valid and
>maintainable C program which contains the original programmers comments.
>The output is properly indented, and instead of emulating FOO control
>statements with if's and goto's, the translator chooses the appropriate
>do, while, for, or switch statement. Variables names are preserved as much
>as possible. Parts of the code may be restructured to take advantage of
>the strengths of C.

>I have seen a program do a half decent type (2) from Pascal to C, but they are
>pretty close to start with.

>If you want a type (2) translator, don't be surprised if you don't get one.

Don't flame me either because I just want to get it straight also.  TGL sells
a Pascal to C translator in 7 flavors (dialects).  The translation rate is 
between 96 and 99 per cent.  I think that is pretty decent.  Contact Ted Lewis
at (503) 745-7476 for more info.