1SNOBOL4(1) CSNOBOL4 Manual SNOBOL4(1)
2
3
4
6 snobol4 - SNOBOL4 interpreter
7
9 This manual page describes CSNOBOL4, a port of the original Bell
10 Telephone Labs (BTL) Macro Implementation of SNOBOL4 to the C language.
11
12 The language and its implementation are described in [Griswold1971] and
13 [Griswold1972].
14
15 For command line options see snobol4cmd(1).
16
17 Extensions from Catspaw SNOBOL4+, SPITBOL and SITBOL have been added,
18 see snobol4ext(1).
19
20 Includes BLOCKS (SNOBOL4B) extensions, see snobol4blocks(1).
21
22 Changes
23 The following behaviors have been changed from the original Macro
24 SNOBOL4 in ways that might effect old programs:
25
26 INTEGER errors
27 INTEGER overflow does not cause expression failure.
28
29 Listings are disabled by default
30 Default listing side (when enabled by -LIST or the -l command line
31 option is LEFT. Listings are directed to standard error (or file
32 specified by the -l command line option.
33
34 Messages
35 The the startup banner and statistics (if enabled) are directed to
36 standard error.
37
38 Compilation error messages (including erroneous lines) appear on
39 standard error. Error messages reference the source file name and
40 line number.
41
42 Character set
43 see below.
44
45 INPUT() and OUTPUT()
46 FORTRAN formats are not used to control I/O. The 3rd argument to
47 the OUTPUT() and INPUT() functions is interpreted as a string of
48 I/O options, The 4th argument is used to specify a file name, see
49 snobol4io(1) for details.
50
51 PUNCH variable
52 The PUNCH output variable no longer exists, the TERMINAL variable
53 has been added in it's place, see snobol4io(1).
54
55 Statement separator
56 Control lines and comment characters are valid after the (;)
57 statement separator. Listing statement numbers show the statement
58 number of the LAST statement on the line (rather than the first).
59
60 &STLIMIT
61 &STLIMIT defaults to -1, see snobol4key(1).
62
63 Tracing
64 VALUE tracing applies to variables modified by immediate value
65 assignment ($ operator) and value assignment (. operator) during
66 pattern matching.
67
68 Extensions
69 Further additions are documented in snobol4ext(1).
70
71 Character set
72 snobol4(1) is 8-bit clean, and uses the native character set. Any
73 8-bit byte is accepted as a SNOBOL datum or in a string constant of a
74 SNOBOL source program. The value of the SNOBOL protected keyword
75 &ALPHABET is a 256-character string of all bytes from 0 to 255, in
76 ascending order.
77
78 On ASCII-based systems, any character with the 8th bit set is treated
79 as “alphabetic”, and can start, or be used in identifiers and labels.
80 This includes characters from the “upper half” of national character
81 sets and all bytes resulting from the UTF-8 encoding of Unicode
82 characters. Include file utf.sno implements pattern matching functions
83 for UTF-8 sequences.
84
85 Programs may be entered in mixed case; By default lower case
86 identifiers are folded to upper case (see &CASE and -CASE). Case
87 folding is performed by using the C library islower(3) test, and then
88 using toupper(3) to convert the lower-case characters to upper case.
89 When using UTF-8 encoded characters in code, case folding should be
90 disabled, to prevent any bytes which appear to be lower case in the
91 current locale from being modified.
92
93 The following operator character sequences are permitted and represent
94 a cross between PDP-10 Macro SNOBOL, SITBOL and Catspaw SPITBOL usage:
95
96 Assignment: = _
97 Comment line: * # | ; !
98 Continuation line: + .
99
100 Both square brackets ([]) and angle brackets (<>) may be used to
101 subscript arrays and tables. The TAB (ASCII 9) character is accepted
102 as whitespace.
103
104 Underscore (_) and period (.) are legal within identifiers and labels.
105
106 Note that the use of the pound sign for comments allows use of the
107 script interpreter (hash-bang) sequence at the top of a file marked as
108 executable: “#!/usr/local/bin/snobol4” or “#!/usr/bin/env snobol4”
109
110 See snobol4op(1) for operators.
111
113 A directory search list is used for files specified in -INCLUDE
114 directives and LOAD() function calls, and is constructed from:
115
116 1. The current working directory (“.”).
117
118 2. Any directories specified on the command line using -I options, in
119 the order specified.
120
121 3a. Directories from the the SNOPATH environment variable (see below),
122 if defined.
123
124 3b. If SNOPATH is not defined, the SNOLIB environment variable (or a
125 compiled in default) is used as base to add the following directories:
126
127 • base/version/lib
128
129 • base/version/local
130
131 • base/local
132
133 The LOAD() function will also check for the file in shared subdirectory
134 in each directory in the search path.
135
137 SNOBOL4UNBUFFERED
138 If set to a non-null value, all stdio output will be unbuffered,
139 and will be written immediately.
140
141 SNOPATH
142 Is a list of directories delimited by colons (semi-colons on VMS
143 and Windows) appended to the Directory Search List (see above).
144
145 SNOLIB
146 SNOLIB is used to establish the base libary path if SNOPATH is not
147 defined. See Directory Search List above. SNOLIB was the sole
148 search directory in versions of CSNOBOL4 prior to version 1.5.
149
150 SNOBOL_PRELOAD_PATH
151 Is a list of source files delimited by colons (semi-colons on VMS
152 and Windows) that will be read before the program source. Using
153 SNOBOL_PRELOAD_PATH will make your code less portable.
154
156 sdb(1) SNOBOL4 Debugger
157 snobol4cmd(1) command line options
158 snobol4ctrl(1) control lines
159 snobol4error(1) &ERRTYPE and &ERRTEXT values
160 snobol4ext(1) extensions to BTL SNOBOL4
161 snobol4func(1) built-in function list
162 snobol4io(1) input/output
163 snobol4key(1) keywords
164 snobol4op(1) operators
165 snobol4blocks(1) SNOBOL4B BLOCKS extension
166 snopea(1) convert snopea documentation to roff and HTML
167 snobol4dirs(3) directory access functions
168 snobol4ezio(3) easy to use file I/O
169 snobol4ffi(3) Foreign Function Interface functions
170 snobol4fork(3) subprocess interface functions
171 snobol4host(3) HOST and O/S functions
172 snobol4logic(3) bit logic & formatting functions
173 snobol4load(3) loading extension modules into SNOBOL4
174 snobol4ndbm(3) keyed file access functions
175 snobol4random(3) pseudo-random numbers functions
176 snobol4readline(3) input with line editing
177 snobol4setup(3) loadable module builder
178 snobol4sprintf(3) formatting function
179 snobol4sqlite3(3) SQLite database interface functions
180 snobol4sqlite3dbm(3)DBM interface using SQLite
181 snobol4stat(3) file metadata functions
182 snobol4stcl(3) Tcl/Tk interface functions
183 snobol4time(3) date/time functions
184 snolib(3) misc library functions
185 snopea(7) A little “Plain Old Documentation” format for SNOBOL4
186
187 http://www.regressive.org/snobol4
188 All things SNOBOL4 related.
189
190 http://www.snobol4.com
191 Catspaw: commercial SPITBOL implementations, Free SNOBOL4+ for DOS.
192
193 http://www.regressive.org/snobol4/doc/burks/tutorial/contents.htm
194 SNOBOL4 language tutorial (from Catspaw Vanilla SNOBOL4)
195
196 [Griswold1971]
197 R. E. Griswold, J. F. Poage, and I. P. Polonsky, The SNOBOL4
198 Programming Language, 2nd ed., Prentice-Hall Inc., 1971. (aka the
199 “green book”)
200 http://www.regressive.org/snobol4/docs/books.html#green
201
202 [Griswold1972]
203 R. E. Griswold, The Macro Implementation of SNOBOL4, W. H. Freeman
204 and Co., 1972. Book describing the implementation techniques used
205 in Macro SNOBOL4.
206 http://www.regressive.org/snobol4/docs/books.html#macro
207
208 http://www.regressive.org/snobol4/doc/burks/manual/contents.htm
209 Catspaw Vanilla SNOBOL4 manual.
210
211 ftp://ftp.snobol4.com/spitman.pdf
212 Catspaw Macro SPITBOL manual
213
214 http://www.regressive.org/snobol4/docs/books.html#orange
215 Algorithms in SNOBOL4, James F. Gimpel, Wiley, New York, 1976.
216
218 Ralph E. Griswold, James F. Poage, Ivan P. Polonsky, et al (Macro
219 SNOBOL4)
220
221 Philip. L. Budne (CSNOBOL4)
222
223 Mark Emmer (code from SNOBOL4+)
224
225 Viktors Berstis (code from Minnesota SNOBOL4)
226
227 James F. Gimpel (SNOBOL4B)
228
230 I/O is still tied to unit numbers.
231
232 I/O retains some record oriented flavor (maximum line length on input).
233
234 “Dynamic” storage cannot be expanded after startup.
235
236 Integer math can never fail, even on overflow.
237
238 Oversize integer constants may not be detected.
239
240
241
242CSNOBOL4B 2.3.1 March 31, 2022 SNOBOL4(1)