Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 18

Algol 60

It was the first to have block structure, recursion, and a formal


definition. It is not used now, but it is the ancestor of most
contemporary languages.
As far as design goes, Algol 60 was without doubt the most
important innovation in the history of programming languages.
Algol Historical perspective

By mid/late 50s a lot of PLs were out there

Interest in universal language

European and American groups got together in Zurich


Result was Algol 58
8 people spent 8 days working on the language
Algol goals

To be as close as possible to standard math notation


Also very readable without much more explanation

Should be possible to use it to describe algorithms in


publications
A form of it is still used today

Should be mechanically translatable into machine


language programs
Algol language features

Block structure
And scope of variables within those blocks
Explicit type declaration for variables
Scope rules for local variables
Dynamic lifetimes for variables
Nested if-then-else expressions and statements
Call by value and call by name
Recursive subroutines
Arrays with dynamic bounds
User defined data types
Gotos

Algol did include them


But with (recursive) procedures and blocks, they
werent needed as much
Gotos were going out of vogue
People were realizing that it was a poor way to program
Syntax and style

Free format
Indentation style

Algol defined the style of most successors


Hierarchical structure
Nesting of environments and control structures

Identifiers could be more than 6 characters


Variables and types

Data types: integer, real, boolean


No implicit declarations
No double precision types
No complex number types
Arrays could have more than three dimensions
Could have dynamic bounds
Can start at something other than 0/1
Binding

Binding of names to locations is done on entry to a


block
Not at compile time, as in Fortran

Stack is central run-time data structure


Blocks

Can use a block of statements anywhere a single


statement is needed

begin
declarations;
statements;
end
Blocks support structured
programming
Algol 60
if x = 3 then
begin
y := 9;
k := 10;
end;

Fortran
IF (X .NEQ. 3) GOTO 100
Y = 9
K = 10
100 ...
Blocks allow nested scopes

begin
integer x;

procedure squid;
begin
integer x;
...
end;
end;
Blocks for efficient storage
management
begin
...
begin
real array x[1:1000];
...
end;
...
begin
real array y[1:2000];
...
end;
end;
Control structures

Goto
If-then-else
For loop
Switch
Call by name vs. by value

Call by name is default


Call by name: re-evaluate the actual parameter on
every use
For actual parameters that are simple variables, its the
same as call by reference
For actual parameters that are expressions, the
expression is re-evaluated on each access
No other language ever used call by name
Call by name
begin parameter is n+10 (not just 10)
integer n;
procedure p (k: integer)
begin
print (k); prints n+10, which is 10

n := n+1; n is still 0; thus, n becomes 1

print (k); prints n+10, which is 11

end;
n := 0; n is set to 0

p (n+10);
end; parameter is n+10 (not just 10)
Problems with Algol

Didnt include a I/O library


Thus, each implementation had a different means for I/O
This caused compatibility problems
And no standard way to write a Hello World program
Algol 68

Successor to Algol 60

Included may new features


Unions
Operator overloading
Casting
Standardized input and output
Parallel processing
Rarely implemented by the compilers, though
Life of Algol 60

Didnt achieve widespread use


Extremely important in the history of PLs
Successors: Pascal, Modula, Ada, others
Produced important work on:
Lexical analysis
Parsing
Compilation techniques for block-structured languages

You might also like