libstu provides the core routines for working with the stu interpreter.
Include the following header accordingly:
#include <libstu/stu.h>
And the relevant build flags, which may be obtained via pkg-config; e.g.
$ pkg-config --cflags --libs libstu
The interpreter Stu object encapsulates all interpreter state information; more than one instance may be used in the same program.
All returned StuVal objects are automatically exempt from garbage collection. Once a StuVal object is no longer required, it must be explicitly released via Stu_release_val.
The libstu routines all operate on the following structures.
The main structure encapsulating the atomic lisp object. The contents of this structure are intentionally opaque.
The structure which tracks the head of the environment binding list.
The main stu interpreter structure.
The singleton NIL object. This object is initialized in the first call to Stu_new; any subsequent calls will make use of the same instance.
The following functions comprise the public libstu interface.
Create and initialize an interpreter instance.
Destroy an interpreter instance created with Stu_new.
Eval a NUL-terminated file path and return the result as a StuVal. The returned StuVal object is exempt from garbage collection, thus when the result is no longer required it must be released via a call to the Stu_release_val function.
Same as Stu_eval_file, but parse the NUL-terminated buffer instead.
Same as Stu_eval_buf, but pass in an explicit environment base and return the updated environment head in updated.
Update the interpreter's main environment HEAD pointer.
Fetch the interpreter's current main environment HEAD pointer.
Scan the supplied buf and report on it's validity by returning:
1 if the form contained in buf is syntactically valid
0 if the form is invalid
-1 if the form is valid so far, but incomplete
Release the specified val back to the mercy of the garbage collector, to be cleaned up at some unspecified time in the future.
Dump the string representation of val to out in the context of the stu interpreter instance.
Append an include path to the interpreter's list of search locations for imported module files.
Dump assorted interpreter stats to out.
stu is written by Mikey Austin, Dmitry Petrov and Raphael Santos.
stu - cli
See the COPYING file in the distribution for the details.