sbl notation

The sbl interpreter and preprocessor use a number of conventions to define strings, call functions, and do a variety of other basic tasks. Strings are the simplest: there are two types of strings, quoted and slashed.

Quoted strings:
Quoted strings are analagous to other languages' double-quoted strings: escapes are started with a backslash(\) and a literal backslash is \\. Beyond that, though, there are several differences in what escapes are used:
\n
a newline(chr 10)
\r
a mac-newline(chr 13)
\t
a tab character
\s
a string popped of the stack, literally
\n
a number popped of the stack(float or int, depending on the mode)
\'
a double quote(")
\anything else
a backslash
Quoted strings are, of course, enclosed in double quotes(""). They can span lines.
Slashed strings:
Slashed strings are plain, unformatted text. They are specified using the syntax ~/string/. No escaping is done: that means, for example, that it would be impossible to have a slash in a slashed string. This does make these strings useful for regular expressions, since character classes may be introduced without clumsy double backslashes.
Backquoted strings
Backquoted strings are one minor feature similiar to other languages' backquotes. When used, their contents is evaluated as a double-quoted string, and is passed to popen(3). Input is read from the resulting pipe, and the number of lines read is placed on the numbers stack. Note input will be backwards: use dup ->ll llunroll if you want reverse order.

Another use of punctuation is in variable calls; :name means the same as ~/name/ get. This can easily compact code involving variables.

Finally, subroutines may be called with the syntax &name. This will retrieve the variable name, convert it to a program, and evaluate it once.

sub [
	"This is a subroutine\n" outS # Make comment #
] "subroutine" stoi
The ampersand is not necessary on function calls unless they conflict with existing keywords.

Finally, there are several shorthand notations for commonly-used functions. They are as follows:

:variable
The :variable syntax is used to quickly recall the value of a variable. It is the same as "variable" get.
|variable
The |variable syntax is used to recall the value of a numeric variable. It is the same as "variable" geti.
)variable
The )variable syntax is used to set the value of a numeric variable. It is the same as "variable" stoi.
}variable
The }variable syntax is used to set the value of a string variable. It is the same as "variable" sto.
>handle
This statement is used to set a file handle to the current one. It needs one argument: the ASCII value of 'r' or 'R' if you are storing the current input, and the ASCII value of 'w' or 'W' if you are storing the current output.
handle>
This syntax is used to retrieve a file descriptor previously stored. It remembers what mode each descriptor was in, so you don't need to specify whether to read or write on the given filehandle.
/extension
The /extension notation is used to call external features added to sbl by an application that it is embedded in. In standard sbl, using /variable will return an error. It is the same as "extension" ext.
Numbers: numbers in sbl may be specified any of several ways. To begin with, a standard number without a decimal or trailing 0 will be pushed as an integer in integer mode or, if you are in float mode, be converted to float and pushed as such. Numbers with decimals always get pushed as floats. Also, standard specifications for octal and hex(0xHEX, 0OCTAL) are supported. Hex and octal are always pushed int integer mode: in floating point, the identifiers are ignored.
offnet@golden.net