Concepts of Programming Languages

(Sean Pound) #1

46 Chapter 2 Evolution of the Major Programming Languages


manufactured by IBM. Indeed, they were forced to consider building Fortran
compilers for other IBM machines only because the successor to the 704, the
709, was announced before the 704 Fortran compiler was released. The effect
that Fortran has had on the use of computers, along with the fact that all sub-
sequent programming languages owe a debt to Fortran, is indeed impressive
in light of the modest goals of its designers.
One of the features of Fortran I, and all of its successors before 90, that allows
highly optimizing compilers was that the types and storage for all variables are
fixed before run time. No new variables or space could be allocated during execu-
tion time. This was a sacrifice of flexibility to simplicity and efficiency. It elimi-
nated the possibility of recursive subprograms and made it difficult to implement
data structures that grow or change shape dynamically. Of course, the kinds of
programs that were being built at the time of the development of the early versions
of Fortran were primarily numerical in nature and were simple in comparison
with more recent software projects. Therefore, the sacrifice was not a great one.
The overall success of Fortran is difficult to overstate: It dramatically
changed the way computers are used. This is, of course, in large part due to its
being the first widely used high-level language. In comparison with concepts
and languages developed later, early versions of Fortran suffer in a variety
of ways, as should be expected. After all, it would not be fair to compare the
performance and comfort of a 1910 Model T Ford with the performance and
comfort of a 2013 Ford Mustang. Nevertheless, in spite of the inadequacies of
Fortran, the momentum of the huge investment in Fortran software, among
other factors, has kept it in use for more than a half century.
Alan Perlis, one of the designers of ALGOL 60, said of Fortran in 1978,
“Fortran is the lingua franca of the computing world. It is the language of the
streets in the best sense of the word, not in the prostitutional sense of the word.
And it has survived and will survive because it has turned out to be a remarkably
useful part of a very vital commerce” (Wexelblat, 1981, p. 161).
The following is an example of a Fortran 95 program:

! Fortran 95 Example program
! Input: An integer, List_Len, where List_Len is less
! than 100, followed by List_Len-Integer values
! Output: The number of input values that are greater
! than the average of all input values
Implicit none
Integer Dimension(99) :: Int_List
Integer :: List_Len, Counter, Sum, Average, Result
Result= 0
Sum = 0
Read *, List_Len
If ((List_Len > 0) .AND. (List_Len < 100)) Then
! Read input data into an array and compute its sum
Do Counter = 1, List_Len
Read *, Int_List(Counter)
Sum = Sum + Int_List(Counter)
Free download pdf