SNOBOL4EXT(1)

πŸ“¦
version 2.3.1 Β· 3 versions
, in fedora 43, fedora 44, opensuse-leap 16.0

πŸ’– NAME πŸ’–

snobol4ext β€” CSNOBOL4 extensions, bestie ✨

(from the CSNOBOL4 Manual, no cap)


πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so this page is literally all about the extensions that CSNOBOL4 adds on top of the Bell Telephone Laboratories portable implementation of SNOBOL4 in snobol4(1). Sit down, hydrate, and let's go πŸ’…

🌸 ARRAY/TABLE access

You can put multiple ARRAY and/or TABLE index operations in a row β€” no need to resort to the ELEMENT function β€” as long as no intervening spaces (or line continuations) appear. The way that just works? Iconic. πŸŽ€

🌸 Case folding

By default the compiler folds identifiers and directives to upper case, so you can enter your programs in either case β€” main character energy, honestly. See snobol4(1), -CASE in snobol4ctrl(1), and &CASE in snobol4key(1). 🫢

🌸 Control lines

These additional β€œcontrol lines” are implemented, and yes they're all here, I'm not skipping a single one:

  • -CASE
  • -COPY
  • -BLOCKS / -NOBLOCKS
  • -ERROR / -NOERRORS
  • -EXECUTE / -NOEXECUTE
  • -HIDE
  • -INCLUDE
  • -LINE

See snobol4ctrl(1). πŸ’–

🌸 Functions

The following additional functions are implemented, and I am listing every single one because we don't do summary behaviour here:

  • 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 β€” again, all of them, obsessed:

  • &CASE
  • &DIGITS
  • &ERRTEXT
  • &FATAL
  • &FATALLIMIT
  • &FILE
  • &GCTIME
  • &GTRACE
  • &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. Periodt. πŸ’…

🌸 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.
  • -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. Not me warning you though 😭
  • 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). Slay. 🫢

🌸 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)
  • 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. iykyk πŸ’…


πŸ’€ BUGS πŸ’€

  • Add CSNOBOL4 version where each extension added?
  • Group the keywords, control lines, functions, operators together?

(these are the manpage's own little notes-to-self, not mine, I'm just the messenger πŸ™ˆ)


πŸ”₯ SEE ALSO πŸ”₯

snobol4(1). snobol4ctrl(1), snobol4func(1), snobol4key(1).


and that's the whole thing, bestie πŸ’– this was CSNOBOL4B 2.3.1, dated March 31, 2022 β€” go read snobol4(1) next, ily, bye πŸŽ€πŸ¦‹βœ¨

πŸ“¦ where this page comes from