BSD 3 development
[unix-history] / usr / doc / ratfor / m0
CommitLineData
8340f87c
BJ
1.....ND "January 1, 1977"
2.RP
3....TR 55
4.....TM 76-1273-10 39199 39199-11
5.TL
6RATFOR \(em A Preprocessor for a Rational Fortran
7.AU "MH 2C-518" 6021
8Brian W. Kernighan
9.AI
10.MH
11.OK
12structured programming, control flow, programming
13.AB
14.ps 9
15.nr PS 9
16.vs 11
17.nr VS 11
18.in 0
19.ll
20.PP
21Although Fortran is not a pleasant
22language to use,
23it does have the advantages of universality
24and (usually) relative efficiency.
25The
26Ratfor
27language attempts to conceal
28the main deficiencies of Fortran
29while retaining its desirable qualities,
30by providing
31decent control flow statements:
32.IP "\ \ \ \(bu"
33statement grouping
34.IP "\ \ \ \(bu"
35.UL if-else
36and
37.UL switch
38for decision-making
39.IP "\ \ \ \(bu"
40.UL while ,
41.UL for ,
42.UL do ,
43and
44.UL repeat-until
45for looping
46.IP "\ \ \ \(bu"
47.UL break
48and
49.UL next
50for controlling loop exits
51.LP
52and some ``syntactic sugar'':
53.IP "\ \ \ \(bu"
54free form input (multiple statements/line, automatic continuation)
55.IP "\ \ \ \(bu"
56unobtrusive comment convention
57.IP "\ \ \ \(bu"
58translation of >, >=, etc., into .GT., .GE., etc.
59.IP "\ \ \ \(bu"
60.UL return (expression)
61statement for functions
62.IP "\ \ \ \(bu"
63.UL define
64statement for symbolic parameters
65.IP "\ \ \ \(bu"
66.UL include
67statement for including source files
68.LP
69Ratfor
70is implemented as a
71preprocessor which translates this language
72into Fortran.
73.PP
74Once the control flow and cosmetic deficiencies of Fortran
75are hidden,
76the resulting language is remarkably pleasant to use.
77Ratfor
78programs are
79markedly easier to write, and to read,
80and thus easier to debug, maintain and modify
81than their Fortran equivalents.
82.PP
83It is readily possible to write
84Ratfor
85programs which are portable to other env ironments.
86Ratfor
87is written in itself
88in this way,
89so it is also portable;
90versions of
91Ratfor
92are now running on at least two dozen different types of computers
93at over five hundred locations.
94.PP
95This paper discusses design criteria
96for a Fortran preprocessor,
97the
98Ratfor
99language
100and its implementation,
101and user experience.
102.AE
103.FS
104This paper is a revised and expanded version of oe published in
105.ul
106Software\(emPractice and Experience,
107October 1975.
108The Ratfor described here is the one in use on
109.UC UNIX
110and
111.UC GCOS
112at Bell Laboratories, Murray Hill, N. J.
113.FE
114.CS 12 1 13 0 0 10