Tuesday, July 04, 2006

My first high-level language: Algo

Bendix Computer Division produced one of the first implementations of a language in the Algol family. The Algo system for the G-15 was based on Algol 58. It was a three-pass compiler [1] that produced code for a virtual machine rather similar to Intercom 1000.

Due to memory limitations, intermediate data between passes of the Algo compiler had to be punched out on paper tape and then read back in for the next pass. So to compile and run a program the user needed to:
0) Punch the source program on paper tape (online or offline).
1) Place the cassette [2] for pass 1 in the tape reader and boot it.
2) Replace the cassette by the source program and read it in.
3) Remove the output of pass 1 from the tape punch.
4) Replace the source program tape by the cassette for pass 2 and boot it.
5) Replace the cassette by the output of pass 1 and read it in.
6) Remove the output of pass 2 from the tape punch.
7) Replace the intermediate tape by the cassette for pass 3 and boot it.
8) Replace the cassette by the output of pass 2 and read it in.
9) Remove the output of pass 3 (the compiled program) from the tape punch.
10) Replace the intermediate tape by the cassette for the interpreter and boot it.
11) Repace the cassette by the compiled program, read it in, and begin execution.

For a really short program, this could take as little as 15 minutes. Of course, to run a previously-compiled program, only steps 10 and 11 were needed.

My first attempt to use Algo was for a VIP demonstration in the DPL. Milton Barber and I started work the night before [3] on an example to illustrate how "without a special knowledge of programming for electronic computers, anyone with a background of high school Algebra may express a program in the Algo language for the G-15 computer."

I no longer remember what program we were trying to write, but it was probably something simple enough to explain to our audience, like finding the roots of a quadratic equation. We fed our first program in, and 15 minutes later discovered that it didn't work. We consulted the manual and the cryptic diagnostics, found a problem, thought we fixed it, fed that program in, discovered it didn't work, either. (Lather, rinse, repeat.)

By 10:00 the next morning, with a 2:00 deadline looming, we gave up on Algo, wrote the program in machine language, debugged it, and had it ready for the demo. I doubt that the VIPs would have understood the importance of algebraic notation for programming, even if we could have made it work.

Oh, yes. This was also the last program I wrote in Algo.

Notes:
[1] The names of two of the passes have stuck with me: LYZER/LATER and RATOR/CATOR.
[2] Because of the unruliness of rolls of punched paper tape, frequently-used programs were stored in aluminum cassettes rather like oversized versions of today's magnetic tape cassettes.
[3] Even then it was accepted that programmers work better at night and under pressure.