home *** CD-ROM | disk | FTP | other *** search
- .....ND "January 1, 1977"
- .RP
- ....TR 55
- .....TM 76-1273-10 39199 39199-11
- .TL
- RATFOR \(em A Preprocessor for a Rational Fortran
- .AU "MH 2C-518" 6021
- Brian W. Kernighan
- .AI
- .MH
- .OK
- structured programming, control flow, programming
- .AB
- .ps 9
- .nr PS 9
- .vs 11
- .nr VS 11
- .in 0
- .ll
- .PP
- 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:
- .IP "\ \ \ \(bu"
- statement grouping
- .IP "\ \ \ \(bu"
- .UL if-else
- and
- .UL switch
- for decision-making
- .IP "\ \ \ \(bu"
- .UL while ,
- .UL for ,
- .UL do ,
- and
- .UL repeat-until
- for looping
- .IP "\ \ \ \(bu"
- .UL break
- and
- .UL next
- for controlling loop exits
- .LP
- and some ``syntactic sugar'':
- .IP "\ \ \ \(bu"
- free form input (multiple statements/line, automatic continuation)
- .IP "\ \ \ \(bu"
- unobtrusive comment convention
- .IP "\ \ \ \(bu"
- translation of >, >=, etc., into .GT., .GE., etc.
- .IP "\ \ \ \(bu"
- .UL return (expression)
- statement for functions
- .IP "\ \ \ \(bu"
- .UL define
- statement for symbolic parameters
- .IP "\ \ \ \(bu"
- .UL include
- statement for including source files
- .LP
- Ratfor
- is implemented as a
- preprocessor which translates this language
- into Fortran.
- .PP
- 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.
- .PP
- 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.
- .PP
- This paper discusses design criteria
- for a Fortran preprocessor,
- the
- Ratfor
- language
- and its implementation,
- and user experience.
- .AE
- .FS
- This paper is a revised and expanded version of oe published in
- .ul
- Software\(emPractice and Experience,
- October 1975.
- The Ratfor described here is the one in use on
- .UC UNIX
- and
- .UC GCOS
- at Bell Laboratories, Murray Hill, N. J.
- .FE
- .CS 12 1 13 0 0 10
-