This question is prompted by a related one by texdr.aft. It turns out that the Revised report on Algol-60 allowed numeric labels (3.5.1, page 15),

<label> ::= <identifier> | <unsigned integer>

as opposed to the later Modified Report (3.5.1, page 17),

<label> ::= <identifier>

The rationale for the eventual restriction is quoted from the question referred above:

Here is what Dahlstrand, Goteborg, and Naur have to say about this in Algol Bulletin AB10.3.

The admission of integers as labels will produce some peculiar possibilities, like the following:

procedure Pop(Q); procedure Q; beginQ(3); … end;
procedure Pip(A); label A; begingo to A; … end;
procedure Pap(B); real B; beginqB; end;

Evidently the number 3 appearing within the body of procedure Pop will in the first of these two procedure statements be used as a number, while in the second it will be used as a label.

We do not want to suggest any formal change of the language, since in spite of the peculiarity the above example is well defined. On the other hand we do want to disrecommend the use of integers in labels in actual programs. We would like to see them die from disuse. That we do not accept them in our translators goes without saying.

There is a retro-compiler which accepts the code demonstrating the possibility (Algol-BESM-6):

   1.   _BEGIN
   3.  _BEGIN Q(3); _END;
   6.  _BEGIN _GOTO A; _END;
   9.  _BEGIN OUTPUT(‘T’, ‘INTEGER ’, ‘ZD’, B) _END;
  11.  POP(PAP);
  12.  _IF _FALSE _THEN 3: OUTPUT(‘T’, ‘ LABEL 3’) _ELSE POP(PIP);
  13.  _END

prints INTEGER 3 LABEL 3.

A recent implementation of Algol-60, MARST specifically mentions that the supported language revision is according to the Modified Report, and errors out with invalid use unsigned integer `3' as a label

Another example, from a Donald Knuth's paper is compiled successfully by the Algol-BESM-6 compiler, but some error checks are missing:

   1.   _BEGIN _PROCEDURE P(Q); _IF B(Q) _THEN G(Q);
   2.  _PROCEDURE G(Q); _GOTO Q;
   3.  _BOOLEAN _PROCEDURE B(Q); B := Q < 5;
   4.  P(3);
   5.  OUTPUT(‘T’, ‘--- ’);
   6.  1: OUTPUT(‘T’, ‘ONE ’);
   7.  2: OUTPUT(‘T’, ‘TWO ’);
   8.  3: OUTPUT(‘T’, ‘THREE ’);
   9.  4: OUTPUT(‘T’, ‘FOUR’);
  10.  OUTPUT(‘/’);
  11.  _END

works and prints THREE FOUR, P(2) would print TWO THREE FOUR, etc. (P(5) or greater would print --- ONE TWO THREE FOUR). However, P(0) would compile but crash at runtime, as well as P(1+1), etc.

Is there another surviving Algol-60 compiler for any of the Western computers which is a) based on the Revised Report, thus allows numeric labels, and b) is able to compile the peculiar construct correctly?

  • 1
    Not an answer, but I was browsing the Algol Bulletins. AB19.1.2 mentions Alcor Illinois 7090 as being the full language 'except for own'. The user manual does not mention integer labels one way or another. And of course the key attribute was "extant", about which I have doubts. Jul 13 '21 at 0:57
  • @another-dave Faute de mieux, any published evidence of a compiler able to support the construct in question would be accepted.
    – Leo B.
    Jul 13 '21 at 1:20
  • The problems with numeric labels are discussed in great detail in Donald Knuth's "The remaining trouble spots in in Algol 60". This isn't an answer, but the paper provides a more explicit rationale for not implementing the feature.
    – texdr.aft
    Jul 13 '21 at 1:25
  • @texdr.aft Thanks! The Algol BESM-6 compiler seems to handle at least some of the constructs described there.
    – Leo B.
    Jul 13 '21 at 2:08
  • 1
    @LeoB. - at the time, it seems they were still figuring out the difference between open subroutines and closed subroutines. The Algol 60 procedure is somewhere in between, because of the way it is described,. From memory, IAL (Algol 58) had open subroutines via the do mechanism, Jul 13 '21 at 12:26

The Algol 60 compiler for the Electrologica X8 was such an implementation. One of its authors wrote a report describing the differences between the X8 compiler and an earlier Algol compiler for the Electrologica X1, which did not support numeric labels; section 5.2.6 discusses how labels and designational expressions in general were handled.

The X8 compiler was written in Algol 60, and its source code survives in the form of a truly gorgeous listing, presumably produced by a Flexowriter.

  • Incidentally, the code uses the names sub and bus for [ and ]. I would assume this was influenced by Algol 68, which uses the same terminology, but the X8 compiler predates the development of Algol 68. Were “sub” and “bus” common names at the time?
    – texdr.aft
    Jul 13 '21 at 2:07
  • The listing is gorgeous indeed. Theoretically, the compiler can be revived by implementing an interpreter (thus, the X8 compiler is almost extant). Unfortunately, the list of error messages appears to be missing. I had some doubts about originality of the BESM-6 compiler because its Russian error messages are unusually verbose, compared to terse messages of other compilers, and the phrasing of some messages is unnatural, suggesting calquing from another language. If it is so, the source was not the X8 compiler: I've experimented with a test case on page 21 of the PDF and got only one error.
    – Leo B.
    Jul 13 '21 at 6:33
  • @texdr.aft This is just a guess. Presumably there would have been a working committee for Algol68 prior to 1968 and the idea of statements ending with the keywords spelt backwards were thrown around at that time. It is possible that one of the people in the committee was involved with the X8 compiler.
    – cup
    Jul 13 '21 at 12:48
  • @LeoB. There is a list of errors in this manual: ir.cwi.nl/pub/9203
    – texdr.aft
    Jul 13 '21 at 13:21
  • @LeoB. Actually, I think it is fully extant, since in the comparison report I linked to the author describes measurements he made running the compiler on an emulator (which is, however, unfortunately not publicly available).
    – texdr.aft
    Jul 13 '21 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.