Class silk.Scheme
java.lang.Object
|
+----silk.SchemeUtils
|
+----silk.Scheme
- public class Scheme
- extends SchemeUtils
This class represents a Scheme interpreter.
See http://www.norvig.com/SILK.html for more documentation.
This is version 1.4.
Fields inherited from class silk.SchemeUtils
Constructor Summary
Scheme (java.lang.String[] files)
Create a Scheme interpreter and load an array of files into it.
Method Summary
java.lang.Object
eval (java.lang.Object x,
Environment env)
Evaluate an object, x, in an environment.
java.lang.Object
eval (java.lang.Object x)
Eval in the global environment.
java.lang.Object
load (java.lang.Object fileName)
Eval all the expressions in a file.
java.lang.Object
load (
InputPort in)
Eval all the expressions coming from an InputPort.
static void
main (java.lang.String[] files)
Create a new Scheme interpreter, passing in the command line args
as files to load, and then enter a read eval write loop.
Methods inherited from class silk.SchemeUtils
chr,
chr,
cons,
equal,
eqv,
error,
first,
inPort,
length,
list,
list,
listStar,
listToString,
listToVector,
num,
num,
outPort,
rest,
reverse,
second,
setFirst,
setRest,
str,
sym,
third,
truth,
truth,
vec,
vectorToList,
warn,
write
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail
Scheme
public Scheme(java.lang.String[] files)
- Create a Scheme interpreter and load an array of files into it.
Also load SchemePrimitives.CODE.
Method Detail
main
public static void main(java.lang.String[] files)
- Create a new Scheme interpreter, passing in the command line args
as files to load, and then enter a read eval write loop.
readEvalWriteLoop
public void readEvalWriteLoop()
- Prompt, read, eval, and write the result.
Also sets up a catch for any RuntimeExceptions encountered.
load
public java.lang.Object load(java.lang.Object fileName)
- Eval all the expressions in a file. Calls load(InputPort).
load
public java.lang.Object load(InputPort in)
- Eval all the expressions coming from an InputPort.
eval
public java.lang.Object eval(java.lang.Object x,
Environment env)
- Evaluate an object, x, in an environment.
eval
public java.lang.Object eval(java.lang.Object x)
- Eval in the global environment.