Concepts of Programming Languages

(Sean Pound) #1

76 Chapter 2 Evolution of the Major Programming Languages


2.12.1.2 Evaluation
The largest impact of Pascal was on the teaching of programming. In 1970,
most students of computer science, engineering, and science were introduced
to programming with Fortran, although some universities used PL/I, languages
based on PL/I, and ALGOL-W. By the mid-1970s, Pascal had become the
most widely used language for this purpose. This was quite natural, because
Pascal was designed specifically for teaching programming. It was not until
the late 1990s that Pascal was no longer the most commonly used language for
teaching programming in colleges and universities.
Because Pascal was designed as a teaching language, it lacks several features
that are essential for many kinds of applications. The best example of this is
the impossibility of writing a subprogram that takes as a parameter an array
of variable length. Another example is the lack of any separate compilation
capability. These deficiencies naturally led to many nonstandard dialects, such
as Turbo Pascal.
Pascal’s popularity, for both teaching programming and other applications,
was based primarily on its remarkable combination of simplicity and expres-
sivity. Although there are some insecurities in Pascal, it is still a relatively safe
language, particularly when compared with Fortran or C. By the mid-1990s,
the popularity of Pascal was on the decline, both in industry and in universi-
ties, primarily due to the rise of Modula-2, Ada, and C++, all of which included
features not available in Pascal.
The following is an example of a Pascal program:

{Pascal Example Program
Input: An integer, listlen, where listlen is less than
100, followed by listlen-integer values
Output: The number of input values that are greater than
the average of all input values }
program pasex (input, output);
type intlisttype = array [1..99] of integer;
var
intlist : intlisttype;
listlen, counter, sum, average, result : integer;
begin
result := 0;
sum := 0;
readln (listlen);
if ((listlen > 0) and (listlen < 100)) then
begin
{ Read input into an array and compute the sum }
for counter := 1 to listlen do
begin
readln (intlist[counter]);
sum := sum + intlist[counter]
end;
Free download pdf