3 ms·
The original implementation of SNOBOL was broken into 2 parts, the actual SNOBOL interpreter and the runtime support. The interpreter is written in a "machine
by br14 3y ago
The original implementation of SNOBOL was broken into 2 parts, the actual SNOBOL interpreter and the runtime support. The interpreter is written in a "machine language" called SIL (SNOBOL Implementation Language), and the runtime support was typically a mishmash of assembly code that interfaced with the operating system and typically some high level language's libraries (e.g. the 360 version of SNOBOL used FORTRAN's io libraries). SIL itself was meant to be a set of assembly macros. One would implement the individual macros, run an assembler and "poof" you had a SNOBOL interpreter.
SPITBOL was a response to a comment that "SNOBOL could never be compiled". The original SPITBOL implementation was on the IBM 360 (and the source code is in the linked repository). There is a 370 version of the code (basically it's just the updated version of the 360 code) that is laying around on the internet. (I have a copy of that code and at some point am planing on adding it to the above github collection).
After the IBM Mainframe versions of SPITBOL, Dr Robert Dewar came up with a portable version of SPITBOL called MACRO SPITBOL which like SNOBOL, used an abstract machine language that one can process into some native machine language. The abstract machine instructions are called MINIMAL. Again the layout of a SPITBOL compiler is the compiler source code (a huge monolithic chunk of code), a set of programs that translate the MINIMAL statements into some targeted machine code and the os interface code which is again a mishmash of some assembly code that interfaces with the operating system and some other language's runtime libraries (e.g. for the x86_64 the os interface code is written in C and uses some of C's runtime).
Internally SPITBOL has 2 phases. The first phase reads and processes SNOBOL statements and compiles the statements into an internal executable with what is basically a JIT compiler. The 2nd phase is the execution of the internal executable. MACRO SPITBOL itself doesn't create a standalone object file that could be linked and executed (though the 360/370 could).
Part of the reason for not creating a traditional object file is that the SNOBOL language has 2 functions, EVAL and CODE which allows one to write dynamic code. Both of these functions require the use of the parsing and code evaluation used during the phase 1 stage.
One interesting thing that Dr Dewar came up with was an interpreter for the MINIMAL statements, MICRAL. The process here was to translate the MINIMAL statements into a compact binary format and a simple interpreter that read that binary format.