java.lang.Object
com.memoire.silk.SilkSchemeUtils
com.memoire.silk.SilkScheme
- public class SilkScheme
- extends SilkSchemeUtils
This class represents a SilkScheme interpreter.
See http://www.norvig.com/SILK.html for more documentation.
This is version 1.4.
|
Constructor Summary |
SilkScheme()
Create a SilkScheme interpreter and load an array of files into it. |
|
Method Summary |
java.lang.Object |
eval(java.lang.Object x)
Eval in the global environment. |
java.lang.Object |
eval(java.lang.Object x,
SilkEnvironment env)
Evaluate an object, x, in an environment. |
(package private) SilkPair |
evalList(java.lang.Object list,
SilkEnvironment env)
Evaluate each of a list of expressions. |
void |
exit()
|
java.lang.Object |
load(java.lang.Object fileName)
Eval all the expressions in a file. |
java.lang.Object |
load(SilkInputPort in)
Eval all the expressions coming from an SilkInputPort. |
void |
readEvalWriteLoop()
Prompt, read, eval, and write the result. |
(package private) java.lang.Object |
reduceCond(java.lang.Object clauses,
SilkEnvironment env)
Reduce a cond expression to some code which, when evaluated,
gives the value of the cond expression. |
| Methods inherited from class com.memoire.silk.SilkSchemeUtils |
chr, chr, cons, equal, eqv, error, first, inPort, length, list, list, listStar, listToString, listToVector, num, num, outPort, p, p, rest, reverse, second, setFirst, setRest, str, stringify, stringify, stringify, 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 |
input
public SilkInputPort input
output
public java.io.PrintWriter output
error
public java.io.PrintWriter error
globalSilkEnvironment
public SilkEnvironment globalSilkEnvironment
SilkScheme
public SilkScheme()
- Create a SilkScheme interpreter and load an array of files into it.
Also load SilkSchemePrimitives.CODE.
exit
public void exit()
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(SilkInputPort).
load
public java.lang.Object load(SilkInputPort in)
- Eval all the expressions coming from an SilkInputPort.
eval
public java.lang.Object eval(java.lang.Object x,
SilkEnvironment env)
- Evaluate an object, x, in an environment.
eval
public java.lang.Object eval(java.lang.Object x)
- Eval in the global environment.
evalList
SilkPair evalList(java.lang.Object list,
SilkEnvironment env)
- Evaluate each of a list of expressions.
reduceCond
java.lang.Object reduceCond(java.lang.Object clauses,
SilkEnvironment env)
- Reduce a cond expression to some code which, when evaluated,
gives the value of the cond expression. We do it that way to
maintain tail recursion.