ArticleslgStudy

computer science

ALGOL 68-R

ALGOL 68-R is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand ALGOL 68-R rather than just read about it. In short: ALGOL 68-R was the first implementation of the Algorithmic Language ALGOL 68. In December 1968, the report on the Algorithmic Language ALGOL 68 was published.

Key takeaways

  • ALGOL 68-R belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect ALGOL 68-R to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of ALGOL 68-R from memory before moving on to harder problems.

Reference excerpt

ALGOL 68-R was the first implementation of the Algorithmic Language ALGOL 68. In December 1968, the report on the Algorithmic Language ALGOL 68 was published. On 20–24 July 1970 a working conference was arranged by the International Federation for Information Processing (IFIP) to discuss the problems of implementing the language, a small team from the Royal Radar Establishment (RRE) attended to present their compiler, written by I. F. Currie, Susan G. Bond, and J. D. Morrison. In the face of estimates of up to 100 man-years to implement the language, using multi-pass compilers with up to seven passes, they described how they had already implemented a one-pass compiler which was in production for engineering and scientific uses.

The compiler The ALGOL 68-R compiler was initially written in a local dialect of ALGOL 60 with extensions for address manipulation and list processing. The parser was written using J. M. Foster's Syntax Improving Device (SID) parser generator.

The first version of the compiler occupied 34 K words. It was later rewritten in ALGOL 68-R, taking around 36 K words to compile most programs. ALGOL 68-R was implemented under the George 3 operating system on an ICL 1907F. The compiler was distributed at no charge by International Computers Limited (ICL) on behalf of the Royal Radar Establishment (RRE).

Restrictions in the language compiled

To allow one pass compiling, ALGOL 68-R implemented a subset of the language defined in the original report:

Identifiers, modes and operators must be specified before use. No automatic proceduring Explicit VOID mode No formal declarers No parallel processing GOTO may not be omitted Uniting is only valid in strong positions Many of these restrictions were adopted by the revised report on ALGOL 68.

Specification before use To allow compiling in one pass ALGOL 68-R insisted that all identifiers were specified (declared) before use. The standard program:

PROC even = (INT number) BOOL: ( number = 0 | TRUE | odd (ABS (number - 1))); PROC odd = (INT number) BOOL: ( number = 0 | FALSE | even (ABS (number - 1)));

would have to be rewritten as:

PROC (INT) BOOL odd; PROC even = (INT number) BOOL : ( number = 0 | TRUE | odd (ABS (number - 1))); odd := (INT number) BOOL : ( number = 0 | FALSE | even (ABS (number - 1)));

To allow recursive declarations of modes (types) a special stub mode declaration was used to inform the compiler that an up-coming symbol was a mode rather than an operator:

MODE B; MODE A = STRUCT (REF B b); MODE B = [1:10] REF A;

No proceduring In the standard language the proceduring coercion could, in a strong context, convert an expression of some type into a procedure returning that type. This could be used to implement call by name. Another case where proceduring was used was the declaration of procedures, in the declaration:

PROC x plus 1 = INT : x + 1;

the right hand side was a cast of x + 1 to integer, which was then converted to procedure returning integer. The ALGOL 68-R team found this too difficult to handle and made two changes to the language. The proceduring coercion was dropped, and the form mode : expression was redefined as a procedure denotation, casts being indicated by an explicit VAL symbol:

REAL : x CO a cast to REAL in ALGOL 68 CO

REAL VAL x CO a cast to REAL in ALGOL 68-R CO

Code that had a valid use for call by name (for example, Jensen's device) could simply pass a procedure denotation:

PROC sum = (INT lo, hi, PROC (INT) REAL term) REAL : BEGIN REAL temp := 0; FOR i FROM lo TO hi DO temp +:= term (i); temp END; print (sum (1, 100, (INT i) REAL: 1/i))

In the version of the language defined in the revised report these changes were accepted, although the form of the cast was slightly changed to mode (expression).

REAL (x) CO a cast to REAL in revised ALGOL 68 CO

Explicit void mode In the original language the VOID mode was represented by an empty mode:

: x := 3.14; CO cast (x := 3.14) to void CO

PROC endit = GOTO end; CO a procedure returning void CO

The ALGOL 68-R team decided to use an explicit VOID symbol in order to simplify parsing (and increase readability):

VOID VAL x := 3.14; CO cast (x := 3.14) to void CO

PROC endit = VOID : GOTO end; CO a procedure returning void CO

This modification to the language was adopted by the ALGOL 68 revised report.

No formal declarers Formal declarers are the modes on the left hand side of an identity declaration, or the modes specified in a procedure declaration. In the original language, they could include array bounds and specified whether the matching actual declarer was fixed, FLEX or EITHER:

[ 15 ] INT a; CO an actual declarer, bounds 1:15 CO REF [ 3 : ] INT b = a; CO This is an error CO

PROC x = (REF [ 1 : EITHER] INT a) : ...

The ALGOL 68-R team redefined formal declarers to be the same as virtual declarers which include no bound information. They found that this reduced the ambiguities in parsing the language and felt that it was not a feature that would be used in working programs. If a procedure needed certain bounds for its arguments it could check them itself with the UPB (upper bound) and LWB (lower bound) operators. In ALGOL 68-R the example above could be recoded like this: (the bounds of a in the procedure would depend on the caller).

[ 15 ] INT a; CO an actual declarer, bounds 1:15 CO REF [] INT b = a [ AT 3]; CO use slice so b has bounds 3:17 CO

PROC x = (REF [] INT a) VOID: ... CO bounds given by caller CO

In the revised report on ALGOL 68 formal bounds were also removed, but the FLEX indication was moved in position so it could be include in formal declarers:

[ 1: FLEX ] INT a; CO original ALGOL 68, or ALGOL 68-R CO FLEX [ 1: ] INT a; CO revised ALGOL 68, CO

PROC x = (REF [ 1: FLEX ] INT a) : ... CO Original ALGOL 68 CO PROC x = (REF [ ] INT a) VOID: ... CO ALGOL 68-R CO PROC x = (REF FLEX [ ] INT a) VOID: ... CO Revised ALGOL 68 CO

No parallel processing In ALGOL 68 code can be run in parallel by writing PAR followed by a collateral clause, for example in:

PAR BEGIN producer, consumer END

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with ALGOL 68-R

Start with the simplest possible case. Write down what ALGOL 68-R claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to ALGOL 68-R before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about ALGOL 68-R ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of ALGOL 68-R

In research
ALGOL 68-R appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses ALGOL 68-R in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
ALGOL 68-R is common in secondary-school and first-year university syllabi. It links to neighbouring topics ALGOL 68 implementation, History of computing in the United Kingdom, so understanding it makes those chapters shorter.
In everyday life
Look for ALGOL 68-R outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “ALGOL 68-R” →

How to study ALGOL 68-R in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what ALGOL 68-R means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain ALGOL 68-R out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is ALGOL 68-R in simple terms?

ALGOL 68-R was the first implementation of the Algorithmic Language ALGOL 68. In December 1968, the report on the Algorithmic Language ALGOL 68 was published.

Why does ALGOL 68-R matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study ALGOL 68-R?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on ALGOL 68-R.

Tags

  • ALGOL 68 implementation
  • History of computing in the United Kingdom

Keep exploring