Help - Search - Members - Calendar
Full Version: 12/6/05 Programming Language of the Week: Algol
:: LEAST I COULD DO FORUM :: > The Interests > Tech Etc
siwelwerd
Algol

Description:
Algol (for Algorithmic Language) was a very early block-structured compiled language developed a committee, and implemented by computing pioneer John Backus. It was designed for general-purpose industial and scientific programming.
Dialects of Algol include the original Algol58, Algol60, Algol68, ABC Algol, Algol W, S-Algol, and many other variants. Algol58 was originally called the "International Algebraic Language" (IAL).
Data types supported by Algol60 include booleans, various sizes of integers and reals, and strings. Support for strings was limited in standard Algol, but later dialects and implementations added more support. Algol60 was strongly typed in the sense that the compiler checked parameter types in expressions and subroutine calls. It did not permit the declaration of new data 'types' or data structures. Arrays are the only composite data type in Algol60. Algol60 supported highly regular block structure and a complete set of control structures: if-then-else, case, while loops. One of Algol's main contribution to programming was the introduction of block nesting and lexical scoping of local and block variables. Algol60 did not support any kind of general memory management or dynamic memory allocation.
Various implementations of some Algol dialects are still available commercially. Information on the web seems sparse, but some documentation of Algol68 is available. Of course, many old programming books describe the language.

Origin:
J. Backus and P. Naur, 1958-60.

Remarks:
Algol itself is no longer widely used, but it had a profound effect on computer language design from 1958 onwards. Many of the features that today we consider essential in a general-purpose language were first proposed for Algol60 or Algol68.
Algol60 was probably the first computer language whose syntax was completely described with a formal grammar prior to writing the compiler!
Algol60 as originally defined had no language statements specifically for I/O, which is common today but unique back in the late 1950s.
One interesting aspect of Algol60 was its support for two kinds of subroutine parameter passing: call-by-value and call-by-name. The call-by-name method, which allowed Algol to support a kind of dynamic scoping (a la Lisp) was supported with a slow but flexible mechanism called a thunk.
The Unisys A-series computers were built especially to run Algol, and featured a machine language based on a part of the Algol standard.

Sample code:
CODE

// the main program, calculate the mean of
// some numbers
begin
integer N;
Read Int(N);

begin
real array Data[1:N];
real sum, avg;
integer i;
sum:=0;

for i:=1 step 1 until N do
begin real val;
Read Real(val);
Data[i]:=if val<0 then -val else val
end;

for i:=1 step 1 until N do
sum:=sum Data[i];
avg:=sum/N;
Print Real(avg)
end
end


More sample code!
CODE

procedure problem (a, b);
value a, b; integer a, b;
begin integer k; real e;
for k := 2 × (a ÷ 2) 1 step 2 until b do
begin
e := if prime(k) then sqrt(3 × k sin(k))
else sqrt(4 × k cos(k));
if prime(k) then putlist(k, e, 'prime')
else putlist(k, e, 'nonprime')
end
end problem;
Cybercat
Ah, good old Algol. I had to learn Algol68 a few decades ago, but I've forgotten most of it by now.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.