I-Script interpretor (Lisp syntax)

Author: Jeff Dalton

Main-program class: ix.util.lisp.LispInterpreter

Command-line arguments:

-load-lisp=resource,resource,...

Specifies resources (file names and URLs) that contain Lisp-syntax I-Script code. The resources are processed by evaluating the expressions in them (in order) when the interpreter starts running.

Main-program class: ix.ip2.LispComputeInterpreter

Additional command-line arguments:

-domain=resource,resource,...

Specifies resources (file names and URLs) that define I-X domains. Any I-Script code attached the domains by compute-support-code annotations is evaluated. For the details of how that's done, see compute conditions.

-extension-classes=classname,classname,...

Here a class name must be a full Java class name, including the package. Each named class must implement the IXAgentExtension interface. For more, including how to use this mechanism to define new functions that can be used in "compute" conditions, see Agent Extensions.

Description:

The interpreter loads any code specified by "load-lisp" plus, if applicable, any domains and extension classes, then enters a "read-eval-print loop" that repeatedly asks the user to type an expression (with "Lisp: " as the prompt), evaluates the expression, then prints the resulting value.

Type "bye" to exit.

An example, with the parts typed by the user underlined:

Lisp: (* 1 2 3 4 5 6 7)
5040
Lisp: (defun factorial (x)
        (if (= x 0)
            1
          (* x (factorial (- x 1)))))
factorial
Lisp: (factorial 7)
5040
Lisp: bye

The difference between the two main-program classes, LispInterpreter and LispComputeInterpreter, is that the compute-interpreter knows about domains and extension classes and so can more easily be used to test functions that are meant to be called in "compute" conditions. It may also contain some additional built-in functions or other features.


Jeff Dalton <J.Dalton@ed.ac.uk>