Appendices

ALGOL 60 syntax cheat sheet (MARST representation), ALGOL 68 syntax cheat sheet (a68g UPPER stropping), ALGOL 60 keywords (basic symbols), ALGOL 68 bold words (Revised Report, as used by a68g), standard procedures & operators reference, history & version table, learning resources and suggested study plan (12 weeks).

Appendices

45.1 ALGOL 60 syntax cheat sheet (MARST representation) Operators: + - * / % ** (÷ is %), relations < <= = >= > !=, logic 'not' 'and' 'or' 'impl' 'equiv'.

45.2 ALGOL 68 syntax cheat sheet (a68g UPPER stropping) 45.3 ALGOL 60 keywords (basic symbols)

array begin Boolean comment do else end false for goto if integer label own procedure real step string switch then true until value while Operators and delimiters: + - × / ÷ ↑ < ≤ = ≥ > ≠ ¬ ∧ ∨ ⊃ ≡ , . ₁₀ : ; := ( ) [ ] ‘ ’ and space.

45.4 ALGOL 68 bold words (Revised Report, as used by a68g) Modes: INT REAL BOOL CHAR STRING BITS BYTES COMPL VOID FORMAT FILE CHANNEL SEMA LONG SHORT REF PROC STRUCT UNION FLEX HEAP LOC MODE

Clauses: BEGIN END IF THEN ELIF ELSE FI CASE IN OUSE OUT ESAC FOR FROM BY TO WHILE DO OD PAR EXIT GOTO GO SKIP EMPTY NIL TRUE FALSE Declarations: OP PRIO MODE PROC

Comments/pragmats: CO COMMENT PR PRAGMAT Relations and operators (bold forms): IS ISNT AND OR NOT ABS SIGN ODD ENTIER ROUND REPR LENG SHORTEN LWB UPB OVER MOD ELEM SHL SHR UP DOWN LEVEL RE IM ARG CONJ BIN I EQ NE LT LE GE GT PLUSAB MINUSAB TIMESAB DIVAB OVERAB MODAB PLUSTO

a68g additions (non-standard): ANDF ORF ANDTH OREL UNTIL DOWNTO and others — see the manual.

45.5 Standard procedures & operators reference ALGOL 60 (Revised + Modified Report) ALGOL 68 (standard prelude)

abs sign sqrt sin cos arctan ln exp entier ABS SIGN ENTIER ROUND ODD sqrt exp ln cos sin tan arccos arcsin arctan pi random OVER % MOD %* ** UP

maxint maxreal minreal epsilon (Modified) max int max real small real long max int int width bits width inchar outchar length (Modified) ABS REPR char in string

outstring outinteger outreal outterminator (Modified) print write put printf putf whole fixed float newline newpage space ininteger inreal inchar (Modified) read get readf getf channel numbers (implementation)

open establish create close associate stand in stand out stand back

on logical file end on physical file end on value error on char error on format error on page end on line end stop fault (Modified) stop (label), GOTO AND OR NOT SHL SHR ELEM BIN ABS RE IM ABS ARG CONJ I PAR SEMA LEVEL UP DOWN 45.6 History & version table Editors / designers ALGOL 58 (IAL)

Backus, Bauer, Bottenbruch, Katz, Perlis, Rutishauser, Samelson, Wegstein

Preliminary Report (CACM 1958; Perlis & Samelson, eds.) Naur (ed.) and 12 co-authors

Report on the Algorithmic Language ALGOL 60 ALGOL 60 Revised Revised Report (CACM 6(1), 1963)

"A Contribution to the Development of ALGOL" (CACM 1966) Dahl, Myhrhaug, Nygaard Common Base Language van Wijngaarden, Mailloux, Peck, Koster

Report on ALGOL 68 (Numerische Mathematik, 1969) ALGOL 68 Revised van Wijngaarden et al. (+ Sintzoff, Lindsey, Meertens, Fisker)

Revised Report (Acta Informatica 5, 1975) ALGOL 60 Modified De Morgan, Hill, Wichmann

Modified Report (Computer Journal 19(4), 1976); ISO 1538 ALGOL 68 hardware rep.

Standard Hardware Representation for ALGOL 68 Algol 68 Genie a68g manual / *Learning Algol 68 Genie* Makhorin (GNU) 45.7 Learning resources Primary documents (free online):

*Revised Report on the Algorithmic Language ALGOL 60* — P. Naur (ed.), CACM 6(1), 1963.

*Modified Report on the Algorithmic Language ALGOL 60* — De Morgan, Hill & Wichmann, 1976.

*Revised Report on the Algorithmic Language ALGOL 68* — van Wijngaarden et al., Acta Informatica 5, 1975 (also SIGPLAN Notices 12(5), 1977).

*Learning Algol 68 Genie* — Marcel van der Veer (the a68g manual and textbook, distributed with a68g).

MARST manual (info marst) — GNU.

*A Primer of ALGOL 60 Programming* — E. W. Dijkstra (1962) *ALGOL 60 Implementation* — B. Randell & L. J. Russell (1964)

*ALGOL 60 Compilation and Assessment* — B. A. Wichmann (1973)

