f2p, c2p
Fri, 24 Nov 1995 17:24:49 +0100 (MEZ)
Hello, folks!
Only one small question/suggestion: Does there exist a f2p or c2p
translator program which translates Fortran resp. C source to Pascal
source? If not, I suggest that somebody writes it because of the
following reasons:
- Practical reason: It would be nice to import libraries written
in C, C++ or Fortran automatically. For most purposes, it would
be sufficient to have a program which ports C header files to
Pascal Unit (Module) interfaces.
- Psychological reason: The existence of a c2p would demonstrate
that Pascal is at least as powerful as C. The existence of a p2c
(which does in fact *not* support everything which is possible in
Borland Pascal -- I am thinking of the Object extensions) is ac-
cepted by many people as a "proof" that C would be superior to
Pascal, so we should "proove" the opposite direction. :-)
I am almost sure that at least the c2p program does not exist because
Standard Pascal has indeed less abilities than C. However, you can
do everything which is possible in C with GNU Pascal (including e.g.
pointer arithmetics -- just do a type cast to Integer), so the main
difficulty will be to *understand* the C source, not to translate it.
C++ could be more complicated as long as GNU Pascal does not (yet) have
multiple inheritance. For Fortran, I don't see any problems, since
there are complex numbers in GNU (Extended) Pascal, but one should
translate goto statements to structured statements wherever possible..
One idea how to write it: Just use the front-ends of the GNU compi-
lers and replace the assembler back-end by a Pascal back-end. Once
you have understood how the front-end passes information to the
back-end, the job will be straightforward. (One could even easily
generalize it to a general x2y translator ...! :-)
I have not the time to do it myself :-( so I ask *you* if you are
willing to do this important contribution.
Yours,
Peter
--------------------------------------------------------------------------------
Dipl. Phys. Peter Gerwinski
Fachbereich Physik
Universitaet-GH Essen Phone: +49-201-183-2763
D-45117 Essen Fax: +49-201-183-2120
Germany e-mail: pege@mail.theo-phys.uni-essen.de
--------------------------------------------------------------------------------
Peter Gerwinski (pege@rs1.Theo-Phys.Uni-Essen.DE)
HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada -
Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es