Sei sulla pagina 1di 17

History of Programming Languages

Text visible only in an overlay.

Outline - temporal

Early stages - pre 1958

First generation languages - pre 1967

Second generation languages - 1967..1982

Third generation  1984 to now

History of Programming Languages


Text visible only in an overlay.

Outline - conceptual, this axis is orthogonal to the time axis

Imperative mainstream - Fortran to C#

calculus based languages - Lisp to Haskell

Interpretive languages - Basic to Perl

Array Languages - APL to ZPL

Logic Languages
2

History of Programming Languages


Text visible only in an overlay.

Outline - exemplar
Here we give an example algorithm that we will code in several dierent languages. Seive of Eratostenes - Aim to nd the rst primes
Given {1..n}, starting at 2 going up remove from the set successive multiples of each number in the set, what remains are the primes.

Optimisations:

1. only need to go up to

2. start going through multiples at currentprevious prime


3

Pascal Version

PROGRAM seive(output); CONST maxlim=100; TYPE range= 1..maxlim; intset=SET OF range; VAR primes:intset; i,k,j:integer; BEGIN primes:=[2..maxlim]; k:=1; FOR i IN primes DO BEGIN j:=i*(k+1);k:=i; WHILE j<= maxlim DO BEGIN primes:=primes-[j]; j:=j+i; END; END; primes:=primes+[1]; FOR i IN primes DO WRITELN(i);

END.

Time/conceptual grid Imperative assemblers Fortran, Algol60 Simula Algol68 Pascal,C ADA C++, Fortran90 Java C# Interpreter autocode Array < 1958 1960 1964 1967 1970 1980 1985 1990 1995 2002

Lisp

APL BASIC POP FORTH Smalltalk Postscript Perl

HOPE ML Scheme Haskell NIAL

A+ J Matlab ZPL

Note that in the last period array and object oriented concepts become common

Period 1 imperative languages: Key concepts

1. The automatic translation of algebraic expressions to machine code. FORTRAN stood for FORmula TRANslator.

2. The use of functions or subroutines. (a) Recursion - provided in algol60 but not FORTRAN. (b) Block structure - algol60.

3. Data structure provided by arrays.

4. BNF to dene syntax - algol60 report.

5. Objects and tasks - Simula.


6

Period 2 imperative languages: Key Concepts

1. Strong types

2. Pointers (algol68 ref ref types), heap allocation

3. Records or structures

4. Typed modular compilation - Fortran had provided separate compilation but with no type checking.

5. Sets - provided in Pascal.

6. Enumerated types - Pascal, C

7. Union types - Algol68, Pascal,C


7

Imperative programming languages: third period

1. Introduce classes with inheritance C++, C#, Java

2. Introduction of facilities for parallel processing Fortran90 and F, these are borrowed from array processing languages.

Array Languages Iversons notation used as a mathematical notation in the 50s prior to use in programming A Programming Language (APL) introduced 1962 Arrays as built in type All operations extend over arrays Interpretive/interactive Special mathematical typeface used

APL continued Very compact notation Widely used for interactive calculations prior to the introduction of spreadsheets Type face hindered further use

10

Second Generation Array Languages A+, J, K All of these allow ascii keywords or operators either exclusively or as alternative to special symbols. We will look at the problem of nding primes in A+ rst program to nd all prime numbers <= specied integer as an introduction initially to the special notation and then give ascii versions.

11

PRIMES n:{(~R,R.R)/R

2 n}

This one line function does not use eratosthenes, we will get that later. Notes:

1. APL processes expressions from right to left, except when the order of evaluation is changed by using parentheses.

2. Example assumes "0-origin" for generating "all integers up to R" (iota function).

3.

n returns the sequence of integers from 0 to n 1 thus 7 gives (0,1,2,3,4,5,6) 2 n which drops the rst two elements from the list so 2 7 gives
12

4. R is assigned

R=(2,3,4,5,6)

5. R.R generates the matrix outer product 2 3 4 5 6 2 3 of R with R = 4 5 6 4 6 8 10 12 6 9 12 15 18 8 12 16 20 24 10 15 20 25 30 12 18 24 30 36

6. This is then turned into a one dimensional array using the , operator in ,R.R giving (4,6,8,10,12,6,9,12,15,18,...,24,30,36)

7. The set membership operator

is then

used to test each member of R for its presence in this vector this returns the boolean vector (0,0,1,0,1), which is then negated with the ~ operator to return (a) (1, 1, 0, 1, 0) = (2, 3, 4, 5, 6) (4, 6, 8, 10, 12, 6..., 30, 36)

8. The / operator means select from, so (1,1,0,1,0)/(2,3,4,5,6) selects (2,3,5) which is the answer. Only those elements on the right whose corresponding left element is true are selected.

The same algorithm can be written in ASCII as PRIMES n:{(~R in ,R*.R)/R:=2 drop iota n}

Eratosthenes version

Note: next mask

1 R selects the head of the list

next|R sets mask to be true wherever

R holds a remainder after division by next ^/1mask removes the head of mask and returns true if all elements in the list are true , concatenates two lists & stands for this function during recursion
13

Call with

0 is the null list

14

Test note. A time marker: Don't talk more than .

14-1

Potrebbero piacerti anche