Interpreters
It is pretty common for applications to offer extension capabilities
by means of a simple "extension language". Usually this language is
invented for the particular application, rather than simply picking
one of the many available interpreters. This forces users to learn
a new language just to be able to use the program.
In contrast, early versions of Siag used Scheme as its interpreter.
The implementation chosen was SIOD by George Carrette. This concept
has now been taken even further by adding support for multiple
interpreters.
The supporting code for each language resides in its own module.
As an example, Siag can currently be linked with support for these
interpreters:
- SIOD
- An extremely small Scheme interpreter which cooperates
exceptionally well with C.
- Guile
- Another Scheme interpreter. This one follows the R4RS more closely
than SIOD, which can be important if external Scheme programs are to
be used in Siag.
- Tcl
- Tcl is another popular embeddable scripting language.
- C
- Expressions in Siag can also be written in a simple C-like
syntax.
Pathetic Writer and Egon Animator can be linked with SIOD, Guile
and Tcl.
Cross-calling
One interpreter can call another using a string-based interface.
In SIOD, a call to make Tcl beep can look like this:
(exec-expr 'Tcl "puts \\a")
And Tcl can tell Guile to collect garbage in the following fashion:
exec-expr Guile "(gc)"
Ulric Eriksson - July 1997 - ulric@edu.stockholm.se