Small world! I’m working on something very similar right now, with IMP, which is very similar to Algol60 except for passing parameters by reference rather than name.
I had previously started a translation project for IMP to C that was targeted at producing readable maintainable C and did the whole stack from parsing through AST to C generation, but I had got a bit bogged down in some of the details concerning data types and pointers. So I decided, relatively recently, to pivot and work on an alternative translator of just the Imp77 variant of IMP, using the intermediate code produced by the first pass of an original-era Imp77 compiler as the starting point and not worrying as to whether the produced C was readable or maintainable. Since the intermediate code was semi-compiled to a lower level, the problems that I had got stuck on, in my high-level IMP to C, were no longer relevant.
This turned out to be a wise decision because after just a few weeks I’ve now got translations that cover the majority of language constructs and can output object code via the GCC back end for multiple architectures. Code that works and looks pretty efficient - indeed more efficient than the equivalent original era compilers could have produced.
Here’s an example extract from the VAX/VMS Imp77 compiler:
1052 key = kdict(sym)
movl 4(%ebp), %edx
movl 68(%edx), %edx
movzwl 77628(%edx,%eax,2), %edx
movswl %dx, %ecx
movl %ecx, KEY.6560@GOTOFF(%ebx)
1053 %IF key&3 = 0 %AND symtype = 2 %START; !keyword
testb $1, %dl
jne .L191
cmpl $2, SYMTYPE.6071@GOTOFF(%ebx)
je .L203
1054 %IF sym = 'C' %AND current char = nl %START; !%C...
.L191:
cmpl $67, %eax
jne .L168
movl CURRENTCHAR.6126@GOTOFF(%ebx), %eax
cmpb $10, (%eax)
jne .L168
1055 get next source char; cont = '+'; ->s1
call GETNEXTSOURCECHAR.6603
movl $43, CONT.6074@GOTOFF(%ebx)
jmp .L170
1056 %FINISH
.LVL202:
1057 %ELSE
.L202:
1058 symtype = key&3-2
andl $3, %edx
subl $2, %edx
movl %edx, SYMTYPE.6071@GOTOFF(%ebx)
.L168:
1059 %FINISH
1060 %RETURN
jmp .L168
.L203:
1061 %FINISH
I’ll put the translator on github when it’s finished and properly tested. It’s all written in C but uses some GCC language extensions to simplify code generation.
G