-
Notifications
You must be signed in to change notification settings - Fork 0
Scripting
The scripting language is exceedingly simple. It's like a dumbed-down lisp, because it lacks many of the extra syntactic constructs such as quoting
An atom is defined as the following:
-
123,1e9,1.456etc. (numbers) -
"some characters"(" and \ are the only currently valid escapes) -
'symbol-name(apostrophe is optional!) -
#345(the number is an object ID) -
E_ERRORNAME(not implemented yet) -
nil(actually a symbol, but is bound to the nil value)
A list is defined as the following:
-
(atom atom ... atom)
Together, the kinds of atoms and list make up the eight fundamental data types: int, float, string, symbol, object, error, list, nil
Because lists are a data type and lists are also code, code is data.
Scripts can call builtins: (builtin-name arg1 arg2 ...) (there's a list of builtins somewhere around here)
Symbols are either builtin names or aliases for data. Here's an example of a builtin and a "bound" symbol:
(slet (x 3) (echo x))
will send 3 to whoever evaluated the code. It should be obvious what slet does. It stands for "single let", because there is a let builtin that binds multiple symbols in one shot.
The following will not work:
(do (slet (x 3) (echo x)) (echo x))
(do just evaluates its arguments and returns the results in a list)
Symbol binding is local, so we'll get an E_UNBOUND error.
Symbol resolution is done by the evaluator and argument evaluation is done by the builtins. Therefore, if code is never reached, then it is never evaluated, or checked for any kind of semantic errors.