ALGOL 68
Adapted from Wikipedia · Discoverer experience
ALGOL 68 (short for Algorithmic Language 1968) is an imperative programming language that was created to be a successor to the ALGOL 60 language. It was designed to have a much wider range of uses and to have very clear rules for how it should work.
Because the rules for ALGOL 68 were very complex and filled with special words, it was hard to create tools that could understand the language. Even though some people said nobody used it, ALGOL 68 did find a few places where it was helpful, especially in the United Kingdom on machines made by International Computers Limited, and in teaching.
Even though ALGOL 68 wasn’t used everywhere, it had a big effect on computer science. Many ideas from ALGOL 68 showed up later in other languages. Languages like Pascal were made partly because they thought ALGOL 68 was too hard to use, and many languages from the 1970s took some ideas from ALGOL 68 but left out the parts that were too tricky. Today, most modern languages get some of their rules from ALGOL 68, either directly or through languages like C or Pascal.
Overview
ALGOL 68 was a programming language designed to be more powerful and flexible than its predecessor, ALGOL 60. It included many advanced features like user-defined types, string and array handling, and support for concurrent tasks.
The language was created by the International Federation for Information Processing and officially adopted in December 1968. It was defined using a special kind of grammar that made its rules very clear and complete. However, because of its complexity, it was challenging to build tools that could understand and use the language properly. Some experts felt it was too complicated compared to simpler languages like C and Pascal. The first working version of ALGOL 68 was created in 1970, and it was later used in some specific areas, especially in teaching and certain types of computers.
History
ALGOL 68 was designed to be an updated version of the ALGOL language from 1960. A group called the International Federation for Information Processing started working on it. They wanted to create a language that could be used for many different purposes and was easier to understand.
Creating ALGOL 68 was a long and difficult process. Many smart people worked on it, but they often disagreed. The final version was completed after five years of hard work. Even then, some people thought the language was too complicated.
The first version of ALGOL 68 was created in 1970 in the United Kingdom. It was used on special computers and became popular for certain jobs, like coding for the military. Other versions of ALGOL 68 were made later for different types of computers, mostly for teaching students about programming.
| Year | Event | Contributor |
|---|---|---|
| March 1959 | ALGOL Bulletin Issue 1 (First) | Peter Naur / ACM |
| February 1968 | Draft Report(DR) Published | IFIP Working Group 2.1 |
| March 1968 | Algol 68 Final Reportr0 Presented at Munich Meeting | IFIP Working Group 2.1 |
| June 1968 | Meeting in Tirrenia, Italy | IFIP Working Group 2.1 |
| Aug 1968 | Meeting in North Berwick, Scotland | IFIP Working Group 2.1 |
| December 1968 | ALGOL 68 Final Reportr0 Presented at Munich Meeting | IFIP Working Group 2.1 |
| April 1970 | ALGOL 68-R under GEORGE 3 on an ICL 1907F | Royal Signals and Radar Est. |
| July 1970 | ALGOL 68 for the Dartmouth Time-Sharing System | Sidney Marshall |
| September 1973 | Algol 68 Revised Reportr1 Published | IFIP Working Group 2.1 |
| 1975 | ALGOL 68C(C) – transportable compiler (zcode VM) | S. Bourne, Andrew Birrell, and Michael Guy |
| June 1975 | G. E. Hedrick and Alan Robertson. The Oklahoma State ALGOL 68 Subset Compiler. 1975 International Conference on ALGOL 68. | |
| June 1977 | Strathclyde ALGOL 68 conference, Scotland | ACM |
| May 1978 | Proposals for ALGOL H – A Superlanguage of ALGOL 68 | A. P. Black, V. J. Rayward-Smith |
| 1984 | Full ALGOL 68S(S) compiler for Sun, SPARC, and PCs | C. H. Lindsey et al, Manchester |
| August 1988 | ALGOL Bulletin Issue 52 (last) | Ed. C. H. Lindsey / ACM |
| May 1997 | Algol68 S(S) published on the internet | Charles H. Lindsey |
| November 2001 | Algol 68 Genie(G) published on the internet (GNU GPL open source licensing) | Marcel van der Veer |
| January 2025 | GCC Front-End (GNU GPL) | Jose E. Marchesi |
Notable language elements
Bold symbols and reserved words
ALGOL 68 had about sixty special words, often shown in bold in books. Some of these words had short symbols to use instead:
MODE, OP, PRIO, PROC, FLEX, HEAP, LOC, LONG, REF, SHORT, BITS, BOOL, BYTES, CHAR, COMPL, INT, REAL, SEMA, STRING, VOID, CHANNEL, FILE, FORMAT, STRUCT, UNION, AT "@", EITHERr0, IS ":=:", ISNT IS NOTr0 ":/=:" ":≠:", OF "→"r0, TRUE, FALSE, EMPTY, NIL "○", SKIP "~", CO "¢", COMMENT "¢", PR, PRAGMAT, CASE ~ IN ~ OUSE ~ IN ~ OUT ~ ESAC "( ~ | ~ |: ~ | ~ | ~ )", FOR ~ FROM ~ TO ~ BY ~ WHILE ~ DO ~ OD, IF ~ THEN ~ ELIF ~ THEN ~ ELSE ~ FI "( ~ | ~ |: ~ | ~ | ~ )", PAR BEGIN ~ END "( ~ )", GO TO, GOTO, EXIT "□"r0.
Units: Expressions
The basic part of a program in ALGOL 68 is called a unit. A unit can be a formula, a small group of commands, a routine, or one of several special commands (like setting a value, jumping, or doing nothing). When special words are used, the opposite word often ends the group, like ( IF ~ THEN ~ ELSE ~ FI, CASE ~ IN ~ OUT ~ ESAC, FOR ~ WHILE ~ DO ~ OD ). This way of writing was used later in common Unix Bourne shell programs. An expression can also give a group of values, made from other values by a small group of commands. This looks like calling a group of values a procedure.
mode: Declarations
The basic data types (called modes in Algol 68) are real (numbers with decimals), int (whole numbers), compl (complex number), bool (true or false), char (single characters), bits and bytes. For example:
INT n = 2; CO n is fixed as a constant of 2. CO INT m := 3; CO m is a newly created local variable whose value is initially set to 3. CO CO This is short for ref int m = loc int := 3; CO REAL avogadro = 6.0221415⏨23; CO Avogadro number CO long long real long long pi = 3.14159 26535 89793 23846 26433 83279 50288 41971 69399 37510; COMPL square root of minus one = 0 ⊥ 1;
However, the declaration **REAL** x; is just syntactic sugar for **REF** **REAL** x = **LOC** **REAL**;. That is, x is really the constant name for a reference to a newly made local REAL variable.
ALGOL 68 also lets you add extra details to types, so you can write LONG REAL instead of double, for example. The prelude constants max real and min long int help adjust programs for different uses.
All variables need to be named, but you don’t have to name them before you first use them.
Coercions: casting
The coercions change a value to fit what is needed based on three rules: what the value is before changing, what it needs to be after changing, and where it is used in the program. Coercions can be used one after another.
There are six types of coercions: deproceduring, dereferencing, uniting, widening, rowing, and voiding. Each coercion, except uniting, changes the values in a certain way. This means many basic actions can be done simply by using coercions.
pr & co: Pragmats and Comments
Pragmats are special notes in the program, usually tips for the computer; in newer languages, these are called "pragmas". For example:
PRAGMAT heap=32 PRAGMAT PR heap=32 PR
Comments can be added in many ways:
¢ The original way of adding your thoughts to a program ¢ COMMENT "bold" comment COMMENT CO Style i comment CO
Style ii comment
£ This is a hash/pound comment for a UK keyboard £
Usually, comments can’t be placed inside each other in ALGOL 68. But you can use different comment signs to get around this (like using hash only for temporary code).
Expressions and compound statements
Since ALGOL 68 is an expression-oriented programming language, the value from an assignment statement is a reference to where the value is stored. So, the following is valid ALGOL 68 code:
REAL half pi, one pi; one pi := 2 * ( half pi := 2 * arc tan(1) )
This idea is also in C and Perl, among others. Like in earlier languages such as Algol 60 and FORTRAN, spaces are allowed in names, so half pi is a single name (avoiding the need for underscores versus camel case versus all lower-case).
As another example, to add up f(i) from i=1 to n, the following ALGOL 68 integer expression works:
(INT sum := 0; FOR i TO n DO sum +:= f(i) OD; sum)
Because it’s an integer expression, this group of commands can be used anywhere an integer value is needed. A group of commands gives the value of the last command it runs; this idea is also in Lisp, among other languages.
Groups of commands end with special closing signs:
- IF choice clauses:
IF condition THEN commands [ ELSE commands ] FI "short" form: ( condition | commands | commands )
IF condition1 THEN commands ELIF condition2 THEN commands [ ELSE commands ] FI "short" form: ( condition1 | commands |: condition2 | commands | commands )
This way of writing not only avoids problems with nested IF statements but also means you don’t need to use **BEGIN** and **END** inside statement groups.
- CASE choice clauses:
CASE choice IN commands, commands,... [ OUT commands ] ESAC "short" form: ( choice | commands,commands,... | commands )
CASE choice1 IN commands, commands,... OUSE choice2 IN commands, commands,... [ OUT commands ] ESAC "short" form of CASE statement: ( choice1 | commands,commands,... |: choice2 | commands,commands,... | commands )
Example with Short symbols:
PROC days in month = (INT year, month)INT: (month| 31, (year÷×4=0 ∧ year÷×100≠0 ∨ year÷×400=0 | 29 | 28 ), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 );
Example with Bold symbols:
PROC days in month = (INT year, month)INT: CASE month IN 31, IF year MOD 4 EQ 0 AND year MOD 100 NE 0 OR year MOD 400 EQ 0 THEN 29 ELSE 28 FI, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ESAC;
Example mixing Bold and Short symbols:
PROC days in month = (INT year, month)INT: CASE month IN ¢Jan¢ 31, ¢Feb¢ ( year MOD 4 = 0 AND year MOD 100 ≠ 0 OR year MOD 400 = 0 | 29 | 28 ), ¢Mar¢ 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ¢ to Dec. ¢ ESAC;
ALGOL68 allowed the choice to be either INT or (uniquely) UNION. The latter lets you make sure UNION variables follow strong rules. See union below for an example.
- do loop clause:
[ FOR index ] [ FROM first ] [ BY increment ] [ TO last ] [ WHILE condition ] DO commands OD The shortest form of a "loop clause" is: DO commands OD
This was thought of as the "universal" loop, and the full form is:
FOR i FROM 1 BY -22 TO -333 WHILE i×i≠4444 DO ~ OD
The loop has several unusual points:
- only the DO ~ OD part is required, which means the loop will run forever.
- so the clause TO 100 DO ~ OD, will only run 100 times.
- the WHILE part lets a programmer stop a FOR loop early. For example:
INT sum sq:=0; FOR i WHILE print(("So far:",i,newline)); sum sq≠70↑2 DO sum sq+:=i↑2 OD
Later versions of the ALGOL 68 standard let the TO part be replaced with UPTO and DOWNTO for a small improvement. The same computers also added:
- UNTIL(C) – for stopping a loop later.
- FOREACH(S) – for working on arrays together.
More examples can be found in the code examples below.
struct, union & [:]: Structures, unions and arrays
ALGOL 68 supports arrays with any number of parts, and it lets you take whole or partial rows or columns.
MODE VECTOR = [1:3] REAL; # vector MODE declaration (typedef) # MODE MATRIX = [1:3,1:3]REAL; # matrix MODE declaration (typedef) # VECTOR v1 := (1,2,3); # array variable initially (1,2,3) # []REAL v2 = (4,5,6); # constant array, type equivalent to VECTOR, bounds are implied # OP + = (VECTOR a,b) VECTOR: # binary OPerator definition # (VECTOR out; FOR i FROM ⌊a TO ⌈a DO out[i] := a[i]+b[i] OD; out); MATRIX m := (v1, v2, v1+v2); print ((m[,2:])); # a slice of the 2nd and 3rd columns #
Matrices can be sliced either way, for example:
REF VECTOR row = m[2,]; # define a REF (pointer) to the 2nd row # REF VECTOR col = m[,2]; # define a REF (pointer) to the 2nd column #
ALGOL 68 supports multiple field structures (STRUCT) and united modes. Reference variables can point to any MODE including array slices and structure fields.
For an example of all this, here is the traditional linked list declaration:
MODE NODE = UNION (VOID, REAL, INT, COMPL, STRING); MODE LIST = STRUCT (NODE val, REF LIST next);
proc: Procedures
Procedure (PROC) declarations need type details for both the inputs and the result (VOID if none):
PROC max of real = (REAL a, b) REAL: IF a > b THEN a ELSE b FI;
or, using the "short" form of the choice statement:
PROC max of real = (REAL a, b) REAL: (a>b | a | b);
The result of a proc is the value of the last command in the procedure. References to procedures (ref proc) are also allowed. Call-by-reference inputs are given by using references (like **ref real**) in the list of formal inputs. The following example makes a procedure that uses a function (given as an input) to each part of an array:
PROC apply = (REF [] REAL a, PROC (REAL) REAL f): FOR i FROM LWB a TO UPB a DO a[i] := f(a[i]) OD
This simple way of writing code wasn’t possible in ALGOL 68’s predecessor ALGOL 60.
op: Operators
The programmer can make new operators and both these and the ones already there can be changed and their order can be set by the coder. The following example makes operator **MAX** with both two-part and one-part versions (going through the parts of an array).
PRIO MAX = 9; OP MAX = (INT a,b) INT: ( a>b | a | b ); OP MAX = (REAL a,b) REAL: ( a>b | a | b ); OP MAX = (COMPL a,b) COMPL: ( ABS a > ABS b | a | b ); OP MAX = ([]REAL a) REAL: (REAL out := a[LWB a]; FOR i FROM LWB a + 1 TO UPB a DO ( a[i]>out | out:=a[i] ) OD; out)
transput: Input and output
Transput is the name for ALGOL 68’s input and output. It includes ready-made commands for simple, detailed and binary input and output. Files and other input/output places are handled in the same way, no matter the computer. The following example prints some simple output to the standard output place:
print ((newpage, "Title", newline, "Value of i is ", i, "and x[i] is ", x[i], newline))
Note the ready-made commands newpage and newline used as inputs.
Books, channels and files
The TRANSPUT is thought of as BOOKS, CHANNELS and FILES:
- Books are made of pages, lines and characters, and may be saved by files.
- A special book can be found by name with a call to
match.
- A special book can be found by name with a call to
- CHANNELs match real devices. For example, card readers and printers.
- Three normal channels are: stand in channel, stand out channel, stand back channel.
- A FILE is how a program talks to a book that has been opened through a channel.
- The MOOD of a file can be read, write, char, bin, and opened.
- transput commands include:
establish, create, open, associate, lock, close, scratch. - position questions:
char number, line number, page number. - layout commands include:
space,backspace,newline,newpage.get good line, get good page, get good book, and**PROC** set=(**REF** **FILE** f, **INT** page,line,char)**VOID**:
- A file has event commands. For example:
on logical file end, on physical file end, on page end, on line end, on format end, on value error, on char error.
formatted transput
"Formatted transput" in ALGOL 68’s input/output has its own way of writing and patterns (functions), with FORMATs between two $ signs.
Examples:
printf (($2l"The sum is:"x, g(0)$, m + n)); ¢ prints the same as: ¢ print ((new line, new line, "The sum is:", space, whole (m + n, 0))
par: Parallel processing
ALGOL 68 lets you write programs that can do many things at once. Using the word PAR, a small group of commands becomes a parallel group, where how the actions work together is managed using semaphores. In A68G the parallel actions are turned into threads when possible on the computer’s operating system. In A68S a different way of doing parallel processing was used (see below).
PROC eat = VOID: ( muffins-:=1; print(("Yum!",new line))), speak = VOID: ( words-:=1; print(("Yak...",new line))); INT muffins := 4, words := 8; SEMA mouth = LEVEL 1; PAR BEGIN WHILE muffins > 0 DO DOWN mouth; eat; UP mouth OD, WHILE words > 0 DO DOWN mouth; speak; UP mouth OD END
Miscellaneous
For its complicated details, ALGOL 68 needs many ways to say that something doesn’t exist:
SKIP, "~" or "?"C – an undefined value that is always correct in writing, EMPTY – the only value for VOID, needed to choose VOID in a UNION, VOID – written like a MODE, but not one, NIL or "○" – a name that doesn’t mean anything, of an unknown reference mode, () or especially [1:0]INT – a vacuum is an empty array (here especially of MODE []INT). undefined – a standards report command that causes a problem at running time. ℵ – Used in the standards report to stop introspection of some types. For example SEMA
The word NIL IS var always gives TRUE for any variable (but see above for the right way to use IS :/=:), while it’s not known what value a comparison x n | NIL | cons(m, f(m+1,n))); f(1,n)); MODE LIST = REF NODE; MODE NODE = STRUCT (INT h, LIST t); PROC cons = (INT n, LIST l) LIST: HEAP NODE := (n,l); PROC hd = (LIST l) INT: ( l IS NIL | error("hd NIL"); SKIP | h OF l ); PROC tl = (LIST l) LIST: ( l IS NIL | error("tl NIL"); SKIP | t OF l ); PROC show = (LIST l) VOID: ( l ISNT NIL | print((" ",whole(hd(l),0))); show(tl(l))); PROC filter = (PROC (INT) BOOL p, LIST l) LIST: IF l IS NIL THEN NIL ELIF p(hd(l)) THEN cons(hd(l), filter(p,tl(l))) ELSE filter(p, tl(l)) FI; PROC sieve = (LIST l) LIST: IF l IS NIL THEN NIL ELSE PROC not multiple = (INT n) BOOL: n MOD hd(l) ~= 0; cons(hd(l), sieve( filter( not multiple, tl(l) ))) FI; PROC primes = (INT n) LIST: sieve( tl( one to(n) )); show( primes(100) ) END
Operating systems written in ALGOL 68
- Cambridge CAP computer – All commands making the operating system were written in ALGOL 68C, although several other closely linked protected commands, like a memory manager, are written in BCPL.
- Eldon 3 – Made at Leeds University for the ICL 1900 was written in ALGOL 68-R.
- Flex machine – The hardware was special and could be changed by software, with an operating system, (separate) compiler, editor, memory cleaner and file system all written in ALGOL 68RS. The command line Curt was made to work with types like Algol-68 modes.
- VME – S3 was the way the operating system VME worked. S3 was based on ALGOL 68 but with types and commands changed to match what the ICL 2900 Series could do.
Note: The Soviet Era computers Эльбрус-1 (Elbrus-1) and Эльбрус-2 were made using high-level language Эль-76 (AL-76), rather than the normal computer commands. Эль-76 looks like Algol-68, The main change is the dynamic binding types in Эль-76 worked with the computer’s commands. Эль-76 is used for programs, job control, system programming.
Applications
Both ALGOL 68C and ALGOL 68-R are written in ALGOL 68, which means ALGOL 68 was used to make itself. Other uses include:
- ELLA – a way to describe hardware and a set of tools. Made by the Royal Signals and Radar Establishment during the 1980s and 1990s.
- RAF Strike Command System – "... 400K of correct ALGOL 68-RT code was made with three years of work. ..."
Libraries and APIs
- NAG Numerical Libraries – a software library of numerical analysis commands. Given in ALGOL 68 during the 1980s.
- TORRIX – a way to work with groups of numbers and shapes over any number system and of changing size by S. G. van der Meulen and M. Veldhorst.
Context | Context location | Coercions available | Coercion examples in the context | ||||
|---|---|---|---|---|---|---|---|
Soft | Weak | Meek | Firm | Strong | |||
Strong | Right hand side of: Identity-declarations, as "~" in: REAL x = ~ Initialisations, as "~" in: REAL x := ~ Also: Actual-parameters of calls, as "~" in:PROC: sin(~) Enclosed clauses of casts, as "~" in: REAL(~) Units of routine-texts Statements yielding VOID All parts (but one) of a balanced clause One side of an identity relation, as "~" in: ~ IS ~ | deproceduring | All SOFT then weak dereferencing (dereferencing or deproceduring, yielding a name) | All WEAK then dereferencing (dereferencing or deproceduring) | All MEEK then uniting | All FIRM then widening, rowing or voiding | Widening is always applied in the INT to REAL to COMPL direction, provided the modes have the same size. For example: An INT will be coerced to a REAL, but not vice versa. Examples: to REAL from INT to COMPL from REAL to []BOOL from BITS to []CHAR from BYTES A coercend can also be coerced (rowed) to a multiple of length 1. For example: to INT from INT to REAL from REAL etc. |
Firm | Operands of formulas as "~" in:~ OP ~ Parameters of transput calls | Example: UNION(INT,REAL) var := 1 | |||||
Meek | Trimscripts (yielding INT) Enquiries: e.g. as "~" in the following IF ~ THEN ... FI and FROM ~ BY ~ TO ~ WHILE ~ DO ... OD etc Primaries of calls (e.g. sin in sin(x)) | Examples: to BOOL from REF REF BOOL to INT from REF REF REF INT | |||||
Weak | Primaries of slices, as in "~" in: ~[1:99] Secondaries of selections, as "~" in: value OF ~ | Examples: to REF INT from REF REF INT to REF REAL from REF REF REF REAL to REF STRUCT from REF REF REF REF STRUCT | |||||
Soft | The LHS of assignments, as "~" in: ~ := ... | Example: deproceduring of: PROC REAL random: e.g. random | |||||
| Algol68r0 as in the 1968 Final Report | Algol68r1 as in the 1973 Revised Report |
|---|---|
| NODE n := "1234"; REAL r; INT i; COMPL c; STRING s CASE r,i,c,s::=n IN print(("real:", r)), print(("int:", i)), print(("compl:", c)), print(("string:", s)) OUT print(("?:", n)) ESAC | NODE n := "1234"; # or n := EMPTY; # CASE n IN (VOID): print(("void:", "EMPTY")), (REAL r): print(("real:", r)), (INT i): print(("int:", i)), (COMPL c): print(("compl:", c)), (STRING s): print(("string:", s)) OUT print(("?:", n)) ESAC |
| PRIOrity | Operation r0&r1 | +Algol68r0 | +Algol68G |
|---|---|---|---|
| Effectively 12 (Primary) | dereferencing, deproceduring(~,~), subscripting[~], rowing[~,], slicing[~:~], size denotations LONG & SHORT | proceduring | currying(~,,,), DIAG, TRNSP, ROW, COL |
| Effectively 11 (Secondary) | OF (selection), LOC & HEAP (generators) | → (selection) | NEW (generators) |
| PRIOrity (Tertiary) | Algol68 "Worthy characters"r0&r1 | +Algol68r0&r1 | +Algol68C,G | +Algol68r0 |
|---|---|---|---|---|
| 10 | NOT ~, UP, DOWN, LWB, UPB, -, ABS, ARG, BIN, ENTIER, LENG, LEVEL, ODD, REPR, ROUND, SHORTEN | ¬, ↑, ↓, ⌊, ⌈ | NORM, TRACE, T, DET, INV | LWS, UPS, ⎩, ⎧, BTB, CTB |
| PRIOrity (Tertiary) | Algol68 "Worthy characters"r0&r1 | +Algol68r0&r1 | +Algol68r0 |
|---|---|---|---|
| 9 | +*, I | +×, ⊥ | ! |
| 8 | SHL, SHR, **, UP, DOWN, LWB, UPB | ↑, ↓, ⌊, ⌈ | ××, ^, LWS, UPS, ⎩, ⎧ |
| 7 | *, /, %, OVER, %*, MOD, ELEM | ×, ÷, ÷×, ÷*, %×, □ | ÷: |
| 6 | -, + | ||
| 5 | LT, LE, >=, GE, >, GT | ≤, ≥ | |
| 4 | EQ =, NE ~= /= | ≠, ¬= | |
| 3 | &, AND | ∧ | /\ |
| 2 | OR | ∨ | \/ |
| 1 | MINUSAB, PLUSAB, TIMESAB, DIVAB, OVERAB, MODAB, PLUSTO, -:=, +:=, *:=, /:=, %:=, %*:=, +=: | ×:=, ÷:=, ÷×:=, ÷*:=, %×:= | MINUS, PLUS, DIV, OVERB, MODB, ÷::=, PRUS |
| PRIOrity (Quaternaries) | Algol68 "Worthy characters"r0&r1 | +Algol68r0&r1 | +Algol68C,G,R | +Algol68r0 |
|---|---|---|---|---|
| Effectively 0 | :=, IS :=:, ISNT :/=: :~=:, AT @, ":", ";" | :≠: :¬=: | :=:=C, =:=R | ..=, .=, CT, ::, CTAB, ::=, .., is not, "..", ".," |
Program representation
ALGOL 68 had many ways to write programs. In its strictest form, programs were written as a set of symbols, like a recipe. These symbols could be shown in many different styles depending on what was needed.
Some styles were used in books, using special printing to show bold words and symbols clearly. Other styles were used in actual computer programs, where the computer could only use simple letters and numbers. There were also styles meant for the computer to read directly, using binary code.
For example, the word begin could be shown as begin in a book, BEGIN in a computer program, or as special bytes in binary code. ALGOL 68 allowed programmers to use words from their own language when writing programs.
The language had special rules to help it work on different computers, choosing characters that were widely supported. Some early computers did not have all the letters we use today, so ALGOL 68 had ways to work around those limits.
| Representation | Code |
|---|---|
| Algol68 as typically published | ''¢ underline or '' ''bold typeface ¢'' '''mode''' '''xint''' = '''int'''; '''xint''' sum sq:=0; '''for''' i '''while''' sum sq≠70×70 '''do''' sum sq+:=i↑2 '''od''' |
| Quote stropping (like wikitext) | 'pr' quote 'pr'
'mode' 'xint' = 'int';
'xint' sum sq:=0;
'for' i 'while'
sum sq≠70×70
'do'
sum sq+:=i↑2
'od'
|
| For a 7-bit character code compiler | PR UPPER PR
MODE XINT = INT;
XINT sum sq:=0;
FOR i WHILE
sum sq/=70*70
DO
sum sq+:=i**2
OD
|
| For a 6-bit character code compiler | .PR POINT .PR
.MODE .XINT = .INT;
.XINT SUM SQ:=0;
.FOR I .WHILE
SUM SQ .NE 70*70
.DO
SUM SQ .PLUSAB I .UP 2
.OD
|
| Algol68 using RES stropping (reserved word) | .PR RES .PR
mode .xint = int;
.xint sum sq:=0;
for i while
sum sq≠70×70
do
sum sq+:=i↑2
od
|
| Algol68 using SUPPER stropping (GNU extension) | mode Int = int;
Int sum sq:=0;
for i while
sum sq ≠70×70
do
sum sq+:=i↑2
od
|
| Name | Year | Purpose | State | Description | Target CPU | Licensing | Implementation language |
|---|---|---|---|---|---|---|---|
| Generalized ALGOL | 1962 | Scientific | ALGOL for generalised grammars | ||||
| ALGOL YY | 1966 | Draft proposal | Intl | First version of ALGOL 68 | Specification | ACM | |
| ALGOL 68DR | 1968 | Draft proposal | Intl | IFIP WG 2.1 Draft Report | Specification – March | ACM | |
| ALGOL 68r0 | 1968 | Standard | Intl | IFIP WG 2.1 Final Report | Specification – August | ACM | |
| ALGOL 68-RR | 1970 | Military | ICL 1900 | ALGOL 60 | |||
| EPOS ALGOLE | 1971 | Scientific | |||||
| ALGOL 68RSRS | 1972 | Multi-purpose | Portable compiler system | ICL 2900/Series 39, Multics, VMS & C generator (1993) | Crown Copyright | ALGOL 68RS | |
| ALGOL 68 with areas | 1972 | Experimental & other | Areas added to ALGOL 68 | ||||
| Mini ALGOL 68 | 1973 | Research | Interpreter for ALGOL 68 subset | Portable interpreter | Mathematisch Centrum | ALGOL 60 | |
| OREGANO | 1973 | Research | "The importance of implementation models." | UCLA | |||
| ALGOL 68CC | 1975 | Scientific | Cambridge ALGOL 68 | ICL, IBM 360, PDP-10 & Unix, Telefunken, TESLA 200, Z80 (1980) | Cambridge | ALGOL 68C | |
| ALGOL 68 Revised Reportr1 | 1975 | Standard | Intl | IFIP WG 2.1 Revised Report | Specification | ACM | |
| ALGOL HH | 1975 | Experimental & other | Proposed extensions to ALGOL 68 mode system | Specification | ALGOL W | ||
| Odra ALGOL 68 | 1976 | practical uses | Odra 1204/IL | Soviet | ALGOL 60 | ||
| Oklahoma ALGOL 68 | 1976 | programming instruction | Oklahoma State University implementation | IBM 1130 and System/370/158 | Unknown | ANSI Fortran 66. | |
| Berlin ALGOL 68 | 1977 | Research | Portable compiler for System/370, Siemens S4004, and PDP-11 | Machine-independent compiler | Technische Universität Berlin | CDL 2 | |
| FLACCF | 1977 | Multi-purpose | Revised Report complete implementation with debug features | System/370 | lease, Chion Corporation | Assembler | |
| ALGOL 68-RTRT | 1979 | Scientific | Parallel ALGOL 68-R | ||||
| RS Algolrs | 1979 | Scientific | |||||
| ALGOL 68+ | 1980 | Scientific | Proposed superlanguage of ALGOL 68 | ||||
| M-220 ALGOL 68 | M-220 | Soviet | EPSILON | ||||
| Leningrad ALGOL 68L | 1980 | Telecommunications | Full language + modules | IBM, DEC, CAMCOH, PS 1001 & PC | Soviet | ||
| Interactive ALGOL 68I | 1983 | Incremental compilation | PC | Noncommercial shareware | |||
| ALGOL 68SS | 1985 | Scientific | Intl | Sun version of ALGOL 68 | Sun-3, Sun SPARC (under SunOS 4.1 & Solaris 2), Atari ST (under GEMDOS), Acorn Archimedes (under RISC OS), VAX-11 under Ultrix-32 | ||
| ALGOL68toC (ctrans) | 1985 | Electronics | ctrans from ELLA ALGOL 68RS | Portable C generator | Open-source (1995) | ALGOL 68RS | |
| MK2 Interactive ALGOL 68 | 1992 | Incremental compilation | PC | Noncommercial shareware | |||
| ALGOL 68 GenieG | 2001 | Full language | Includes standard collateral clause | Portable interpreter | GPL | C | |
| ALGOL 68 Genie version 2.0.0 | 2010 | Full language | Portable interpreter; optional compilation of selected units | GPL | C | ||
| GCC (ga68) | 2025 | Full language | GCC Front-End | Portable compiler | GPL | C++ |
Quotes
- ... The scheme of type composition adopted by C owes considerable debt to Algol 68, although it did not, perhaps, emerge in a form that Algol's followers would approve of. The central idea I took from Algol was a type structure based on basic types (including structures), combined into arrays, references, and procedures. Algol 68's idea of unions and conversions also influenced later work. Dennis Ritchie Apr 1993.
- ... While C does not come from Algol 68, there was influence, much of it so subtle that it is hard to notice even when I try hard. In particular, the idea of a union type (added later to C) comes from Algol 68, not in details, but in the idea of having such a type. More deeply, the general type structure and even, in a strange way, the declaration format (the type-building part) was inspired by Algol 68. And yes, of course, "long". Dennis Ritchie, 18 June 1988
- "Congratulations, your Master has done it" – Niklaus Wirth
- The more I see of it, the more unhappy I become – E. W. Dijkstra, 1968
- [...] it was said that Algol 68's popularity was inversely related to [...] the distance from Amsterdam – Guido van Rossum
- [...] The best we could do was to send with it a minority report, stating our view that, "... as a tool for creating reliable programs, the language was a failure." [...] – C. A. R. Hoare in his Oct 1980 Turing Award Lecture
- "[...] More than ever it will be needed from a good programming tool that it helps, by its structure, the programmer in the hardest parts of the work, namely in creating reliable programs. In this respect we do not see how the language proposed here is a big step forward: instead, we feel that its view of the programmer's work is much the same as, say, ten years ago. This leads us to conclude that, as a programming tool, the language must be seen as outdated. [...]" 1968 Working Group minority report on 23 December 1968.
Related articles
This article is a child-friendly adaptation of the Wikipedia article on ALGOL 68, available under CC BY-SA 4.0.
Safekipedia