 |
scheme package 1.1
|
1 - What is scheme package?
scheme package is a Java package
which provides a Scheme language kernel. ScmLoader, ScmInterpreter
and ScmApplet are three examples of how to use this package.
It contains:
-
scheme.kernel.* : The classes needed to make the kernel work.
-
scheme.primitives.* : All the primitives needed by the Scheme
Report.
-
scheme.extensions.* : Some features not needed by the Scheme Report.
-
scheme.java.* : Some interface implementations needed to connect
Java and Scheme.
-
library/ : Some utility functions (trace, print, remove ...) written
in Scheme.
-
library/object/ : An object oriented library in Scheme.
-
library/object/java/ : A collection of classes that directly manipulate
Java classes from Scheme.
-
library/object/java/generated/ : Some Scheme classes that are
copying the beaviour of corresponding Java classes. These classes have
been created by loading and running the Scheme source file library/java-headers.scm
(with the command 'java ScmLoader library/library.scm library/java-headers.scm').
-
misc/ : Contains files used for the package development. One of
the most interesting file is scheme.el.It is a copy of the Emacs
Scheme-Mode source file with some modifications. It indents and highlights
correctly object-oriented and syntax constructs.
2 - What sort of Scheme does it implement?
When you use the class scheme.kernel.ScmStandardKernel, the Scheme
language implemented is r4rs compliant with some limitations:
-
Rational and complex numbers are not implemented for performance reasons
(they are not required by the Scheme Report),
-
integers are small integers (for performance reasons) (bignums are not
required by the Scheme Report),
-
Numbers starting with #b, #o and #x are not (yet) recognized by the parser,
-
r4rs macros are not implemented (they are required only by r5rs),
-
Continuations do not (and will never) work properly since there is no C
language setjmp/longjmp equivalent in Java. A continuation only works in
the scope of the call-with-current-continuation that has created
it, otherwise the continuation becomes the top-level's one. It is still
useful to implement escape and error procedures.
scheme.extensions.ScmExtendedKernel inherits from the previous
kernel and adds some extensions:
3 - The examples.
All the examples use the class ScmExtendedInterpreter
to evaluate Scheme expressions. As mentioned above, this class adds
features to the standard kernel. It is itself an example that shows how
to create a new Scheme kernel with new predefined procedures written in
Java.
a - ScmInterpreter.
This application is defined
in 'ScmInterpreter.java'. It implements a simple Scheme language interactive
interpreter. When executed, it searchs for the file 'Scheme.scm' in the
current directory, loads and runs it, and starts a top-level loop.
b - ScmLoader.
Defined in 'ScmLoader.java',
this application only loads and runs the Scheme source files given on the
command line.
c - ScmApplet.
This applet is defined in 'ScmApplet.java'.
It is a simple applet that allows user to interactively evaluate Scheme
expressions. You can run this applet by opening 'SchemeApplet.html' in
your favorite HTML browser. You must first create 'scm.jar' (just type
'make jar' on the command line, or see the command in the file 'Makefile'
if you do not have the make command installed on you system.
Stéphane Hillion - 1998