Version 7 (modified by rtoy, 3 years ago)

Add note about using the keyword extension

Welcome to F2CL

F2CL is a Fortran to Common Lisp converter that can convert Fortran 77 (with some extensions) to Common Lisp.

Getting F2CL

The easiest way to get F2CL is to clone the hg (Mercurial) repository:

  hg clone http://common-lisp.net/project/f2cl/hg/f2cl

For developers with ssh access, you can use

  hg clone ssh://user@common-lisp.net//project/f2cl/public_html/hg/f2cl

Substitute your user name for "user", of course. Also, note the two slashes before project. These are important.

Note that when f2cl converts a Fortran file to Lisp, it includes information about the version of f2cl used to do the conversion. For this to work you will need to set up Mercurial to use the keyword extension. Add the following to your .hgrc file:

[extensions]
# Enable the Mercurial keyword extension for RCS keywords.
keyword =

# Filename patterns for CVS keyword expansion are configured in this
# section
[keyword]
# Expand keywords in all .l files.  Basically for f2cl sources.
src/*.l =

Now when you clone f2cl, you should something like this in src/f2cl1.l:

(defparameter *f2cl1-version*
  "$Id: f2cl1.l,v f0f149e72999 2010/10/08 03:05:30 rtoy $")

Quick Start to Using F2CL

First, you need to load f2cl. This can be done simply with

  (asdf:oos 'asdf:load-op :f2cl)

assuming that asdf can find f2cl.asd.

Once F2CL is loaded, you can convert a Fortran file to Lisp using

  (f2cl:f2cl "src.f")

This will convert the Fortran code in src.f and place the translation in src.lisp.

Or you can convert and compile the result using

  (f2cl:f2cl-compile "src.f")

This does the conversion and then calls COMPILE-FILE to compile the resulting Lisp code.

Examples

F2CL comes with many examples of converting Fortran code to Lisp. Look in the packages directory for the examples. Included packages are:

  •  colnew - Boundary-value problems for ODEs
  •  fishpack - Solve separable elliptic PDEs
  •  hompack - Solves non-linear systems of equations by homotopy methods.
  •  minpack - Solves non-linear equations and non-linear least squares problems
  •  odepack - Initial value problem for ODEs
  •  quadpack - Numerical integration
  •  TOMS 419 - Zeroes of a complex polynomial
  •  TOMS 715 - Numerical evaluation of Special functions
  •  TOMS 717 - Max- and quasi-likelihood estimation in non-linear regression

These packages are not officially a part of F2CL. They are packages used to test F2CL.

Starting Points

For a complete list of local wiki pages, see TitleIndex.