|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ix.util.lisp.Interpreter.Expr
public abstract static class Interpreter.Expr
The root class for expressions. Expressions are able to
evaluate themselves when given an environment. This is done
by calling the expression's _evalIn(Interpreter.Env)
method.
However, evalIn(Interpreter.Env)
should normally be called
instead. It puts some debugging support around a call to _evalIn,
primarily so that a backtrace will appear if an exception
is thrown.
Expressions have a "description" object that is
used by their toString()
method. It's main
purpose is to describe the expression in a backtrace.
Expressions also have an "external form". Unlike the description, it is not meant to be nicely readable by a user. Instead, it is a representation that can be understood by the reflection and XML utilities and can be input and output. Converting an external form back to an expression should produce an expression that is equivalent to the original.
The default external form for instances of subclasses of
this class is an IScript expression, an instance of a
subclass of Expression
. There is
a fairly direct correspondence between subclasses of
that class and subclasses of this one.
Conversion to external form is done by calling
the expression's externalForm()
method.
Coversion in the other direction is done by creating
an IScriptParser
and calling its parseExpression method.
This class also provides some utility methods.
Field Summary | |
---|---|
protected java.lang.Object |
description
|
Constructor Summary | |
---|---|
Interpreter.Expr()
|
Method Summary | |
---|---|
protected abstract java.lang.Object |
_evalIn(Interpreter.Env env)
Implements this expression's semantics. |
protected java.lang.Object[] |
evalArgs(Interpreter.Expr[] args,
Interpreter.Env env)
A utility for evaluating argument expressions. |
java.lang.Object |
evalIn(Interpreter.Env env)
Provides public access to this expression's semantics. |
abstract Expression |
externalForm()
Returns a representation of this expression that can be understood by the reflection and XML utilities. |
protected static ix.iscript.ListOfExpression |
externalForm(Interpreter.Expr[] exprs)
A utility for converting an array of Interpreter.Expr s
to a List of their external forms. |
protected static Interpreter.Expr[] |
makeExprArray(java.util.List exprList)
A utility for converting a List of Interpreter.Expr s
to an array. |
protected static Symbol[] |
makeVarArray(java.util.List varList)
A utility for converting a List of variables ( Symbol s)
to an array. |
void |
setDescription(java.lang.Object d)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.Object description
Constructor Detail |
---|
public Interpreter.Expr()
Method Detail |
---|
protected abstract java.lang.Object _evalIn(Interpreter.Env env)
Note that this method is usually not called directly.
Instead, call evalIn(Interpreter.Env)
.
public abstract Expression externalForm()
IScript
public void setDescription(java.lang.Object d)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object evalIn(Interpreter.Env env)
_evalIn(Interpreter.Env)
.
protected java.lang.Object[] evalArgs(Interpreter.Expr[] args, Interpreter.Env env)
protected static Interpreter.Expr[] makeExprArray(java.util.List exprList)
Interpreter.Expr
s
to an array.
protected static Symbol[] makeVarArray(java.util.List varList)
Symbol
s)
to an array.
protected static ix.iscript.ListOfExpression externalForm(Interpreter.Expr[] exprs)
Interpreter.Expr
s
to a List of their external forms.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |