| java.lang.Object jsint.Evaluator
Evaluator | public class Evaluator implements java.io.Serializable(Code) | | This class represents a Scheme interpreter.
author: Peter Norvig, Copyright 1998, peter@norvig.com, license author: subsequently modified by Jscheme project members author: licensed under zlib licence (see license.txt) |
Method Summary | |
public Object | analyze(Object x, DynamicEnvironment dynamicEnv, LexicalEnvironment lexenv) Analyze (or preprocess or precompile) an expression into "code".
The code returned is either a Symbol, a LocalVariable, a Closure, or
an array whose first element is either one of (quote if or begin set!)
or is code evaluating to a procedure. | public void | enableNamedResults(boolean enabled) | public Boolean | environmentImport(Object x, Object prefix) | public Boolean | environmentImport(Object x, Object prefix, boolean macrosFlag, jsint.Symbol[] procnames) | public Object | eval(Object x) Evaluate an s-expression in the global environment. | public Object | eval(Object x, Object env) Evaluate an s-expression in a lexical environment. | public Object | evalToplevel(Object x, DynamicEnvironment env) evalToplevel evaluates each element of a BEGIN. | public Object | execute(Object x, LexicalEnvironment lexenv) Evaluate analyzed code in a lexical environment. | public PrintWriter | getError() | public DynamicEnvironment | getInitialEnvironment() | public InputPort | getInput() | public DynamicEnvironment | getInteractionEnvironment() | public static DynamicEnvironment | getNullEnvironment() | public PrintWriter | getOutput() | public void | interrupt(Thread t) Interrupt execution on thread t. | public void | interruptCheck() Maybe interrupt this thread of execution. | public Boolean | languageImport(Object x) | public Object | load(Object fileName) Eval all the expressions in a file. | public Object | load(InputPort in) Eval all the expressions coming from an InputPort, putting them
in the interactionEnvironment. | public DynamicEnvironment | loadEnvironment(Object x) load the current object (file or class) into a new Evaluator
and return the resulting Evaluator's DynamicEnvironment. | public boolean | readEvalWriteLoop(String prompt) Prompt, read, eval, and write the result.
Also sets up a catch for any RuntimeExceptions encountered.
Returns true on EOF, false if (exit) was evaluated. | public void | runJscheme() | public void | setError(PrintWriter w) | public boolean | setExit(boolean exit) | public void | setInput(InputPort ip) | public void | setOutput(PrintWriter w) |
INTERRUPTABLE | public boolean INTERRUPTABLE(Code) | | Is execution interruptable. *
|
Evaluator | public Evaluator()(Code) | | |
analyze | public Object analyze(Object x, DynamicEnvironment dynamicEnv, LexicalEnvironment lexenv)(Code) | | Analyze (or preprocess or precompile) an expression into "code".
The code returned is either a Symbol, a LocalVariable, a Closure, or
an array whose first element is either one of (quote if or begin set!)
or is code evaluating to a procedure. *
|
enableNamedResults | public void enableNamedResults(boolean enabled)(Code) | | |
eval | public Object eval(Object x)(Code) | | Evaluate an s-expression in the global environment. *
|
evalToplevel | public Object evalToplevel(Object x, DynamicEnvironment env)(Code) | | evalToplevel evaluates each element of a BEGIN. This is so
macros can be defined and then used. Also toplevel macros can
expand into begin.
|
execute | public Object execute(Object x, LexicalEnvironment lexenv)(Code) | | Evaluate analyzed code in a lexical environment. Don't pass this
a raw s-expression; you need to analyze the s-expression
first.
|
interrupt | public void interrupt(Thread t)(Code) | | Interrupt execution on thread t. *
|
interruptCheck | public void interruptCheck()(Code) | | Maybe interrupt this thread of execution. *
|
load | public Object load(Object fileName)(Code) | | Eval all the expressions in a file. Calls load(InputPort). *
|
load | public Object load(InputPort in)(Code) | | Eval all the expressions coming from an InputPort, putting them
in the interactionEnvironment. The interactionEnvironment might
have been rebound to a module environment, but we don't care
about that. Returns TRUE on EOF, FALSE if (exit) was evaluated.
|
loadEnvironment | public DynamicEnvironment loadEnvironment(Object x)(Code) | | load the current object (file or class) into a new Evaluator
and return the resulting Evaluator's DynamicEnvironment.
|
readEvalWriteLoop | public boolean readEvalWriteLoop(String prompt)(Code) | | Prompt, read, eval, and write the result.
Also sets up a catch for any RuntimeExceptions encountered.
Returns true on EOF, false if (exit) was evaluated. *
|
runJscheme | public void runJscheme()(Code) | | |
setExit | public boolean setExit(boolean exit)(Code) | | |
|
|