orc.ast.oil
Class Expr

java.lang.Object
  extended by orc.ast.oil.Expr
Direct Known Subclasses:
Arg, Atomic, Bar, Call, Defs, HasType, Isolated, Pull, Push, Semi, Silent, TypeDecl, WithLocation

public abstract class Expr
extends java.lang.Object

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

Author:
dkitchin

Constructor Summary
Expr()
           
 
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.
 java.util.Set<Var> freeVars()
          Find the set of free variables in this expression.
 void typecheck(Type T, Env<Type> ctx, Env<Type> typectx)
           
abstract  Type typesynth(Env<Type> ctx, Env<Type> typectx)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Expr

public Expr()
Method Detail

typesynth

public abstract Type typesynth(Env<Type> ctx,
                               Env<Type> typectx)
                        throws TypeException
Throws:
TypeException

typecheck

public void typecheck(Type T,
                      Env<Type> ctx,
                      Env<Type> typectx)
               throws TypeException
Throws:
TypeException

freeVars

public final java.util.Set<Var> 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)