3 ms·
Spitbol 360: an implementation of SNOBOL4 for IBM 360 compatible computers
- br14 3y agoThe 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.
- Turing_Machine 3y agoThere's probably an alternate timeline where we went down the SNOBOL road for pattern matching rather than going with regexes. I believe SNOBOL pattern matching is more powerful than classic regexes, though I don't know that holds for modern regex extensions.
- Animats 3y agoDefinitely more powerful than regular expressions. Too powerful. You can easily write useful patterns in SNOBOL which generate exponential time searches, because search can back up and try a different route. Regular expressions are the linear-time subset of SNOBOL patterns.
- kelsey9876543 3y agoBeautiful to see some s/360 code on github, refreshing ngl
- dwheeler 3y agoOne of the authors of this was Robert Dewar. He was a computing genius and an awesome person. Another story about him is here: https://dwheeler.com/essays/make-it-simple-dewar.html https://dwheeler.com/essays/make-it-simple-dewar.html
- guerby 3y agoAnd spitbol still lives in GCC/GNAT https://gcc.gnu.org/onlinedocs/gnat_rm/GNAT-Spitbol-g-spitbo-ads.html https://gcc.gnu.org/onlinedocs/gnat_rm/GNAT-Spitbol-g-spitbo... https://github.com/gcc-mirror/gcc/blob/master/gcc/ada/libgnat/g-spitbo.ads https://github.com/gcc-mirror/gcc/blob/master/gcc/ada/libgna... https://github.com/gcc-mirror/gcc/blob/master/gcc/ada/libgnat/g-spitbo.adb https://github.com/gcc-mirror/gcc/blob/master/gcc/ada/libgna...