This document describes how to use the SNOBOL5 language and includes a reference summary for the SNOBOL5 language. Familiarity with the SNOBOL4 language is assumed. SNOBOL5 builds upon the capabilities of SNOBOL4. This manual does not attempt to teach SNOBOL5. It is only a reference to the language features and a guide for its use on 64-bit Intel architecture Windows and Linux computers. The authoritative manual, known as the "green book", for the SNOBOL4 language is entitled "The SNOBOL4 Programming Language, Second Edition," by R. E. Griswold, J. F. Poage and I. P. Polonsky, published by Prentice-Hall 1971. It can be dowloaded here. This book is out of print, however. Prentice Hall unfortunately destroyed the remaining copies without notice.
The SNOBOL5 language is primarily a string processing language, yet has all of the needed constructs to write complex programs for other applications. Some of the most powerful features of the language include string pattern matching, tables (which are really associative arrays) and programmer defined data types. SNOBOL5 is one of the few languages that permit creating new code at run time. SNOBOL5 programs often tend to require fewer statements than programs written in other languages.
The full SNOBOL5 language has been implemented except for a few noted items. The LOAD and UNLOAD functions are not currently supported. In other systems they dynamically load subroutines from libraries and can then be called from SNOBOL5 programs. I may add this capability later. SNOBOL4 originally used FORTRAN input/output facilities and incorporated FORMAT statements. The FORMAT feature has proved unneeded and thus is no longer included in SNOBOL5.
Extra features have been added which are not part of the vanilla SNOBOL4 specification. These include a few pattern elements such as MAXARB, built-in functions such as SORT, scientific routines, bit manipulation functions and several string padding functions.
This SNOBOL5 implementation
was derived from the original SNOBOL4 Implementation Language
(SIL) implementation by
Prof. Ralph E. Griswold et. al., while at Bell Telephone Laboratories.
Details about SIL and the entire SNOBOL5 implementation
are available in the book
"The Macro Implementation of SNOBOL5" by Ralph E. Griswold,
1972, W. H. Freeman and Company, also out of print.
SIL is a set of macros that generate machine assembly code. The SNOBOL interpreter
is written using these macros. So implementing them, one can port SNOBOL to
other machines with a minimum of work. In Minnesota SNOBOL4, even these SIL macros
were implemented using an underlying second interpreter, because of the memory space
limitations in those days. So Minnesota SNOBOL4 was basically and interpreter running
on another interpreter. SNOBOL5 is now implemented going directly to machine instructions
and thus is more efficient, but does use more memory. SNOBOL5 tries to let you work with
few limits on 64 bit machines. It is not built for 32 bit machines.
Strings, for example, can be many gigabytes long. However,
one must use them carefully to avoid needless performance pitfalls. SNOBOL5 implements double
precision IEEE floating point. Included is the ability to tell where NAN's (not-a-number's)
were created when they propagate through the code. An attempt has been made to use only
basic operating system calls and not require other large libraries of code.
See the section on Other References and
the end of Source Code Description for links to various useful documents.
While I (VIktors Berstis) was working at IBM, in 1981 I implemented SNOBOL4 on the
IBM SYSTEM/38 computer, of which I was one of the architects. When the IBM
Personal Computer was announced, IBM had an employee program to create software
for the new personal computer and I participated in that creating Minnesota SNOBOL4.
It ran on DOS originally and worked up through Windows XP, but was incompatible with later Windows
systems. Back then on a two diskette drive original IBM PC, it took about 9 hours of run time to create the
SNOBOL4 executable. Now, it takes just a couple of seconds! While working for IBM
I was restricted from further distributing a newer version of SNOBOL on my own. I was permitted to
distribute the Minnesota SNOBOL4 version however. Having retired from IBM, I can
now finish what I started long ago. I still use SNOBOL for many of my personal projects
such as the mundane balancing of my finances, create 3D printer files for acoustic lenses
or to help accurately edit multi-camera music
videos for posting on youtube.
Oregon SNOBOL5 is upward compatible from Minnesota SNOBOL4 except for a few minor points.
As mentioned before, FORTRAN formatting is no longer supported. An extra parameter is now used on
INPUT() and OUTPUT() functions to separate the file name from the file moodifiers. The command
line syntax has changed some to make it possible to be almost identical in Windows and Linux.
According to Dave Farber, SNOBOL was chosen as a name after hours of failure when Ralph or Ivan said
"we do not have a snobol chance in hell of finding a name." However, subconsciously, I think what
nudged "SNOBOL" as the choice was how it would
make fun of other languages at the time ending in "...OL" (standing for
"... Oriented Language") such as
COBOL and ALGOL. There was some work later on "SL5" (SNOBOL Language 5) which evolved into
the ICON programming language. It expanded on the backtracking ideas. However, ICON does not
allow new code to be generated at run time. LISP does let new code to be generated, and
it would not be all that hard to build a LISP interpreter using SNOBOL.
SPITBOL is a faster running version of SNOBOL4 but at least the old version I last used
does not allow new code to be generated at run time. Others have mentioned that SPITBOL has added
that ability along with other features, but I don't have a copy of it to examine.
One of the original goals of the
SNOBOL language was to not be concerned about computer performance, but rather give programmers
very useful and powerful capabilities, with the expectation that computers would get faster and faster over time.
You can read more about all of the history and these other versions here:
Griswold Oral History and
A History of the SNOBOL Programming Languages.
(#### anywhere this documentation indicates more to be added or changed).
Prior Page, Next Page, First Page of the Oregon SNOBOL5 Reference