[net.lang.f77] Fortran to C translator

nunes@utai.UUCP (Joe Nunes) (06/05/85)

   A friend of mine is looking for a Fortran to C translator. The names
of translators, the names of their manufactures, and possibly any
useful information about them would be greatly appreciated.
   Thanks in advance.

peters@cubsvax.UUCP (Peter S. Shenkin) (06/10/85)

In article <> nunes@utai.UUCP writes:
>
>   A friend of mine is looking for a Fortran to C translator. The names
>of translators, the names of their manufactures, and possibly any
>useful information about them would be greatly appreciated.
>   Thanks in advance.

I don't have an answer... but the documentation to the unix f77 compiler
states that the compiler produces intermediate C code.  In the past I've 
looked further through the documentation for a command-line option which
would allow the user to trap the output at this level... in the same sense that
cc -E traps preprocessor output.  If such an otion exists, it's not documented,
as far as I can see;  but it would seem that it should be possible to go
into the compiler and create such an option.  If someone is ambitious
enough to do so, I'm sure many of us would appreciate a posting to the net.

Peter S. Shenkin			philabs!cubsvax!peters

wcs@ho95e.UUCP (x0705) (06/12/85)

> In article <> nunes@utai.UUCP writes:
> >
> >   A friend of mine is looking for a Fortran to C translator. The names
> >of translators, the names of their manufactures, and possibly any
> >useful information about them would be greatly appreciated.
> >   Thanks in advance.
> 
> I don't have an answer... but the documentation to the unix f77 compiler
> states that the compiler produces intermediate C code.  [......]
> Peter S. Shenkin			philabs!cubsvax!peters

No, it produces "C intermediate code".  This is the intermediate code that the
C compiler produces between pass 1 and pass 2.  According to the SVR1
manual, the f77 compiler on SysV uses
	/usr/lib/f77pass1	f77 compiler
	/lib/c1			pass 2 of C compiler
	/lib/c2			optimizer
	/bin/as
	/bin/ld

but it doesn't use /lib/cpp (the preprocessor), or the C compiler pass 1
(/lib/ccom, /lib/c0, or /usr/lib/comp, depending on version & machine).
(Actually, on a Vax 11/780 running System V, there's a /lib/f1, and the
3B-20 running SVR2 has /usr/lib/f77pass2 (documented!)).
-- 
	Bill Stewart, AT&T Bell Labs, Holmdel NJ 1-201-949-0705 ihnp4!ho95c!wcs
Wizardry at reasonable rates

guy@sun.uucp (Guy Harris) (06/12/85)

> I don't have an answer... but the documentation to the unix f77 compiler
> states that the compiler produces intermediate C code.

The only "UNIX f77 compiler" that can be considered an "official" F77
compiler is the compiler that comes with standard UNIX releases from AT&T,
and which is supplied in much-modified form with 4.2BSD.  I don't know about
your documentation, but my documentation says nothing about producing
intermediate C code because the "f77" compiler doesn't produce C code.  The
first pass of the compiler *does* produce intermediate code that is then
turned into machine code (well, assembly code) by a back end made out of the
portable C compiler, but that's it.  No C code is produced anywhere.

	Guy Harris

cdl@mplvax.UUCP (Carl Lowenstein) (06/12/85)

In article <338@cubsvax.UUCP> peters@cubsvax.UUCP (Peter S. Shenkin) writes:
>In article <> nunes@utai.UUCP writes:
>>
>>   A friend of mine is looking for a Fortran to C translator.
>
>I don't have an answer... but the documentation to the unix f77 compiler
>states that the compiler produces intermediate C code.

Read it again.  "The (f77) compiler generates C compiler intermediate code."
That means that it produces the same kind of code that the first pass of
the C compiler produces -- parse trees and other exotic things.  These
can then be sent to the second pass of the C compiler just as if they had
originated from a C program.  But there is no intermediate C code.



-- 
	carl lowenstein		marine physical lab	u.c. san diego
	{ihnp4|decvax|akgua|dcdwest|ucbvax}	!sdcsvax!mplvax!cdl

arnold@gatech.CSNET (Arnold Robbins) (06/12/85)

