RATFOR -- A Preprocessor for a Rational Fortran

Brian W. Kernighan
structured programming, control flow, programming

ABSTRACT

      Although Fortran is not a pleasant language to use, it does have the advantages of universality and (usually) relative efficiency. The Ratfor language attempts to conceal the main deficiencies of Fortran while retaining its desirable qualities, by providing decent control flow statements:

+
statement grouping
+
if-else and switch for decision-making
+
while, for, do, and repeat-until for looping
+
break and next for controlling loop exits

and some ``syntactic sugar'':

+
free form input (multiple statements/line, automatic continuation)
+
unobtrusive comment convention
+
translation of >, >=, etc., into .GT., .GE., etc.
+
return(expression) statement for functions
+
define statement for symbolic parameters
+
include statement for including source files

Ratfor is implemented as a preprocessor which translates this language into Fortran.

      Once the control flow and cosmetic deficiencies of Fortran are hidden, the resulting language is remarkably pleasant to use. Ratfor programs are markedly easier to write, and to read, and thus easier to debug, maintain and modify than their Fortran equivalents.

      It is readily possible to write Ratfor programs which are portable to other env ironments. Ratfor is written in itself in this way, so it is also portable; versions of Ratfor are now running on at least two dozen different types of computers at over five hundred locations.

      This paper discusses design criteria for a Fortran preprocessor, the Ratfor language and its implementation, and user experience.


Table of Contents