All languages

ALGOL languagehistorical

The language that fixed the shape of the imperative language: block structure, nested lexical scope, typed declarations, recursive procedures, and the first syntax specified in BNF. Call-by-name and `own` variables were its distinctive risks; every later block-structured language descends from it.

Overview

ALGOL is the algorithmic language defined by an international committee in 1958 and revised through 1960, reported by Peter Naur. It established structured, block-based imperative programming and was the first language whose syntax was specified in BNF, making a language definition a reproducible artifact.

Code

begin
  integer p, q;
  real s;
  p := 7; q := 3;
  s := p / q;    comment real division, 2.333;
  p := p ÷ q;    comment integer division, 2;
  s := 2 ↑ 8;    comment exponentiation, 256;
  if p > q then s := 1 else s := 0
end
begin … end brackets a compound statement; with declarations it becomes a block, and its identifiers are local. Note ÷ for integer division and ↑ for exponentiation — and that a comment runs to the next semicolon, not the line.

Distinctive traits

  • Block structure with nested lexical scope: a block automatically introduces a new level of nomenclature, and a name undeclared inside refers to the enclosing level.
  • The grammar itself was defined in BNF, introduced for ALGOL 60 — the first language whose specification and parser were the same document.
  • Call by name replaces the formal parameter with the actual parameter text throughout the body, which is expressive but makes evaluation order observable.
  • own variables keep their value across block re-entry, while ordinary locals are undefined on entry.
  • Types are integer, real and Boolean, with array bounds as runtime expressions and automatic entier transfer from real to integer.
  • Control flow includes goto alongside if/else and the for statement — the structured forms are present, but jumps are not yet excluded.

Status

Historical. ALGOL 60 had no single dominant implementation, but ISO standardized it: ISO/R 1538 (1972, withdrawn 1977) and the revised ISO 1538:1984. It survives through its descendants and as a specification artifact, with the Revised Report still the readable definition.

History

Two reports preceded the 1960 language: the 1958 Zürich preliminary report on the International Algebraic Language, and the 1959 report edited by Perlis and Samuelson. Thirteen delegates met in Paris in January 1960 and adopted Naur's draft as the basis; the Revised Report followed in 1963 and a Modified Report in 1976. ALGOL 60 was never commercially dominant, but its ideas reached Pascal, SIMULA and Ada directly.

Sources & references