kids encyclopedia robot

ALGOL 68-R facts for kids

Kids Encyclopedia Facts
Quick facts for kids
ALGOL 68R
Original author(s) I. F. Currie, Susan G. Bond, J. D. Morrison
Developer(s) Royal Radar Establishment
Initial release July 20, 1970; 54 years ago (1970-07-20)
Written in ALGOL 60 (original)
ALGOL 68-R (latter)
Operating system George 3
Platform ICL 1907F
Size 34 K words
Available in English
Type Compiler, translator
License Freeware

ALGOL 68-R was a very important computer program. It was the first working version of a new computer language called ALGOL 68.

In December 1968, the rules for the ALGOL 68 language were published. In July 1970, a special meeting was held to talk about how to build programs that could understand and run this new language. A small team from the Royal Radar Establishment (RRE) showed off their program, which was called a compiler. It was created by I. F. Currie, Susan G. Bond, and J. D. Morrison.

Other experts thought it would take many years and a huge team to create such a program. But the RRE team had already built a working compiler that could read the new language and turn it into instructions for the computer. Their program was already being used for science and engineering tasks!

How the Compiler Worked

The ALGOL 68-R compiler was first written using an older computer language called ALGOL 60. It also had some special additions to help it manage computer memory and lists of information. A special tool called a parser generator helped build the part of the compiler that understood the language's rules.

About 20K of this is program, which we feel is too large.

– Currie

The first version of the compiler took up about 34,000 "words" of computer memory. (A "word" is a unit of memory, like a small chunk of data). Later, the compiler was rewritten using the ALGOL 68-R language itself. This newer version took up a bit more space, around 36,000 words.

ALGOL 68-R ran on a special computer called an ICL 1907F. It used an operating system called George 3. The compiler was given away for free by International Computers Limited (ICL) on behalf of the RRE.

Making the Language Simpler

It is a question of morality. We have a Bible and you are sinning!

– Mailloux

To make the compiler work faster and simpler, the ALGOL 68-R team made some small changes to the ALGOL 68 language. These changes meant the compiler could read and understand the code in just one pass. Many of these changes were later adopted in the official updated rules for ALGOL 68.

Here are some of the main changes:

  • Say what you mean first: You had to tell the computer about all your names, types of data, and special actions (operators) before you used them.
  • No automatic "proceduring": This made it clearer how certain parts of the code worked.
  • Clear "empty" type: They added a special word, VOID, to show when something didn't return a value.
  • Simpler declarations: How you described data types in some parts of the code was made less complicated.
  • No running things at the same time: The original language allowed parts of a program to run at the same time (parallel processing). This was not included in ALGOL 68-R.
  • Don't forget "GOTO": The word GOTO (which tells the program to jump to another part of the code) could not be left out.
  • Joining types carefully: Combining different types of data (like a number and a true/false value) was only allowed in specific, clear situations.

Declaring Things Before You Use Them

To make the compiler work in one pass, ALGOL 68-R required that all names (identifiers) be "declared" (told to the computer) before they were used.

For example, if you had two actions (procedures) that called each other, like "even" and "odd" numbers, you had to first tell the computer that "odd" existed before defining "even":

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)));

This made it easier for the compiler to understand the code as it read through it.

No Automatic "Proceduring"

In the original ALGOL 68, the language could sometimes automatically turn an expression (like "x + 1") into an action (procedure). The ALGOL 68-R team found this tricky to handle.

They made two changes:

  • This automatic turning into a procedure was removed.
  • They made it clearer when you were defining an action versus just changing a data type.

For example, to change a number to a real number, you had to use VAL:

REAL VAL x CO this changes x to a real number in ALGOL 68-R CO

These changes were later accepted in the updated ALGOL 68 language.

Explicit "VOID" Type

In the original language, if an action didn't return any value, it was shown by an empty space. The ALGOL 68-R team decided to use a clear word, VOID, for this. This made the code easier to read and simpler for the computer to understand.

For example, an action that just jumps to another part of the code would be written as:

PROC endit = VOID : GOTO end; CO a procedure that doesn't return a value CO

