Parametric Fortran

Parametric Fortran is a Fortran program-generator generator that can produce extensions of Fortran, specialized to support the programming of particular applications. Extensions are specified through parameter structures that can be referred to in Fortran programs to describe the dependency of program parts on these parameters. By providing parameter values, a parameterized Fortran program can be translated into a regular Fortran program.

To use the prototype implementation, download, gunzip, and untar the file Then follow the instructions contained in the file pfc-2.0/doc/pf-manual.pdf, which is also accessible here: pf-manual.pdf. The above version of the compiler works with the Haskell compiler GHC 6.6.

(Here are two alternative implementations of the same Parametric Fortran compiler that works with GHC 6.4 and GHC 6.6.) The version of the Haskell compiler does not have to concern you at all if you all you want to do is to simply use the Parametric Fortran compiler with the provided parameter types. However, if you want to define and use new parameter types, a recompilation of the Parametric Fortran compiler using GHC is required, and it is at this point where the version of GHC matters.

An overview of Parametric Fortran is provided in the following slides from a seminar given at NCAR in June 2006.

The background of Parametric Fortran and its implementation is described in the following papers.

Parametric Fortran: Program Generation in Scientific Computing, Martin Erwig, Zhe Fu and Ben Pflaum
Journal of Software Maintenance and Evolution, Vol. 19, No. 3, 155-182, 2007

Generic Programming in Fortran, Martin Erwig, Zhe Fu and Ben Pflaum
ACM SIGPLAN 2006 Workshop on Partial Evaluation and Program Manipulation, 130-139, 2006

Parametric Fortran - A Program Generator for Customized Generic Fortran Extensions, Martin Erwig and Zhe Fu
6th Int. Symp. on Practical Aspects of Declarative Languages, LNCS 3057, 209-223, 2004

Contact Information

Please send questions, comments, and bug reports to Martin Erwig.

last change: March 14, 2012 Martin Erwig