Parsing Fortran 77 I/O format specifiers in Harwell-Boeing sparse matrix files

Fortran 77 I/O format specifiers

The Harwell-Boeing (a.k.a. Rutherford-Boeing) sparse matrix storage format makes direct use of Fortran 77 I/O format specifiers. This sounds scary for the modern generation of programmers, who are indoctrinated to think of Fortran as some monstrosity from the dark ages of coding, but those who are familiar with the specifiers can testify that they are generally more flexible and easier to use than the corresponding C printf/scanf format specifiers. They inspired the Common Lisp FORMAT output facility, which is still in active use. (This is particularly ironic, as Lisp and Fortran are typically cited as two languages with completely opposite objectives!) Combined with the internal file facility (as described by Ellis, pp. 430-1 [1]), they allow quite general manipulation of numbers and strings, similar to that provided by C++ stringstreams or the equivalent Common Lisp constructs. Fortran format specifiers are described in [1] and [2], among other sources.

Fortran format specifiers make parsing Harwell-Boeing files quite easy in Fortran 77, as can be seen by an example code. The data file actually decodes itself -- it contains the format specifiers needed to parse itself. The technique recalls the much later XML DTD, with its goal that documents be "self-parsing."

The specific case of storing Fortran format specifiers in the data file to be parsed is undesirable, however, for the following reasons: