Title: Class%202:%20History%20of%20Programming%20Languages
1Class 2 History of Programming Languages
- FORTRAN
- LISP
- ALGOL ? SIMULA
- COBOL
- PL/1
- BASIC
- PASCAL
- C
- The so called High Level Programming Languages
started their development in the mid 50s.
2FORTRAN (FORmulaTRANslation)
- Fortran was design to develop scientific
applications on the IBM 704(with punched card
inputs) computer and the major role in its design
was run-time efficiency.
3Main features
- Comments
- Assignment statements that allowed mathematical
expressions of some complexity on the
right-hand side - The simplicity of writing loops with the DO
statement - Subroutines and functions Not a new idea but it
was implemented employing a symbolic notation - Formats for input and output Difficult feature
to implement on early computers - Machine independence A fortran program could run
on different machines
4Main reasons for its popularity
- It made efficient use of programming time
- Easy to learn (good for non-specialist
programmers) - It was supported by IBM
- It simplifies INPUT/OUTPUT
5Example of a Fortran Program
- C FORTRAN PROGRAM TO FIND MEAN OF N NUMBERS
- C AND NUMBER OF VALUES GREATER THAN MEAN
- DIMENSION A(99)
- REAL MEAN
- READ (1,5)N
- FORMAT (I2)
- READ (1,10) (A(I), I1, N)
- FORMAT (6F10.5)
- SUM 0.0
- DO 15 I1, N
- SUM SUM A(I)
- MEAN SUM/FLOAT(N)
- NUMBER 0
- DO 20 I1, N
- IF (A(I).LE.MEAN0 GOTO 20
- NUMBER NUMBER 1
- CONTINUE
- WRITE (2,250 MEAN, NUMBER
- FORMAT (8H MEAN , F10.5, 5X, 20H NUMBER OVER
MEAN , I5)
6Development
- The first design of Fortran was made in 1954
(Fortran 0) - The first implementation was developed in
1957(Fortran I) - A better compiler was developed in 1958 (Fortran
II) - After many revisions in 1962 a stable compiler
(Fortran IV) - First NASI standard 1966 (Fortran 66)
- After a major revision new features are added
(Fortran 77) - A more modern Fortran is created in 1990 (Fortran
90)
7FORTRAN 90
- Offers features that are common to modern
programming languages - Records
- Modules
- Pointers
8 FORTRAN 0 FORTRAN I(1957)
COBOL(1960) ALGOL 58 FORTRAN
II ALGOL 60 FORTRAN IV PL/1(1964)
BASIC FORTRAN 66
FORTRAN 77 FORTRAN 90
9Referencing in FORTRAN
- All variables are local to each routine
- The local environment of a subroutine consists
of the variables, arrays, etc. declared at the
start of the subprogram. - The local environment is retained between calls
because the activation record is allocated
statically. - Global variables are created using the COMMON
declaration - COMMON /ltnamegt/ltvar or arraygt, ltvar or arraygt,
ltvar or arraygt,
10Example COMMON/ Globalvar/X/Y/A(20)
- program main
- real X, Y
- common /BLK/ X, Y
- statements
- stop
- End
-
- subroutine sub1 ( arguments)
- declarations of arguments
- real X, Y
- common /BLK/ X, Y
- statements
- return
- End
-
- subroutine sub2 ( arguments)
- declarations of arguments
- real X, Y
- common /BLK/ X, Y
11Memory layout
System data and I/O buffers
Code and local data for main program
BLK (common block)
Code and local data for sub1
Code and local data for sub2
System I/O routine
12ALGOL (ALGOrithmic Language)
- ALGOL was develop in 1958 as a committee
effort to design a language for the description
of computing processes in publications. - The objectives of the language were stated as
follows - It should be close as possible to standard
mathematical notation and be readable without to
much additional explanation. - It should be mechanically translate into machine
code.
13ALGOL 58 ALGOL 60 ALGOL
68 ALGOL W
SIMULA 67
PASCAL
14Major Concepts introduced in ALGOL(1)
- Language definition a formal definition in
Backus Naur Form (BNF) was used to define the
syntax for the first time this led to
syntax-directed compilers. - ALGOL 60 was structured It was the originally
block structured language and variables were not
visible outside the block in which they were
declared. - Arrays could have variables bounds.
- Contained several structured control statements
15Major Concepts introduced in ALGOL(2)
- Sequence S1,S2,,Sn
- Selection (IF-THEN-ELSE)
- Iteration (For I 1 step 1 until n do)
- First language to introduce recursive procedures.
16Why ALGOL 60 did not supersede FROTRAN?
- Compilers came out approximately three years
after Fortran. - As it had more features than Fortran it was
harder to learn. - IBM customers were happy with Fortran.
- Fortran compilers were simpler to produce and
more efficient. - Algol 60 had not official Input/output therefore
they left this feature to the individual
manufacturers.
17Example of an Algol program
- begin
- comment this program finds the mean of n numbers
and the number of values greater than the mean - integer n
- read(n)
- begin
- real array a1n
- integer i, number
- real sum, mean
- for i 1 step 1 until n do
- read(ai)
- sum 0.0
- for i 1 step 1 until n do
- sum sum ai
- mean sum/n
- number 0
- for i 1 step 1 until n do
- if ai gt mean then
- number number 1
- write (MEAN , mean, NUMBER OVER MEAN
, number)
18 ALGOL 60 ALGOL W(1966) ALGOL68 SIMULA
67 BCPL PASCAL C
MODULA C ADA(83)
OBERON Eiffel(90)
ADA(95) JAVA
19- The successor of ALGOL 60 was ALGOL W which was
proposed by Wirth and Hoare in 1966 . - The more important changes and additions were(1)
- Records and references allowed linked list,
trees and graphs. - The case statement.
- Changes which separate for and While.
- Procedures and function parameters could be
called by values - and by name.
- Long real and complex data type were introduced
(complex - arithmetic)
20The successor of ALGOL 60 was ALGOL W which was
proposed by Wirth and Hoare in 1966 . The more
important changes and additions were(2)
- The bits data type gave low-level processing
ability. - Some string facilities were included.
- Assert statement were allowed and the assertion
tested during a program run. - Concurrent execution was implemented(B6700)
21- The next step was ALGOL 68 which amid its
interesting features introduced - An economy of constructs produce a core
- language with a small number of powerful
- constructs.
- Orthogonality This was its major design goal.
- There ware no interactions between constructs
- when they were combined. Having determined
- how a feature worked in one situation, it
could be - expected to behave in a similar way in any
other - situation.
22- INCLUDE RECURSION AND STACK MECHANISM
23COBOL (Common Business Oriented Language)
- Cobol was based on the Flow-Matic
language(1957), developed by Grace - Hopper, and IBM's specification of its planned
Commercial Translator. - COBOL is essentially a data processing language
and that is the reason why it - differs significantly from FORTRAN and ALGOL.
- Several design principles guided the design of
COBOL - separate data procedures
- machine dependent statements in one place
- Naturalness (English-like form)
- ease of transcription to require media (cards at
the time) - effectiveness of problem structure
- ease of implementation (for compiler writers)
- physically available character set (printable)
- long data names
24Main features
- The language is simple
- No pointers
- No user defined types
- Record data type
- Self documented
25A COBOL program is divided in four parts
- The identification division Contains commentary
and program documentation. - 000100 INDENTIFICATION DIVISION.000110
PROGRAM-ID. EXAMPLE-1-PROG.000120 AUTHOR. TIM R
P BROWN.000130 INSTALLATION. XYZ GROUP.000140
DATE-WRITTEN. 17/5/00.000150 DATE-COMPILED.00016
0 SECURITY. LOCAL GROUP
26- The environment division Contain
machine-dependent program specifications. Thus,
it specifies the connections between the COBOL
program and the external data file. - 000260 ENVIRONMENT DIVISION.000270
CONFIGURATION SECTION.000280 SOURCE-COMPUTER.
IBM PC.000290 OBJECT-COMPUTER. IBM PC.000300
INPUT-OUTPUT SECTION.000310 FILE-CONTROL.000320
SELECT INPUT-FILE ASSIGN TO 'input.dat'000330
ORGANIZATION IS LINE SEQUENTIAL.000340 SELECT
PRINT-FILE ASSIGN TO PRINTER.
27- The data division Gives a logical description
of the data. - 000800 DATA DIVISION.
- 000900 FILE SECTION.
- 001000 FD SALESPERSON-FILE.
- 001100 01 SALESPERSON-RECORD.
- 001200 05 FILLER PIC XX.
- 001300 05 SP-NUMBER PIC X(4).
- 001400 05 SP-NAME PIC X(18).
- 001500 05 FILLER PIC X(21).
- 001600 05 SP-CURRENT-SALES PIC
9(5)V99. - 001700 05 SP-CURRENT-RETURNS PIC 9(4)V99.
- 001800 FD REPORT-FILE.
- 001900 01 REPORT-RECORD.
- 002000 05 FILLER PIC X(10).
- 002100 05 RT-NUMBER PIC X(4).
- 002200 05 FILLER PIC X(6).
- 002300 05 RT-NAME PIC X(18).
- 002400 05 FILLER PIC X(6).
- 002500 05 RT-CURRENT-SALES PIC ZZ,ZZZ.99.
28- The procedure division Contains the algorithms
necessary to solve the problem. - 000900 PROCEDURE DIVISION.000910
CONTROL-PARAGRAPH.000920 PERFORM
READ-DATA-FILE000930 PERFORM CALULATE-PRICES0009
40 PERFORM PRINT-PRICE-REPORT000950 STOP RUN.
29Example of a COBOL program(Hello world)
- 000010 IDENTIFICATION DIVISION.
- 000020 PROGRAM-ID. HELLO-WORLD-PROG.
- 000030 AUTHOR. TIMOTHY R P BROWN.
- 000040The standard Hello world program
- 000050
- 000060 ENVIRONMENT DIVISION.
- 000070
- 000080 DATA DIVISION.
- 000090 WORKING-STORAGE SECTION.
- 000100 01 TEXT-OUT PIC X(12) VALUE 'Hello
World!'. - 000110
- 000120 PROCEDURE DIVISION.
- 000130 MAIN-PARAGRAPH.
- 000140 DISPLAY TEXT-OUT
- 000150 STOP RUN.
30Example program 2
- 000100 ID DIVISION.
- 000200 PROGRAM-ID. ACCEPT1.
- 000300 DATA DIVISION.
- 000400 WORKING-STORAGE SECTION.
- 000500 01 WS-FIRST-NUMBER PIC 9(3).
- 000600 01 WS-SECOND-NUMBER PIC 9(3).
- 000700 01 WS-TOTAL PIC ZZZ9.
- 000800
- 000900 PROCEDURE DIVISION.
- 001000 0000-MAINLINE.
- 001100 DISPLAY 'ENTER A NUMBER '.
- 001200 ACCEPT WS-FIRST-NUMBER.
- 001300
- 001400 DISPLAY 'ANOTHER NUMBER '.
- 001500 ACCEPT WS-SECOND-NUMBER.
- 001600
- 001700 COMPUTE WS-TOTAL WS-FIRST-NUMBER
WS-SECOND-NUMBER. - 001800 DISPLAY 'THE TOTAL IS ',
WS-TOTAL.
31Example 3 Shows some basic commands
- ADD a TO b.
- ADD c TO a GIVING c.
- COMPUTE x a b c.
- SORT input-file
- ON ASCENDING KEY k
- USING inventory-file
- GIVING sorted-inventory-file
- DISPLAY totalcost.
- ACCEPT identifier.
32COBOL continues to progress with work being done
in the Object-Oriented COBOL standard.
33PROGRAMMING LANGUAGE 1 (PL/1)
- In the early 1960s two categories of
programmers could be distinguished - Scientific programmers (Fortran)
- Commercial programmers (COBOL)
- A committee at IBM developed PL/1 based in
the following principles - Programmers time is an important asset and
should not be wasted. - There is a unity in programming which current
division between scientific and commercial
languages did not reflect.
34PROGRAMMING LANGUAGE 1 (PL/1) (Cont.)
- Pl/1 combined ideas from Fortran, Algol, and
COBOL -
- FORTRAN parameter passing mechanism,
independently compiled subprograms, formatted
input/output and COMMON blocks. -
- ALGOL Block structure and structured
statements. -
- COBOL record input/output,, PICTURE type
declaration, and heterogeneous data structures. -
- From elsewhere list processing concepts,
control structures and methods for storage
management, exception handling by means of
ON-conditions and concurrent execution of tasks
(multi-tasking).
35Example of a PL/1 program
- PROCEDURE OPTIONS (MAIN)
- / Program to find the mean of n numbers and the
number of values greater than the mean / - GET LIST (N)
- IF N gt 0 THEN BEGIN
- DECLARE MEAN, A(n) DECIMAL FLOAT,
- SUM DEC FLOAT INITIAL(0), NUMBER FIXED INITIAL
(0) - GET LIST (A)
- DO I 1 TO N
- SUM SUM A(1)
- END
- MEAN SUM/N
- DO I 1 TO N
- IF A(I) . MEAN THEN
- NUMBER NUMBER 1
- END
- PUT LIST (MEAN, MEAN, NUMBER GRATER THAN
MEAN, NUMBER) - END
36BASIC (Beginners All-purpose Symbolic
Instruction Code)
- It was originally designed at Dartmouth College
by John Kemeny and Thomas Kurtz in the mid-1960s.
37Main Features
- Variables cannot be declared and are single
letters. - Variables are initialized to zero
- Easy to learn and use.
- It was interactive with commands as NEW to create
a program or LIST, RUN, and SAVE.
38Example of BASIC program
- 10 REM THIS IS A BASIC PROGRAM FOR FINDING THE
MEAN - 20 DIM A(99)
- 30 INPUT N
- 40 FOR I 1 TO N
- 50 INPUT A(I)
- 60 LET S S A(I)
- 70 NEXT I
- 80 LET M S/N
- 90 LET K 0
- 100 FOR I 1 TO N
- 110 IF A(I) lt M THEN 130
- 120 LET K K 1
- 130 NEXT I
- 140 PRINT MEAN IS, MEAN
- 150 PRINT NUMBER GREATER THAN MEAN IS, K
- 160 STOP
- 170 END
39ALGOL ALGOL 68 ALGOL W
COBOL PL1
PASCAL ADA
40Pascal
- It was designed by Niklaus Wirth.
- A teaching language
- The language most used in the 1970s
- Include run time environment (code, static data,
stack ? ? heap) - It uses the concept of static array like in
Frotran. - New data types(define by the user) can be built
up from primitive data types.
41Example of a Pascal Program
- (Pascal program for finding the mean)
- Program main (input, output)
- type intlist array 1 . . 99 of integer
- var
- a intlist
- i, n, number integer
- sum, mean real
- (main program stars here )
- begin
- number 0
- sum 0
- readln (n)
- for I 1 to n do
- begin
- readln(ai)
- sum sum ai
- end
- mean sum/n
- for I 1 to n do
42Example for temporary expression x i (I
J) (I/J f( J ))
Outgoing results
SP
Result of I / K
Result of I J
Address of x i
Local Variables
Formal Parameter
RA
Static Link
Dynamic Link
SF
43C
- Implemented by Dennis Ritchie in 1972
- system programming
- c 1972
- c 1989 (ANSI)
- c 1992 (ISO)
44An Example of a C Program
- /C program for finding the mean/
- main()
- float a100, mean, sum
- / the array a has 100 elements a0, .. a99
/ - int n, i, number
- scanf(d, n)
- for( i 0 i lt n i)
- scanf(f, a i )
- sum 0.0
- for( i 0 i lt n i)
- sum a i
- mean sum / n
- number 0
- for( i 0 i lt n i)
- if( a i gt mean)
- number
-
- printf( MEAN f \n, mean)
- printf(NUMBER OVER MEAN d\n, number)
No nested procedures are allowed
45SP
Sum
Local
List4
Local
Local
List3
List2
Local
void sub(float total, int part ) int
List5 float sum
Local
List1
List0
Local
Part
Parameter
Total
Parameter
Dynamic Link
Return Address
SF
46Run time environment for C Pascal Ada Algol Java
Object code
Static Data
Stack
Heap
47Bibliography L.B. Wilson and R.G. Clark,
Comparative Programming Languages, 3rd edition,
Addison-Wesley, 2001. http//www.techiwarehouse.c
om/Cobol/Cobol_Tutorial.html2 Jiehong Li and
Rona Abraham notes. M. Donald
MacLaren Exception handling in PL/I Proceedings
of an ACM conference on Language design for
reliable software Raleigh, North Carolina pp.
101 104, 1977