ix.util.lisp
Class LispInterpreter

java.lang.Object
  extended by ix.util.lisp.Interpreter
      extended by ix.util.lisp.LispInterpreter
Direct Known Subclasses:
IScriptInterpreter.IScriptLispInterpreter, LispComputeInterpreter, SafeLispInterpreter

public class LispInterpreter
extends Interpreter

An interpreter for a simple dialect of Lisp.


Nested Class Summary
static class LispInterpreter.JavaNull
          Class used to create a single object that represents Java null.
static interface LispInterpreter.Parser
           
 class LispInterpreter.Syntax
           
static class LispInterpreter.SyntaxError
           
 
Nested classes/interfaces inherited from class ix.util.lisp.Interpreter
Interpreter.AbstractEnv, Interpreter.AbstractFunction, Interpreter.And, Interpreter.Assignment, Interpreter.Call, Interpreter.Closure, Interpreter.Env, Interpreter.Error, Interpreter.Expr, Interpreter.Function, Interpreter.GlobalEnv, Interpreter.If, Interpreter.JFunction, Interpreter.Lambda, Interpreter.Let, Interpreter.LexicalEnv, Interpreter.Literal, Interpreter.Or, Interpreter.Sequence, Interpreter.VarRef, Interpreter.While
 
Field Summary
static Symbol COND
           
static Symbol ELLIPSIS
           
protected  java.lang.Object JAVA_NULL
           
static Symbol LAMBDA
           
protected  java.util.Map<Symbol,LispInterpreter.Parser> parserTable
           
static Symbol PROGN
           
static Symbol QUOTE
           
protected  LispReader reader
           
 
Fields inherited from class ix.util.lisp.Interpreter
acceptOnlySafeBuiltins, DEFAULT, FALSE, globalEnv, iscript, TRUE
 
Constructor Summary
LispInterpreter()
           
LispInterpreter(boolean beSafe)
           
 
Method Summary
 void define(Interpreter.JFunction builtin)
           
 void define(LispInterpreter.Syntax syntax)
           
 void define(java.lang.String varName, java.lang.Object val)
           
protected  void defineBuiltins()
           
protected  void defineInitialValues()
           
protected  void defineSyntax()
           
protected  void installDefinitions()
           
 boolean isTrue(java.lang.Object obj)
          Determines whether this interpreter regards the object as true; otherwise, the object is considered false.
 void loadLisp(java.util.List resourcenNames)
           
 void loadLisp(java.lang.String resourceName)
           
static void main(java.lang.String[] argv)
           
 Interpreter.Expr parseForm(java.lang.Object form)
           
 java.util.List parseList(java.util.List forms)
           
 void readEvalPrintLoop()
           
 java.lang.Object topLevelEval(java.lang.Object form)
           
 
Methods inherited from class ix.util.lisp.Interpreter
isSafe, nameForClass, topLevelApply, topLevelEval
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUOTE

public static final Symbol QUOTE

LAMBDA

public static final Symbol LAMBDA

PROGN

public static final Symbol PROGN

COND

public static final Symbol COND

ELLIPSIS

public static final Symbol ELLIPSIS

parserTable

protected java.util.Map<Symbol,LispInterpreter.Parser> parserTable

reader

protected LispReader reader

JAVA_NULL

protected java.lang.Object JAVA_NULL
Constructor Detail

LispInterpreter

public LispInterpreter()

LispInterpreter

public LispInterpreter(boolean beSafe)
Method Detail

main

public static void main(java.lang.String[] argv)

readEvalPrintLoop

public void readEvalPrintLoop()

loadLisp

public void loadLisp(java.util.List resourcenNames)

loadLisp

public void loadLisp(java.lang.String resourceName)

isTrue

public boolean isTrue(java.lang.Object obj)
Description copied from class: Interpreter
Determines whether this interpreter regards the object as true; otherwise, the object is considered false.

Note that expressions do not call this method directly. Instead, they must call the Interpreter.Env.isTrue(Object) method of an environment.

Overrides:
isTrue in class Interpreter

topLevelEval

public java.lang.Object topLevelEval(java.lang.Object form)

parseForm

public Interpreter.Expr parseForm(java.lang.Object form)

parseList

public java.util.List parseList(java.util.List forms)

installDefinitions

protected void installDefinitions()

define

public void define(LispInterpreter.Syntax syntax)

define

public void define(Interpreter.JFunction builtin)

define

public void define(java.lang.String varName,
                   java.lang.Object val)

defineSyntax

protected void defineSyntax()

defineBuiltins

protected void defineBuiltins()

defineInitialValues

protected void defineInitialValues()