Algol 68 tutorials
Algol 68 is a statically typed, expression-oriented programming language designed by IFIP Working Group 2.1. It was published in 1968 and revised in 1973; the Revised Report remains the definition of the language. Algol 68 is known for its orthogonal design: a small set of concepts, applied consistently, covers modes, arrays with flexible bounds, structures, unions, references, formatted transput, and parallel processing.
Algol 68 Genie
The examples in these tutorials run with Algol 68 Genie
(a68g), a compiler-interpreter by Marcel van der Veer that
implements nearly all of the Revised Report. On Debian and Ubuntu it is
installed with the algol68g package. Genie parses a program,
interprets it, and can also translate it to C for compilation with the system
C compiler.
Getting started
The introduction covers the history and design of the language and shows how to install and run Algol 68 Genie. The basics tutorial starts with declarations and printing, then moves on to conditionals, loops, and procedures.
Language
The program structure article
describes units and clauses, including serial, collateral, conditional, and
case clauses. The modes article surveys the
primitive modes and the rows and structures built from them, and the
variables article explains references,
aliases, and the LOC and HEAP generators.
Expressions and syntax
The literals article covers every form a
value can take in the source text. The
operators article explains the nine
priorities and how a program declares operators of its own, and the
coercions article describes the automatic
conversions between modes. The stropping
article explains why keywords are written in upper case, and
conditionals covers IF and
CASE clauses.
Control flow and data
The loops article covers FOR,
WHILE, and DOWNTO, together with labels and
GO TO. The procedures article
explains parameter and result modes, recursion, and procedure values, while
strings treats text as a row of characters.
The rows article describes fixed and
multidimensional rows, and
flexible rows shows how a row changes
its bounds. String processing applies
those ideas to text: counting words, splitting a line, trimming spaces, and
reading comma-separated fields.
Values and storage
The structures article groups fields of
different modes into one value, and the unions
article lets a value hold one of several modes, with a case clause to read it.
The references and the heap article explains
storage that outlives a clause and builds a linked list from it, while
bits covers masks and shifts and the
complex numbers article covers the arithmetic
of COMPL.
Input and output
The unformatted transput article
covers print, write, and put and the
default layout of each mode, and
formatted transput explains format
denotations, their frames, and the replicators. The
reading input article shows
read and get on the standard input, the
files article opens and reads files of a
program's own, and
command-line arguments reads
the words that a script receives from its caller.
Programs and the system
The environment and processes
article reads environment variables, runs commands, and measures processor
time, and the regular expressions
article searches and replaces text with the two procedures that Algol 68 Genie
adds.
The TCP/IP sockets article talks to a
server with tcp request, and the
parallel clause article runs units at
the same time and protects shared variables with semaphores.
Algorithms
The recursion article writes procedures that call themselves: factorials, Fibonacci numbers with and without memoisation, the towers of Hanoi, Euclid's algorithm, and fast exponentiation. Sorting covers insertion sort, quicksort, and merge sort, and searching covers the linear and binary searches and a hash table. Linked lists builds nodes on the heap and adds, removes, and reverses them, and stacks, queues and trees turns the same pieces into a stack, a queue, and a binary search tree. Hash tables hashes string keys with linear probing, grows the table at a load factor, and counts the words of a sentence.
Numbers, dates, and errors
The number formatting article uses
whole, fixed, and float to lay out a
table and converts integers to other bases and to Roman numerals.
Big integers raises the precision of the
long modes until 100 factorial fits, and
date and time reads
localtime, measures processor time, and converts dates to day
numbers. Random numbers rolls dice,
draws a histogram, and shuffles a row, and
error handling covers exit statuses,
assertions, value-error handlers, and --check.
Tools and practice
The debugging article reads a runtime
report, adds a stack backtrace, traces a run, and drives the interactive
debugger with breakpoints and watchpoints.
Listings and pretty printing turns on the
.f and .l files and walks through the tree, mode,
and prelude reports. Unit testing builds
a harness that counts checks and returns a non-zero status, and
scripts and compilation covers shebangs,
PR read, -O2, and the runtime checks that compiling
removes. A calculator builds a
recursive-descent parser from a grammar, porting
C pairs ten C programs with their Algol 68 versions, and the
style guide collects the conventions used
throughout the series.
Language features
Algol 68 has a mode for every value: integers, reals, complex numbers, booleans, characters, bit strings, arrays, structures, unions, procedures, files, and formats. Values are declared with their mode and can be referred to through references, which are allocated on the heap and reclaimed by a garbage collector. Formatted transput is part of the language rather than a library, so a program describes its output with format denotations enclosed in dollar signs.
These forty-eight tutorials cover the language from the first program to the debugger, the test harness, and the compiled run. Each article is self-contained, and every example is run with Algol 68 Genie 2.8.4 before its output is shown.
last modified November 14, 2026