Reading the report on the first Algol 60 compiler in the world, namely the Dijkstra-Zonneveld ALGOL 60 compiler for the Electrologica X1, which contains the Pascal source faithfully reproducing its behavior (that is, interpreting the input stream using Friden Flexowriter encoding), allowed a friend of mine and myself to bring it to life in the XXI century, making it read ASCII/UTF-8, with not much effort.
The code it generates can be partially understood, thanks to the "OPC table" in the report (Appendix D, page 329 of the PDF). Everything looks reasonable, except one thing: strings to be printed appear as bare literals before the opcode of the "print" function:
_b_e_g_i_n
print(|<Hello Algol|>);
_e_n_d
becomes
10144 96 = OPC START
10145 1379884 = 'l' 'e' 'H'
10146 6101013 = ' ' 'o' 'l'
10147 1053989 = 'g' 'l' 'A'
10148 16717080 = \377 'l' 'o'
10149 103 = OPC print
10150 97 = OPC STOP
That is problematic, as the characters 0
to 9
were encoded as 0 to 9, then 'a' to 'z' as 10 to 35, then A
to Z
as 37 to 62, etc, most coinciding with meaningful OPC codes.
Therefore, for example, an occurrence of c00
as the first 3 characters in a literal string to be printed (or passed as a parameter to a procedure), should be interpreted as
12 RET RETURN
Initially, when the procedure fill_result_list
is called, which adds a word to the object code being formed, there is a difference between procedural OPC codes (>=8) and OPC codes (<= 3) denoting literals and instructions with various levels of relocation required for its address field. But, when the memory contents of the post-relocation binary are printed at the very end of the execution, the difference between procedural OPC and a piece of a string with two zero characters is lost.
Was it indeed a case of "If it does not work, just don't do it", or our understanding of the way the X1 Algol threaded code worked is incomplete?