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".
- &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.
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 Port input and output.
- Windowing and graphics capabilities.
- Raspberry Pi or android support.
- Complex Number support.
Right now I am 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 will not be limited to 255 byte lines,
will handle large files, and be as compatible as I can make it with the original.
I am using pdcurses.org for writing the text window. I have not figured out a way to do this on Linux yet however.
That is because I am building SNOBOL5 on Windows and the I don't have a way to convert the obj file to a .o file for Linux.
To get around this problem, I may need to write an assembler that is compatible with ML64.
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.
I will at least make make the Windows version available when I am done.