What is new or different in SNOBOL5 from the Green Book SNOBOL4
New and improved functions:
- AND function performs a boolean AND.
- ATAN function computes the arctangent.
- ATAN2 function computes the arctangent from x,y coordinates.
- BIT function converts a STRING, REAL, or INTEGER into a Bit string.
- BIT2H function converts a Bit string to a Hexadeciaml string.
- BIT2I converts a Bit string to an INTEGER.
- BIT2IS converts a Bit string to an INTEGER with sign bit extension.
- BIT2R converts a Bit string to a REAL.
- BIT2S converts a Bit string to a character STRING.
- BYTES2I converts little endian bytes to INTEGER.
- BYTES2IS converts little endian bytes to INTEGER, sign extended.
- BYTES2R converts little endian double precision bytes to REAL.
- BYTESS2R converts little endian single precision bytes to REAL.
- BYTESX2R converts little endian extended precision bytes to REAL.
- BREAKX pattern scans to additional break characters vs BREAK which only goes to the first character.
- CENTER function centers a character string in a specific length.
- CHAR function converts a 0 to 255 to a character.
- COS function computes the cosine.
- DATE function returns date and time in a sortable format.
- ENDIANB function performs Bit string little/big Endian conversions.
- ENDIANH function performs Hex string little/big Endian conversions.
- GETENV function retrieves an environment variable value.
- HEX function converts a STRING, REAL, or INTEGER into a Hex string.
- HEX2B function converts a Hex string to a Bit string.
- HEX2I function converts a Hex srting to an INTEGER.
- HEX2IS function converts a Hex srting to an INTEGER with sign extension.
- HEX2R function converts a Hex string to a REAL.
- HEX2S function converts a Hex string to a STRING.
- HEXS2R function converts a single precision float Hex string to a REAL.
- HEXX2R function converts an extended double precision float Hex string to a REAL.
- I2BYTES function converts INTEGER to little endian bytes.
- INPUT function has an additional parameters for file name and modifiers.
- INT function converts argument to INTEGER.
- IO_FINDUNIT function finds an unused I/O unit number.
- ISLABEL function tests whether a name is a label.
- ISNAN function tests for a NAN (Not A Number).
- LEQ is a lexical equal to comparison function.
- LGE is a lexical greater than or equal to comparison function.
- LLE is a lexical less than or equal to comparison function.
- LLT is a lexical less than comparison function.
- LNE is a lexical not equal to comparison function.
- LOAD and UNLOAD functions are not supported yet.
- LOB function converts a STRING to only show the low bit of each character as a bit string.
- LOG function computes the natural logarithm.
- LOG10 function computes the base 10 logarithm.
- LOG2 function computes the base 2 logarithm.
- LPAD function pads a string on the left.
- NAND function performs a boolean NAND.
- NOR function performs a boolean NOR.
- NOT function performs a boolean NOT.
- OR function performs a boolean OR.
- OUTPUT function has an additional parameters for file name and modifiers.
- R2BYTES function converts REAL to double precision little endian bytes.
- R2BYTESS function converts REAL to single precision little endian bytes.
- R2BYTESX function converts REAL to extended precision little endian bytes.
- R2HEXS function converts a REAL to the single precision Hex string.
- R2HEXX function converts a REAL to the extended double precision Hex string.
- RAND generates a random number.
- REAL function converts argument to REAL.
- REV reverses a string.
- REVERSE reverses a string.
- RPAD pads a string on the right.
- SEEK seeks to a particular location in a file.
- SIN function computes the sine of an angle.
- SLEEP function waits for a specified time.
- SORT sorts an array.
- SPANNOT is a pattern to match the longest string not containing the argument characters.
- SQRT function computes the square root of a number.
- STR function converts arguemnt to STRING.
- SUBSTR function extracts a substring from a string.
- SYSTEM function executes an operating system command.
- TAN function computes the tangent of an angle.
- TIME function returns in units of nanoseconds.
- TRIM has extra parameters for more functionality.
- XOR function performes a boolean Exclusive OR.
Keywords:
- &DIG keyword returns the string of decimal digits "0123456789".
- &DS keyword returns the string "\" in Windwos and "/" in Linux for use as the directory slash.
- &E keyword returns the value of e.
- &FLTDEC and &FLTSIG control how REAL values are converted to strings.
- &INFINITY keywords return the REAL value of infinity.
- &lc keyword returns the lower case letter string "abcdefghijklmnopqrstuvwxyz".
- &MAXARB keyword returns the pattern MAXARB.
- &MAXLNGTH keyword limits string lengths up to almost 64 gigabytes.
- &NAN keyword returns a REAL NAN (Not A Number).
- &OS keyword identifies the operating system SNOBOL5 is running on.
- &PARM keyword returns the command line parameters.
- &PI keyword returns the value of pi.
- &STAT keyword controls whether run statistics are written out.
- &STLIMIT keyword controls statement execution limit, not much higher.
- &UC keyword returns the upper case letter string "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
Miscellaneous:
- BAL pattern also balances quare and curly brackets.
- Bit and Hex strings are used for various boolean logic and conversion operations
and are useful when handling complex data structures.
They are actually just standard character strings, but only the
low order bit of each character is relevant. Similarly Hexadecimal
strings are also used in various ways.
- Case sensitivity is still present, but all built-in functions
have an UPPER and lower case name. The END statement can also
be in lower case ("end") but branches to the end must be in the
same case as the END statement. Success and failure branches can
use either upper case (:S(xxx) :F(xxx)) or lower case (:s(xxx) :f(xxx)).
- DirEnt data type is predefined for reading directory contents.
The name, date, size and type of the entry are returned.
- END statement may also be lower case. Branches to the end must be in the
same case as the END statement.
- File names and path names are no longer limited to 8.3 as in Minnesota SNOBOL4.
- REAL numbers follow the IEEE 754 floating point standard and are stored in
double precision throughout SNOBOL5. This includes INFINITY and NAN
(Not A Number) support. NAN's are enhanced to show where in the
SNOBOL5 program they originated. E notation is supported.
- Interrupting a SNOBOL5 run can be done with ctrl-break or ctrl-c.
The program terminates and can show run statistics and a dump. If the
interrupt is in some tight internal loop, it may take 10 crtl-c's
to stop the program.
- Limits for character string length are increased to 64 gigabytes,
integers are 64 bit, and REAL numbers are in double precision.
Up to 999 I/O unit numbers are available.
- Run time statistics are in different units of time and may be
somewhat inaccurate.
- SNOPATH environment variable is used to look for include files not
only for the source program, but also optionally for data file inputs.
See the INPUT() function and I/O documentation for more on this.
- Fixed some subtle bugs relating to reading very long lines and join command in PE3. (July 3, 2023)
- Fixed cursor positioning problem when resizing PE3 window. (July 6, 2023) No change in snobol5.. but got recompiled anyway.
- Fixed got rid of Windows error message when calling endfile on a directory read (July 15, 2023)
- Added added the DIR command to Personal Editor 3. (July 15, 2023)
- Declared snobol5 to be at beta level instead of alpha. (August 10, 2023)
- Fixed shift-alphabetic while capslock is on in Windows. (September 8, 2023)
- Fixed message says "Loading File" instead of "New File" when reading in large file. (August 27, 2024)
- Added support for &DS as the directory slash character. (August 28, 2024)
- Fixed: DEtype "DIR " should be "DIR" for Linux, when reading a directory. (August 28,2024)
- Added a program to solve NY Time's SpellingBee game. (August 29,2024)
- Bugs still to fix: (I am still dealing with some medical issues so might not get to these right away (at least I'm not in the hospital now.)
- PE3: Doing a DOS command does not restore copy/mark state.
- PE3 & S5: No error message when trying to save to a write protected file in Linux.
- PE3 & S5: DIR command does not work with links or junctions.. API writeups don't give a clue how to fix this. Help from anyone?
- PE3: Shifts within a block mark should not alter view position.
- PE3: Resizing window sometimes changes view position to an unexpected one.
- WORDLE: Does not restrict entries to valid words. Source version is fixed. Executable versions need to be rebuilt.
Some of the things still to do:
- Some more functions.
- Bytes, hex, bits, REAL, INTEGER conversions howto spread sheet.
- Improve large table performance.
- LOAD/UNLOAD to support calling external code.
- Tutorial videos.
- Executable file creation to run a SNOBOL5 program without needing the separate interpreter executable file.
This has been done as a proof-of-concept for the sample programs eliza and wordle but is not ready for users to create.
- Internet Ports input and output.
- Windowing and graphics capabilities.
- Raspberry Pi or android support.
- Complex Number support.
I have finished writing a SNOBOL5 version of the old Personal Editor 2 that came from the original IBM PC days and
worked on systems up to Windows XP. My new version is not limited to 255 byte lines,
handles large files, and is as compatible as I can make it with the original.
I am using pdcurses.org for writing the text window. In Linux, I use ncurses.
Some nice features are being able to simultaneously view different parts of a file or parts of several files.
Another, I use frequently, is a graphical display of parenthesis nesting on a line, which is useful for catching
stupid errors. The editor is highly configurable, with the ability to reprogram what all of the keys do.
There are commands to let you search and change using SNOBOL5 patterns.
I have made the Windows and Linux versions along with documentation available here:
Personal Editor 3.