This manual page describes CSNOBOL4, a port of the original Bell Telephone Labs (BTL) Macro Implementation of SNOBOL4 to the C language.
The language and its implementation are described in [Griswold1971] and [Griswold1972].
For command line options see snobol4cmd(1).
Extensions from Catspaw SNOBOL4+, SPITBOL and SITBOL have been added, see snobol4ext(1).
Includes BLOCKS (SNOBOL4B) extensions, see snobol4blocks(1).
The following behaviors have been changed from the original Macro SNOBOL4 in ways that might effect old programs:
- INTEGER errors
INTEGER overflow does not cause expression failure.
- Listings are disabled by default
Default listing side (when enabled by -LIST or the -l command line option is LEFT. Listings are directed to standard error (or file specified by the -l command line option.
The the startup banner and statistics (if enabled) are directed to standard error.
Compilation error messages (including erroneous lines) appear on standard error. Error messages reference the source file name and line number.
- Character set
- INPUT() and OUTPUT()
FORTRAN formats are not used to control I/O. The 3rd argument to the OUTPUT() and INPUT() functions is interpreted as a string of I/O options, The 4th argument is used to specify a file name, see snobol4io(1) for details.
- PUNCH variable
The PUNCH output variable no longer exists, the TERMINAL variable has been added in it's place, see snobol4io(1).
- Statement separator
Control lines and comment characters are valid after the (;) statement separator. Listing statement numbers show the statement number of the LAST statement on the line (rather than the first).
&STLIMIT defaults to -1, see snobol4key(1).
VALUE tracing applies to variables modified by immediate value assignment ($ operator) and value assignment (. operator) during pattern matching.
Further additions are documented in snobol4ext(1).
snobol4(1) is 8-bit clean, and uses the native character set. Any 8-bit byte is accepted as a SNOBOL datum or in a string constant of a SNOBOL source program. The value of the SNOBOL protected keyword &ALPHABET is a 256-character string of all bytes from 0 to 255, in ascending order.
On ASCII-based systems, any character with the 8th bit set is treated as “alphabetic”, and can start, or be used in identifiers and labels. This includes characters from the “upper half” of national character sets and all bytes resulting from the UTF-8 encoding of Unicode characters. Include file utf.sno implements pattern matching functions for UTF-8 sequences.
Programs may be entered in mixed case; By default lower case identifiers are folded to upper case (see &CASE and -CASE). Case folding is performed by using the C library islower(3) test, and then using toupper(3) to convert the lower-case characters to upper case. When using UTF-8 encoded characters in code, case folding should be disabled, to prevent any bytes which appear to be lower case in the current locale from being modified.
The following operator character sequences are permitted and represent a cross between PDP-10 Macro SNOBOL, SITBOL and Catspaw SPITBOL usage:
Both square brackets () and angle brackets (<>) may be used to subscript arrays and tables. The TAB (ASCII 9) character is accepted as whitespace.
Underscore (_) and period (.) are legal within identifiers and labels.
Note that the use of the pound sign for comments allows use of the script interpreter (hash-bang) sequence at the top of a file marked as executable: “#!/usr/local/bin/snobol4” or “#!/usr/bin/env snobol4”
See snobol4op(1) for operators.
Directory Search List
A directory search list is used for files specified in -INCLUDE directives and LOAD() function calls, and is constructed from:
1. The current working directory (“.”).
2. Any directories specified on the command line using -I options, in the order specified.
3a. Directories from the the SNOPATH environment variable (see below), if defined.
3b. If SNOPATH is not defined, the SNOLIB environment variable (or a compiled in default) is used as base to add the following directories:
The LOAD() function will also check for the file in shared subdirectory in each directory in the search path.
If set to a non-null value, all stdio output will be unbuffered, and will be written immediately.
Is a list of directories delimited by colons (semi-colons on VMS and Windows) appended to the Directory Search List (see above).
SNOLIB is used to establish the base libary path if SNOPATH is not defined. See Directory Search List above. SNOLIB was the sole search directory in versions of CSNOBOL4 prior to version 1.5.
Is a list of source files delimited by colons (semi-colons on VMS and Windows) that will be read before the program source. Using SNOBOL_PRELOAD_PATH will make your code less portable.
All things SNOBOL4 related.
Catspaw: commercial SPITBOL implementations, Free SNOBOL4+ for DOS.
SNOBOL4 language tutorial (from Catspaw Vanilla SNOBOL4)
R. E. Griswold, J. F. Poage, and I. P. Polonsky, The SNOBOL4 Programming Language, 2nd ed., Prentice-Hall Inc., 1971. (aka the “green book”) http://www.regressive.org/snobol4/docs/books.html#green
R. E. Griswold, The Macro Implementation of SNOBOL4, W. H. Freeman and Co., 1972. Book describing the implementation techniques used in Macro SNOBOL4. http://www.regressive.org/snobol4/docs/books.html#macro
Catspaw Vanilla SNOBOL4 manual.
Catspaw Macro SPITBOL manual
Algorithms in SNOBOL4, James F. Gimpel, Wiley, New York, 1976.
Ralph E. Griswold, James F. Poage, Ivan P. Polonsky, et al (Macro SNOBOL4)
Philip. L. Budne (CSNOBOL4)
Mark Emmer (code from SNOBOL4+)
Viktors Berstis (code from Minnesota SNOBOL4)
James F. Gimpel (SNOBOL4B)
I/O is still tied to unit numbers.
I/O retains some record oriented flavor (maximum line length on input).
“Dynamic” storage cannot be expanded after startup.
Integer math can never fail, even on overflow.
Oversize integer constants may not be detected.
sdb(1), snobol4base64(3), snobol4blocks(1), snobol4cmd(1), snobol4ctrl(1), snobol4digest(3), snobol4dirs(3), snobol4error(1), snobol4ext(1), snobol4ezio(3), snobol4fork(3), snobol4func(1), snobol4host(3), snobol4io(1), snobol4json(3), snobol4key(1), snobol4load(3), snobol4logic(3), snobol4op(1), snobol4random(3), snobol4readline(3), snobol4setup(3), snobol4sprintf(3), snobol4sqlite3(3), snobol4sqlite3dbm(3), snobol4stat(3), snobol4time(3), snobol4zlib(3), snolib(3), snopea(1), snopea(7).