Preamble
As Algol-60 had no reserved words, the language keywords had to be specially marked, e.g. prefixed with an underscore with a trailing space or semicolon (_begin _integer i;i:=42_end
), or enclosed in quotes ('begin''real'pi;pi:=3.14'end'
), or made distinct from regular identifiers in some other way. Note that in both cases all unnecessary spaces are deliberately omitted in those two examples.
I have two Algol-60 compilers working. One uses quotes for keywords and considers them as atomic tokens.
The other, dated 1st of May 1979, uses the underscore as a "mode switch" character up to the next non-alphabetical symbol, so one underscore at the beginning of a keyword is enough, but extra underscores don't hurt:
1. _BE__GIN_ _I_N_T_EGER_ I;
2. I:=42; OUTPUT(‘Z’, I) _EN_D
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
42.000000
That being said, it follows that writing _BEGIN_INTEGER
will not fly: an error "В ЯЗЫКЕ НЕТ СЛОВА BEGININTEGER", translated as "THERE IS NO WORD BEGININTEGER IN THE LANGUAGE" will follow.
Note that an underscore before a space character does not hurt either. However, any space in the middle of a keyword will result in the pieces considered as separate keywords:
1. _BE _GIN _END
СТРОКА 1
В ЯЗЫКЕ НЕТ СЛОВА BE
СТРОКА 1
В ЯЗЫКЕ НЕТ СЛОВА GIN
GOTOs
Now, to the point. I had a vague recollection that Algol-60 allowed two ways to write the GOTO operator. Indeed, according to Algol 60 syntax versions, the Revised Report (1963) prescribes goto, whereas the Modified Report (1976) prescribes go to.
The compiler which uses quotes, dated 25th of January 1979, only allows 'GOTO'
. Nothing to see there, moving along.
The other behaves as follows:
_BEGIN _GOTO L; L:_END
naturally, works, as does
1. _BEGIN ____G_O_____T_O____ L; L:_END
as well as various other combinations of extra underscores; but
1. _BEGIN _GO
2. _TO L; L:_END
works just as well, to satisfy both variants of the syntax.
For a final experiment, what would an error message be for _BEGIN _GO _FOR L; L:_END
?
Somewhat unexpectedly, the compiler produces В ЯЗЫКЕ НЕТ СЛОВА GO
("there is no word GO in the language").
Question
If there is absolutely no semantic difference between the two spellings of the GOTO operator, why bother implementing both? Or, to start with, why bother introducing ambiguity in the standard, forcing the compiler writers to waste valuable machine words to support somebody's pet peeve? (Those two were rhetorical, do not attempt to flag the question "opinion-based".)
I'm hoping there is a captivating story of heated discussions related to the space in "goto"/"go to" somewhere in the memoirs of the authors of the language, or their interviews. Is there?
PS. The Electrologica X1 compiler by Dijkstra/Zonneveld (1960) uses an "optimistic" parsing mechanism: begin goto a; a: end (which could be shortened to be g a; a: en) produces the expected
023640 1 0000000140 START
023641 1 0522023642 GOTO 023642 A
023642 1 0000000141 STOP
whereas begin go to a; a: end results in a bizarre
023640 1 0000000140 START
023641 1 0522023643 GOTO 023643 A
023642 1 0000000075 MUL
023643 1 0000000141 STOP
with a stray multiplication opcode, which happens to be absolutely harmless, as it would never be executed. Thus it appears that the first Algol-60 compiler happened to accept both variants of the "go to" statement by chance.