Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ix.util.lisp
Class Interpreter.Expr

    java.lang.Object
      ix.util.lisp.Interpreter.Expr

Direct Known Subclasses:
  Interpreter.And, Interpreter.Call, Interpreter.If, Interpreter.Lambda, Interpreter.Let, Interpreter.Literal, Interpreter.Or, Interpreter.Sequence, Interpreter.VarRef, Interpreter.While

Enclosing class:
  Interpreter

    public abstract static class Interpreter.Expr

extends java.lang.Object

The root class for expressions. Expressions are able to evaluate themselves when given an environment. This is done by calling the expression's `#_evalIn(Env)` method. However, `#evalIn(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

### description

    protected java.lang.Object description

Constructor Detail

### Interpreter.Expr

    public Interpreter.Expr()

Method Detail

### _evalIn

    protected abstract java.lang.Object _evalIn(Interpreter.Env env)

  Implements this expression's semantics.

  Note that this method is usually not called directly. Instead, call `#evalIn(Env`}.

### externalForm

    public abstract Expression externalForm()

  Returns a representation of this expression that can be understood by the reflection and XML utilities.

  See Also:
    `IScript`

### setDescription

    public void setDescription(java.lang.Object d)

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### evalIn

    public java.lang.Object evalIn(Interpreter.Env env)

  Provides public access to this expression's semantics. This method typically wraps some debugging support around a call to `#_evalIn(Env)`.

### evalArgs

    protected java.lang.Object[] evalArgs(Interpreter.Expr[] args,
                                          Interpreter.Env env)

  A utility for evaluating argument expressions.

### makeExprArray

    protected static Interpreter.Expr[] makeExprArray(java.util.List exprList)

  A utility for converting a List of `Interpreter.Expr`s to an array.

### makeVarArray

    protected static Symbol[] makeVarArray(java.util.List varList)

  A utility for converting a List of variables (`Symbol`s) to an array.

### externalForm

    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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD