comp.lang.ada
 help / color / mirror / Atom feed
From: Geoff Bull <gbull@acenet.com.au>
Subject: Re: Fortran 77 to Ada
Date: 1999/11/20
Date: 1999-11-20T00:00:00+00:00	[thread overview]
Message-ID: <38361943.813C2E20@acenet.com.au> (raw)
In-Reply-To: 18cf8f9c.09c1c234@usw-ex0108-062.remarq.com

Chris wrote:
> 
> Do you know any tools able to translate automatically
> (almost) a Fortran software program (F77 type)into an Ada83
> software program ?
> 

I hava a perl script called f2ada.pl - but I don't know where it came
from. It doesn't work perfectly, you will almost certainly
need to do some fixing up.

Below is the header which should help you find it.
Don't be put off by the Ada-95, I don't recall seeing anything
generated that wasn't Ada-83 (apart from some complete rubbish, 
of course. Since, it's GPL'd, I can mail it to you if you can't
find it on the web. 

You could probably (with a lot of effort) hack f2c to generate Ada 
(maybe that's already been done by someone?).

Any reason why you can't just leave the Fortran as is and use a
pragma import?


#!/usr/local/bin/perl
#
# f2a.pl:    VAX Fortran-77 to Ada-95 converter toy
# Version:   0.1  (1996/11/26)
# Usage:     perl f2a.pl <fortran_inputfilename>
#            Output will go to stdout.
# Author:    Oliver M. Kellogg (oliver.kellogg@space.otn.dasa.de)
# Copyright: (C) 1996, Dornier Satellite Systems GmbH, a division of
#            Daimler-Benz Aerospace AG (DASA), Munich, Germany
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
---------------------------------------------------------------------------
# Special warnings:
#
# 1. This toy program has been my Perl learning experience. I am sure
#    there are ample ways to improve it or make it more elegant.
# 2. The aim of this toy is NOT to replace a Fortran compiler
#    (like for example the f2c program does.) Do not expect to pass the
#    output through an Ada compiler directly without manual tuning.
# 3. Being a primitive one-pass text substitution tool, translation is
#    at best HALF automatic.
#    The tool has been tried only on some standalone numerical
algorithms.
#    Character strings and I/O operations are not supported at all, nor
#    are those constructs that don't map to Ada in an easy way.
#    Best results are obtained on "structured" F77 code (i.e. code that
#    minimizes use of GOTO and employs block oriented statements like
#    IF/THEN/ELSE/ENDIF and DO/ENDDO.) If you feed spaghetti to it,
#    it will output no other than that.
# 4. and most importantly, the program just goes to show how much
#    inferior automatic translation is w.r.t. a software redesign.
#    I strongly DISCOURAGE its use if redesign is at all possible.
#
#
---------------------------------------------------------------------------
# What, you're still reading on after all that?
# Well then, have fun with the f2a.pl converter toy, and please send
your
# suggestions/bugreports/improvements to:
# Oliver.Kellogg@space.otn.dasa.de




  parent reply	other threads:[~1999-11-20  0:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-19  0:00 Fortran 77 to Ada Chris
1999-11-20  0:00 ` Robert Dewar
1999-11-22  0:00   ` Gautier
1999-11-22  0:00     ` Robert Dewar
     [not found]       ` <foY6OBD5gjcPjzWrpLelVV=Ml6VL@4ax.com>
1999-11-25  0:00         ` Simon Wright
1999-11-22  0:00   ` Ted Dennison
1999-11-20  0:00 ` Geoff Bull [this message]
1999-11-22  0:00   ` Robert Dewar
1999-11-22  0:00   ` okellogg
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox