f2c

Implementation of programming language Fortran

f2c is a program which converts Fortran 77 to C code, developed at Bell Laboratories. It is written in C. The generated code is compatible with f77 (which is also written in C and relies on C compiler to produce an executable); this allows to ensure code portability.

Using f2c is convenient whenever one wants to use a Fortran program without installing Fortran compiler, or combine pieces of code written in C and in Fortran (for example, when some parts of logic are much easier to implement in one of the languages). The advantages of this compiler are its availability (it is free software) and the fact that it is debugged well and generates high-quality code.

C code generated by f2c might look rather unusual, though the authors of the tool tried to make it as human-readable as possible. For example, all I/O is done via functions of libf2c library (linked at compile-time using -lf2c -lm option) and look quite awkward.

f2cpp

To increase readability of the generated code, Edward Fomin created a wrapper of f2c called f2cpp. It supplements f2c with a Python script which moves the repeating definitions to f2cpp.h and simplifies the code, including I/O routines. f2cpp is distributed under GNU GPL.