This section describes the klisp, a Kernel Programming Language stand-alone interpreter.
klisp is invoked like this:
klisp [options] [script]
klisp is a stand-alone klisp interpreter for the Kernel
Programming Language. It loads and evaluates Kernel programs in
textual source form. klisp can be used as a batch
interpreter and also interactively. The given options
(see Command Line Options) are evaluated and then the klisp
program in file script is loaded and evaluated. All
evaluations mentioned, including the initialization that is described
below, take place in the same (initially) standard environment. All
values that result from these evaluation are discarded, but if the
root-continuation or error-continuation are passed a
value, the evaluation of options is interrupted and
klisp terminates.
See Exit Status, for a description of the
exit status in each case.
The string script together with all arguments are available as
a list of strings via the applicative get-script-arguments. If
these arguments contain spaces or other characters special to the
shell, then they should be quoted (but note that the quotes will be
removed by the shell). The complete command line, including the name
of the interpreter, options, the script, and its arguments are
available as a list of strings via the applicative
get-interpreter-arguments.
At the very beginning, before even handling the command line,
klisp reads and evaluates the contents of the environment
variable KLISP_INIT, if it is defined. To use an init file,
just define KLISP_INIT to the following form: (load
"/path/to/init-file"). Notice that klisp expects exactly one
expression in KLISP_INIT, if it is defined. So it is an error
to have no expressions or more than one in KLISP_INIT. The
same is true of the argument to the -e option, as both are
implemented in terms of string-eval.
In interactive mode, klisp prompts the user, reads expressions from the standard input, and evaluates them as they are read. The default prompt is "klisp> ".
Options start with - and are described below. You can use
-- to signal the end of options. If no arguments are given,
then -v -i is assumed when the standard input is a
terminal; otherwise, - is assumed. If no script, or
option -e or -l is given, -i is assumed.
(load "name") before script is executed.
Typically used to do environment initialization.
(require "name") before script is
executed. Typically used to load libraries.
If the script or stdin reach EOF or if there is no
script, EXIT_SUCCESS is returned. If the
error-continuation is passed an object during init, arguments or script
evaluation EXIT_FAILURE is returned. If the
root-continuation is passed an object, klisp tries to
convert the value passed to the root-continuation to an exit
status as follows:
integerbooleanEXIT_SUCCESS is returned for
#t and EXIT_FAILURE for #f.
inertEXIT_SUCCESS is returned.
elseEXIT_FAILURE is returned.
The following environment variables affect the behaviour of klisp
(load "/path/to/init-file")
? to be
replaced by the required name at run-time.