On Sun, Apr 7, 2024 at 7:10 PM Dave Horsfall <dave@horsfall.org> wrote:
On Tue, 2 Apr 2024, Charles H Sauer (he/him) wrote:

[...]

> I wrote a Fortran to PL/I crude translator in SNOBOL [...]

Gadzooks...  For our "write a simple compiler" assignment I threatened to
use SNOBOL, but my lecturer (Ken Robinson) threatened to fail me :-)

Translating Fortran to PL/I is pretty straightforward.  It translates pretty much 1-for-1 except for handling character data.  One could replace Fortran's Hollerith-encoded character strings with an integer array on which a PL/I character string has been overlay defined.  Back in 1977 I translated the TOPS-10 version of the Adventure game, which was in Fortran, into PL/I so that I could run it on our batch S/370 mainframe.  I used an IBM 3277 transaction terminal as the interactive interface.  I very carefully translated the TOPS-10 Fortran into IBM PL/I line by line, except for the character data where I bit the bullet and used pure PL/I character variables.  The whole thing ran the very first time and had only one obscure bug:  instead of saying PLOVER ROOM as one did in the TOPS-10 version, you had to say PLOVERROOM.  Once that bug was fixed the PL/I version worked like a charm until we got our VAX, where I did another port of the TOPS-10 program so that it ran under VAX/VMS.  This time it stayed in Fortran, but again there was funny business with character strings because of the 36 vs. 32 bit word size.

If I were to write an automated, general Fortran-to-PL/I translator, SNOBOL would be my language of choice.

-Paul W.

-Paul W.