orc.ast.oil.expression
Class Expression

java.lang.Object
  extended by orc.ast.oil.expression.Expression
Direct Known Subclasses:
Argument, Call, Catch, DeclareDefs, DeclareType, HasType, Otherwise, Parallel, Pruning, Sequential, Stop, Throw, WithLocation

public abstract class Expression
extends java.lang.Object

Base class for the portable (.oil, for Orc Intermediate Language) abstract syntax tree.

Author:
dkitchin, jthywiss

Constructor Summary
Expression()
           
 
Method Summary
abstract
<E> E
accept(Visitor<E> visitor)
           
abstract  void addIndices(java.util.Set<java.lang.Integer> indices, int depth)
          If this expression has any indices which are >= depth, add (index - depth) to the index set accumulator.
abstract  void enter(Token t)
           
abstract  boolean equals(java.lang.Object obj)
           
 java.util.Set<Variable> freeVars()
          Find the set of free variables in this expression.
 TokenContinuation getPublishContinuation()
           
abstract  int hashCode()
           
 void leave(Token t)
           
abstract  Expression marshal()
           
static Expression[] marshalAll(java.util.List<Expression> es)
          Convenience method, to marshal a list of expressions.
abstract  void populateContinuations()
           
 void setPublishContinuation(TokenContinuation publishContinuation)
           
 void typecheck(TypingContext ctx, Type T)
           
abstract  Type typesynth(TypingContext ctx)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Expression

public Expression()
Method Detail

hashCode

public abstract int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public abstract boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

typesynth

public abstract Type typesynth(TypingContext ctx)
                        throws TypeException
Throws:
TypeException

typecheck

public void typecheck(TypingContext ctx,
                      Type T)
               throws TypeException
Throws:
TypeException

freeVars

public final java.util.Set<Variable> freeVars()
Find the set of free variables in this expression.

Returns:
The set of free variables.

addIndices

public abstract void addIndices(java.util.Set<java.lang.Integer> indices,
                                int depth)
If this expression has any indices which are >= depth, add (index - depth) to the index set accumulator. The depth increases each time this method recurses through a binder. The default implementation is to assume the expression has no free variables, and thus do nothing. Expressions which contain variables or subexpressions override this behavior.

Parameters:
indices - The index set accumulator.
depth - The minimum index for a free variable.

accept

public abstract <E> E accept(Visitor<E> visitor)

marshal

public abstract Expression marshal()
                            throws CompilationException
Throws:
CompilationException

marshalAll

public static Expression[] marshalAll(java.util.List<Expression> es)
                               throws CompilationException
Convenience method, to marshal a list of expressions.

Throws:
CompilationException

populateContinuations

public abstract void populateContinuations()

getPublishContinuation

public TokenContinuation getPublishContinuation()
Returns:
the publishContinuation

setPublishContinuation

public void setPublishContinuation(TokenContinuation publishContinuation)
Parameters:
publishContinuation - the publishContinuation to set

enter

public abstract void enter(Token t)

leave

public void leave(Token t)