ArticleslgStudy

computer science

ALGOL 68RS

ALGOL 68RS 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 68RS rather than just read about it. In short: ALGOL 68RS is the second ALGOL 68 compiler written by I. F.

Key takeaways

  • ALGOL 68RS 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 68RS to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of ALGOL 68RS from memory before moving on to harder problems.

Reference excerpt

ALGOL 68RS is the second ALGOL 68 compiler written by I. F. Currie and J. D. Morrison, at the Royal Signals and Radar Establishment (RSRE). Unlike the earlier ALGOL 68-R, it was designed to be portable, and implemented the language of the Revised Report. Versions of ALGOL 68RS were written for the ICL 2900 Series, Multics, and VAX running VMS. Subsequently, parts of this compiler were released into the public domain, as a translator from ALGOL 68 to C, as part of the public release of the hardware description language ELLA, also by the RSRE.

History Although the ALGOL 68-R compiler, written by I.F. Currie, J.D. Morrison, and S.G. Bond, was a great success, it suffered from two major problems: it had been written for the nearly obsolete ICL 1900 computer, and it implemented an out-of-date version of the language as it was released before the Revised Report on ALGOL 68 was available. RSRE needed a newer compiler for various internal projects, so the team of Currie and Morrison wrote a new compiler designed for cross-platform software portability between machines. The compiler dealt with the parsing of ALGOL 68, producing a high level intermediate language known as stream language that is then compiled to machine code by a translator. The compiler needed to know only the sizes of the various object machine data types and the character encoding (set) available. The compiler was written in ALGOL 68, bootstrapped initially using the ALGOL 68-R compiler. A team of two programmers at Oxford University Computing Services wrote a code generator for the ICL 2900 series. Martyn Thomas of South West Universities Regional Computer Centre (SWURCC) arranged that this system be sponsored by International Computers Limited (ICL) and sold as an official ICL product. Later, the Avon Universities Joint Computer Centre, a large user of Multics requested the SWURCC team to produce a Multics version of ALGOL 68RS. A version for the Digital Equipment Corporation (DEC) VAX computer was also written. Eventually the team at SWURCC formed a company, Praxis, initially supporting the Multics version of ALGOL 68RS. RSRE also used the ALGOL 68RS compiler for internal projects, including the Flex machine and the ELLA hardware design language. When it was decided to make ELLA freely available, Praxis was commissioned to write an ALGOL 68 to C translator named ctrans, based on the ALGOL 68RS compiler.

Restrictions in the language compiled Like the earlier ALGOL 68-R compiler, ALGOL 68RS was a one-pass compiler, which required some restrictions on the language compiled.

Declaration before use The ALGOL 68 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 re-written 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 upcoming symbol was a mode rather than an operator:

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

Parallel processing Like ALGOL 68-R, the operators PAR clause and the SEMA mode with its associated UP, DOWN, and LEVEL, were omitted.

Extensions to ALGOL 68

Straightening One major misfeature of ALGOL 68 is that it is impossible to write the standard transput (input/output) procedures in pure ALGOL 68. The print procedure takes, for example, an array of items to print of any mode and, by a process named straightening, converts them into simple values that can be printed. For example:

STRUCT (INT a, REAL b) c := ...;

print(c); { magically transformed to print ((a OF c, b OF c)); }

The writers of ALGOL 68RS decided to make straightening available as part of the language. A STRAIGHT mode resembles an array but has the special feature that items can be coerced to a STRAIGHT mode if their components can be coerced to the mode. For example:

STRUCT (INT a, REAL b) c;

STRAIGHT UNION (INT, REAL) z = c;

Both the fields of C can be coerced to UNION (INT, REAL) so the field "a OF c" can be accessed as z[1] and "b OF c" is z[2]. The standard print procedure can now be declared as:

MODE PRINTMODE = UNION (INT, REAL, ... STRAIGHT PRINTMODE); PROC print = ([] PRINTMODE arguments ) VOID: ...;

Efficient array handling The ALGOL 68 array modes are very powerful, including multiple dimensions, defined upper and lower bounds, trimming (making a new array by taking a contiguous subset of an array), slicing (making a new array by removing one dimension from an array), and rowing (making a new array by adding a dimension to an extant array. For example:

[5:23, -7:7] INT a; { a two dimensional array } REF [,] INT b = a [ 6:21, 0:3 ] { a slice of a } REF [] INT c = a [5] { just one row of a }

While the compiler made all efforts to generate optimal code for all cases, it was felt that adding some simpler facilities would allow better code in some cases. To this end ALGOL 68RS included indexable structures (i-structs), vectors, and the FORALL statement.

Indexable structures ALGOL 68 already included fixed length structures to efficiently handle characters and bit-data on word-based machines, the BYTES and BITS modes. A BYTES variable held one machine word of characters, a BITS variable held the bits of one machine word. ALGOL 68RS generalised these ideas. A STRUCT 4 CHAR variable held exactly 4 chars. The size was part of the type. On most ALGOL 68RS systems, the mode BYTES was equivalent to STRUCT 4 CHAR.

MODE BYTES = STRUCT 4 CHAR; OP ELEM = (INT index, BYTES val) CHAR: val[index]; ... BYTES b = "abcd"; ... print (2 ELEM b);

The ALGOL 68RS compiler would compile any string constant to an appropriate STRUCT n CHAR. In contexts where a VECTOR or array was wanted, an i-struct could be widened to the appropriate VECTOR or array type.

Vectors A VECTOR is a simplified array, with only one dimension and a lower bound fixed at 1.

VECTOR [4] INT a; { similar to [1:4] INT a; }

In any context where an array was required a VECTOR could be converted to an array.

FORALL statement The FORALL statement allows efficient stepping through the elements of an array.

[12] INT a := ...;

FORALL xa IN a DO xa := xa * 2 OD

xa will be a reference to each element of a in turn. FORALL can step through multiple arrays in parallel, and be controlled by a WHILE clause:

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with ALGOL 68RS

Start with the simplest possible case. Write down what ALGOL 68RS 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 68RS 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 68RS 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 68RS

In research
ALGOL 68RS 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 68RS 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 68RS 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 68RS 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 68RS” →

How to study ALGOL 68RS in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what ALGOL 68RS 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 68RS out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is ALGOL 68RS in simple terms?

ALGOL 68RS is the second ALGOL 68 compiler written by I. F.

Why does ALGOL 68RS 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 68RS?

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 68RS.

Tags

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

Keep exploring