This change was also adopted in the updated ALGOL 68 rules.

No Parallel Processing

The original ALGOL 68 language allowed parts of a program to run at the same time. This is called "parallel processing." For example, one part could be making data while another part was using it.

This feature was not included in the first ALGOL 68-R compiler. However, a special version called ALGOL 68-RT was later created. It allowed programs to run multiple tasks at once, similar to how modern computers use "threads." This was done by changing how the program ran, not by changing the compiler itself.

"GOTO" Must Be Used

In the original ALGOL 68, you could sometimes leave out the word GOTO when telling the program to jump to another section.

For example: IF x > 3 THEN stop FI; CO this was a jump, not a call CO

Because ALGOL 68-R was a one-pass compiler (meaning it read the code once from start to finish), this was too hard to manage. So, the word GOTO was made required. This same rule was also used in an official simpler version of the language called ALGOL 68S.

The F00L Value

The ALGOL 68-R compiler did something interesting: it filled any unused computer memory with a specific number: -6815700.

This number was chosen because:

  • It was a very large negative number.
  • If treated as a memory address, it was far beyond any real memory location on the ICL 1900 computer.
  • If treated as a computer instruction, it was an illegal command.
  • When seen as text, it looked like the word "F00L".
  • As a floating-point number, it showed an "overflow" error.

This same "F00L" value was also used to represent "nothing" or "NIL" in the program.

Stropping: How Computers Read Code

I notice, in some of your sample programs, that you are not underlining or stropping anything.

– Mailloux

In computer languages like ALGOL, it's important to tell the difference between special words (like "BEGIN" or "IF") and names that a programmer makes up (like "myVariable"). In books, these special words were often printed in bold or underlined.

For computer code, a technique called "stropping" was used. Before ALGOL 68-R, special words were often put in single quotes, like 'begin'. But in ALGOL 68-R, special words were written in uppercase letters, while names made by the programmer used lowercase letters.

At first, writing programs for ALGOL 68-R was tricky. The computers used a limited set of characters. Programs often had to be typed on special paper tape using a Friden Flexowriter. Based on the experience with ALGOL 68-R, the updated ALGOL 68 rules later officially allowed using uppercase letters for special words.

Extra Features in ALGOL 68-R

ALGOL 68-R also added some useful features that weren't in the original language. These included ways to compile different parts of a program separately and to access the computer's hardware more directly.

Separate Compiling

ALGOL 68 is a "strongly typed" language. This means it's very strict about how different types of data are used. Because of this, the usual ways of sharing code between programs on the ICL 1900 system weren't enough.

ALGOL 68-R came with its own system for sharing code. This allowed programmers to share data types, actions (functions), variables, and special operations between different "segments" of code. These segments could be stored in "albums."

A part of the program that you wanted to share would end with a list of things to make available:

graphlib CO the segment name CO BEGIN MODE GRAPHDATA = STRUCT ( ... ); MODE GRAPH = REF GRAPHDATA; PROC new graph = ( ... ) GRAPH : ...; PROC draw graph = (GRAPH g) VOID : ...; ... END KEEP GRAPH, new graph, draw graph FINISH

Then, another part of the program could use these shared actions:

myprog WITH graphlib FROM graphalbum BEGIN GRAPH g = new graph (...); ... draw graph (g); ... END FINISH

Low-Level System Access

As a "high-level" language, ALGOL 68 usually stops programs from directly touching the computer's inner workings. For example, it doesn't have ways to do math with memory addresses.

But ALGOL 68-R needed to let programmers do things that would normally require a very basic language called assembly language. So, they added ways to write machine instructions directly into the ALGOL 68-R code. They also added special actions like INC, DEC, DIF, and AS to help manage memory addresses.

Availability

You can still find a copy of the ALGOL 68-R compiler today! It can run using a special program that pretends to be the old George 3 operating system. This copy, along with its source code (the original instructions), is available for free under a GNU General Public License (GPL). David Holdsworth from the University of Leeds made this possible.

kids search engine
ALGOL 68-R Facts for Kids. Kiddle Encyclopedia.