*Informal Introduction to ALGOL 68* — C. H. Lindsey & S. G. van der Meulen (1971, revised 1977)

*A Practical Guide to ALGOL 68* — F. G. Pagan (1976) *Programming Algol 68 Made Easy* — Sian Mountbatten (free online)

*Handbook for Automatic Computation, Vol. II: Linear Algebra* — Wilkinson & Reinsch (1971), algorithms in ALGOL 60

*History of Programming Languages* (HOPL I, 1978): Perlis, "The American Side of the Development of ALGOL"; Naur, "The European Side of the Last Phase of the Development of ALGOL 60".

HOPL II (1993): C. H. Lindsey, "A History of ALGOL 68".

D. E. Knuth, "The Remaining Trouble Spots in ALGOL 60", CACM 1967.

C. A. R. Hoare, "The Emperor's Old Clothes" (Turing Award lecture, 1980).

The ALGOL Bulletin archive and the Software Preservation Group's ALGOL pages (Computer History Museum).

Practice: Rosetta Code (hundreds of tasks in ALGOL 60, ALGOL 68 and ALGOL W), the a68g example programs, and the comp.lang.misc / a68g mailing lists.

45.8 Suggested study plan (12 weeks) History, BNF; read the Revised Report on ALGOL 60

Stropping, install MARST and a68g, first programs ALGOL 60 statements — Part I exercises, Project 1

Procedures, call by name, Jensen's device, Man or Boy — Project 2

Scope and run-time stack, I/O, trouble spots, classic algorithms

ALGOL W, dialects, Simula — Part II exercises, Project 3 ALGOL 68 modes, references, coercions and contexts Clauses, rows, structures, unions

Procedures, operators, heap data structures — Project 4 Transput, parallel clauses, errors, a68g extensions — Project 5 or 7

W-grammars, classic algorithms — Part III exercises, Project 6

Influence, comparison, pitfalls — Project 8 🎓 Final Words You have traveled from a meeting of eight people in Zurich to a language defined by a grammar of infinite rules — from 'begin' and call by name to HEAP, UNION and PAR. ALGOL is rarely the language you will ship in, but it is the language that taught the rest of the field how to think: block structure, scope, recursion, formal syntax and orthogonal design. Read the Revised Reports, run the Man or Boy test, write a compiler for a little ALGOL, and you will see the ideas of ALGOL in every language you use afterwards. Happy hacking — 'end'. 🏛️

'begin'                                         'comment' a block;
    'integer' i, n;  'real' x;  'boolean' ok;   'comment' declarations first;
    'real' 'array' a[1:n], m[0:9, 0:9];
    'own' 'integer' count;
    'switch' s := L1, L2;

    'real' 'procedure' f(x, n);                 'comment' typed procedure;
        'value' x, n; 'real' x; 'integer' n;
        f := x * n;                             'comment' result: assign to the name;

    'procedure' p(v, r, e, lab);                'comment' r and e by name;
        'value' v; 'integer' v; 'real' r, e; 'label' lab;
    'begin' 'if' v < 0 'then' 'goto' lab; r := e 'end';

    x := 'if' i > 0 'then' 1.5 'else' -1.5;     'comment' conditional expression;
    'if' x > 0 'then' ok := 'true' 'else' ok := 'false';
    'for' i := 1 'step' 1 'until' 10 'do' a[i] := 0;
    'for' x := 1, x * 2 'while' x < 100 'do' outreal(1, x);
    'for' i := 2, 3, 5, 7 'do' outinteger(1, i);
    'goto' s[2];
L1: outstring(1, "one\n");
L2: outstring(1, "two\n")
'end'
BEGIN
   INT n = 10;                          # identity declaration (constant) #
   INT x := 0;                          # variable: REF INT #
   REAL r := 1.5;  BOOL b := TRUE;  CHAR c := "a";  STRING s := "text";
   [1:n] INT a;  [,] REAL m = ((1, 2), (3, 4));  FLEX [1:0] INT f;
   MODE POINT = STRUCT (REAL x, y);
   MODE NUM = UNION (INT, REAL);
   MODE NODE = STRUCT (INT v, REF NODE next);
   PROC sq = (REAL v) REAL: v * v;
   PRIO MAXOF = 6;  OP MAXOF = (INT p, q) INT: (p > q | p | q);
   REF NODE list := NIL;

   IF x > 0 THEN print("pos") ELIF x = 0 THEN print("zero") ELSE print("neg") FI;
   INT y = (x > 0 | 1 | -1);
   CASE n MOD 3 + 1 IN print("a"), print("b") OUT print("c") ESAC;
   FOR i FROM 1 BY 2 TO n WHILE i < 8 DO x +:= i OD;
   WHILE x > 0 DO x -:= 3 OD;
   NUM u := 2.5;
   CASE u IN (INT i): print(i), (REAL q): print(q) ESAC;
   list := HEAP NODE := (1, list);
   PAR (print("a"), print("b"));
   printf(($"n = "g(0)l$, n));
   print((whole(n, 0), " ", fixed(r, 0, 2), newline))
END