#
Fortran Wiki

Parametric Fortran

## Parametric Fortran

**Parametric Fortran** is a Fortran program-generator generator that produces extensions of Fortran specialized to 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. The program generator, implemented in Haskell, translates the parameterized Fortran program into regular Fortran 90.

In a simple example from the 2004 paper:

```
{ dim: subroutine arrayAdd(a, b, c)
real :: a, b, c
c = a + b
end subroutine arrayAdd }
```

has this subroutine parameterized by an integer *dim*. The brackets { and } delimit the scope of the *dim* parameter, so that every Fortran syntactic object in the scope is parameterized by *dim*. For *dim* = 2, the following Fortran program will be generated.

```
subroutine arrayAdd(a, b, c)
integer :: i1, i2
real, dimension (1:100, 1:100) :: a, b, c
do i1 = 1, 100
do i2 = 1, 100
c(i1, i2) = a(i1, i2) + b(i1, i2)
end do
end do
end subroutine arrayAdd
```

## External Links

Created on August 2, 2013 22:04:58
by

David Duffy
(110.174.198.144)
(1270 characters / 0.0 pages)