> In article <> nunes@utai.UUCP writes:
> >
> >   A friend of mine is looking for a Fortran to C translator. The names
> >of translators, the names of their manufactures, and possibly any
> >useful information about them would be greatly appreciated.
> >   Thanks in advance.
> 
> I don't have an answer... but the documentation to the unix f77 compiler
> states that the compiler produces intermediate C code.  In the past I've 
> looked further through the documentation for a command-line option which
> would allow the user to trap the output at this level... [.....]
> 
> Peter S. Shenkin			philabs!cubsvax!peters

No, no, no!  The f77 compiler does not produce intermediate C code, it
produces C intemediate code! There's a difference.  When PCC was designed,
it was done as a front end and back end.  The front end reads C and produces
an intermediate code (mixed assembly language and triples), and the back
end reads this and produces full assembly language.

The f77 front end reads Fortran 77 and produces the same intermediate code.
The compilers share the back end, optimizer (which optimizes the assembly),
and assembler and loader.  Berkeley's Pascal compiler also uses the same
back end.  See the August '78 Bell System Technical Journal article on porting
C and Unix.

There are Pascal compilers out in the real world that read Pascal and generate
C. Whitesmith's does (reportedly), and also HCR Pascal, but it is a lot
harder to do with Fortran.
-- 
Arnold Robbins
CSNET:	arnold@gatech	ARPA:	arnold%gatech.csnet@csnet-relay.arpa
UUCP:	{ akgua, allegra, hplabs, ihnp4, seismo, ut-sally }!gatech!arnold

How come nobody likes good ideas when they don't come up with them?

levy@ttrdc.UUCP (Daniel R. Levy) (06/13/85)

There have now been some postings on the net in reply to this question that
have pointed out that the Unix f77 compiler does not produce C code anywhere
in its action, which is true.  However, even if it did, I am sure the code
would be just as bug-ridden as what f77 produces presently in the executable.
(In a following article I have a few flames on the subject.)

I have heard of a Fortran to C translator, but never had a chance to try it.
It was advertised several months ago in Electronic Design News, or one of the
other advertisement-laden 'freebie' EE publications.  I can't seem to dig it
up right now, but I'm sure I saw it.

My impression (and I could be mistaken) is that it would be of limited value 
over f77 itself, if f77 were bug free (unfortunately, it isn't).  The calling
conventions of Fortran (variables passed to subroutines/functions are done so
by address, necessitating lots of indirect memory references in the routines
when these variables are used) and the need for the special types of I/O,
among other vagaries of Fortran, would handicap the result.  If there was a 
burning need to modify the source code anyway, it might be better just to 
hand-translate the algorithm into C, taking advantage of the greater powers 
of C.   I imagine that a Fortran to C translator would make it easier if the 
code were to be used in bulk, and it would let the code be put on most any Unix 
machine, letting cc worry about the exact machine code involved,  IF the trans-
lator were perfect or near so; it would be a great headache to have to debug the
C code because a particular C compiler didn't like it.  It would be quite a 
challenge to put out C code portable across absolutely ALL compilers.

D. Levy
AT&T Teletype Corp.
Skokie, Ill.

mpb@iclbra.UUCP (Paul Blackburn) (06/19/85)

> 
>    A friend of mine is looking for a Fortran to C translator. The names
> of translators, the names of their manufactures, and possibly any
> useful information about them would be greatly appreciated.
>    Thanks in advance.

*** MASSAGE THIS PLACE WITH YOUR LINE ***

See page 19 of UNIX REVIEW May 1985. Summary follows:

FORTRIX, Fortran-to-C Conversionware from:
Rapitech Systems Inc.
Dept. A2,
565 Fifth Avenue
New York
NY 10017

Contact: Jim Flynn at (212) 687-6255 or Telex 509210

I have no connection with Rapitech, I simply pass on relevant details.
-- 
     :~        MAIL: Paul Blackburn, ICL, Lovelace Rd, Bracknell, Berkshire,UK 
    _+_        UUCP: ...!ukc!stc!iclbra!mpb
    )__)       
 _+__+__+_     "I must go down to the sea again,
 )_)___)__)     To the lonely sea and the sky,
__|__|__|_____  I left my shoes and socks there,
L__________/    I wonder if they're dry?" :-)