SNOBOL4EXT(1) | CSNOBOL4B 2.3.2 | Janurary 1, 2024
NAME
snobol4ext – CSNOBOL4 extensions
DESCRIPTION
This page describes extensions to the Bell Telephone Laboratories
portable implementation of SNOBOL4 in snobol4(1).
-
ARRAY/TABLE access
-
Multiple ARRAY and/or TABLE index operations may appear in a
row, without having to resort to use of the ELEMENT function, so
long as no intervening spaces (or line continuations) appear.
-
Case folding
-
By default the compiler folds identifiers and directives to upper
case, so programs can be entered in either case:
see snobol4(1),
-CASE in snobol4ctrl(1),
&CASE in snobol4key(1).
-
Control lines
-
The following additional “control lines” are implemented:
-CASE,
-COPY,
-BLOCKS/-NOBLOCKS,
-ERROR/-NOERRORS,
-EXECUTE/-NOEXECUTE,
-HIDE,
-INCLUDE,
-LINE:
See snobol4ctrl(1).
-
Functions
-
The following additional functions are implemented:
ATAN(),
BREAKX(),
CHAR(),
CHOP()
COS(),
DATE(),
DELETE(),
EXP(),
FILE(),
FILE_ABSPATH(),
FILE_ISDIR()
FREEZE(),
FUNCTION(),
HOST(),
IO_FINDUNIT()
LABEL(),
LEQ(),
LGE(),
LLE(),
LLT(),
LN(),
LNE(),
LOG(),
LPAD(),
ORD(),
RENAME(),
REVERSE(),
RPAD(),
RSORT(),
SET()
SETEXIT(),
SIN(),
SORT(),
SQRT(),
SSET(),
SUBSTR(),
TAN(),
THAW(),
VDIFFER():
see snobol4func(1).
-
Keywords
-
The following additional keywords are implemented:
&CASE,
&DIGITS,
&ERRTEXT
&FATAL,
&FATALLIMIT,
&FILE,
&GCTIME,
>RACE
&LASTFILE,
&LASTLINE,
&LCASE,
&LINE,
&MAXINT,
&PARM,
&PI,
&STEXEC,
&UCASE:
see snobol4key(1).
-
REAL numbers in INTEGER contexts
-
REAL numbers (or strings convertible to REAL) are accepted in
all contexts which previously required an INTEGER (or string
convertible to INTEGER). Contexts include TABLE(), ITEM(),
array indices, INPUT(), OUTPUT(), SET(), keyword values,
CHAR(), RPAD(), LPAD(), FIELD(), COLLECT(), DUMP(),
DUPL(), OPSYN(), SUBSTR() added in CSNOBOL4 0.99.44.
-
Scientific notation
-
REAL number syntax has been expanded to allow exponents of the
form: ANY('Ee') ('+' | '-' | ”) SPAN('0123456789') --
added in CSNOBOL4 0.98.
-
-
Exponential format reals need not contain a decimal point
added in CSNOBOL4 0.99.44.
-
SPITBOL extensions
-
For compatibility with SNOBOL4+, certain SPITBOL extensions can be
enabled and disabled using the -PLUSOPS directive. -PLUSOPS 0
or -PLUSOPS disables SPITBOL operators, while -PLUSOPS n
where n is a non-zero integer enables them. SPITBOL extensions are
enabled by default. Extensions controlled by PLUSOPS are as follows:
-
-
The SPITBOL scan (?) and assignment (=) operators have been added. A
pattern match can appear within an expression, and returns the matched
string as its value. Similarly assignment can appear in an
expression, and returns the assigned value. An assignment after a scan
(ie; STRING ? PATTERN = VALUE) performs a scan and replace.
Assignment is right associative, and has the lowest precedence, while
scan is left associative and has a precedence just higher than
assignment.
-
-
The SPITBOL selection/alternative construction can be used in any
expression. It consists of a comma separated list of expressions
inside parentheses. The expressions are evaluated until one succeeds,
and its value is returned. Abuse of this construction may result in
incomprehensible code.
-
-
The type NUMERIC with CONVERT() and the removal of leading
spaces from strings converted to numbers (implicitly or explicitly)
are also legal when SPITBOL extensions are enabled.
-
TERMINAL I/O variable
-
The variable TERMINAL is associated with the standard error file
descriptor for both input and output (replaces PUNCH variable).
-
TRACE() function type argument
-
The second argument of the TRACE() function can be abbreviated to a
single letter:
C (CALL),
F (FUNCTION),
K (KEYWORD),
L (LABEL),
R (RETURN), or
V (VALUE) as in Macro SPITBOL.
-
Keyword trace
-
TRACE() works on &STFCOUNT keyword added in CSNOBOL4 0.99.44.
-
Value TRACE() on pattern match assignments
-
variable changes by . and $ operators are visible via value trace.
BUGS
Add CSNOBOL4 version where each extension added?
Group the keywords, control lines, functions, operators together?
SEE ALSO
snobol4(1).
snobol4ctrl(1),
snobol4func(1),
snobol4key(1).