orc.ast.oil.arg
Class Var

java.lang.Object
  extended by orc.ast.oil.Expr
      extended by orc.ast.oil.arg.Arg
          extended by orc.ast.oil.arg.Var
All Implemented Interfaces:
java.lang.Comparable<Var>

public class Var
extends Arg
implements java.lang.Comparable<Var>

Bound variables, represented using deBruijn indices. These occur in argument and expression position.

Author:
dkitchin

Field Summary
 int index
           
 
Constructor Summary
Var(int index)
           
 
Method Summary
<E> E
accept(Visitor<E> visitor)
           
 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.
 int compareTo(Var o)
           
 boolean equals(java.lang.Object v)
           
 int hashCode()
           
<T> T
resolve(Env<T> env)
           
 java.lang.String toString()
           
 Type typesynth(Env<Type> ctx, Env<Type> typectx)
           
 
Methods inherited from class orc.ast.oil.arg.Arg
compile
 
Methods inherited from class orc.ast.oil.Expr
freeVars, typecheck
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

index

public int index
Constructor Detail

Var

public Var(int index)
Method Detail

resolve

public <T> T resolve(Env<T> env)
Specified by:
resolve in class Arg

addIndices

public void addIndices(java.util.Set<java.lang.Integer> indices,
                       int depth)
Description copied from class: Expr
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.

Specified by:
addIndices in class Expr
Parameters:
indices - The index set accumulator.
depth - The minimum index for a free variable.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

accept

public <E> E accept(Visitor<E> visitor)
Specified by:
accept in class Expr

typesynth

public Type typesynth(Env<Type> ctx,
                      Env<Type> typectx)
               throws TypeException
Specified by:
typesynth in class Expr
Throws:
TypeException

hashCode

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

equals

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

compareTo

public int compareTo(Var o)
Specified by:
compareTo in interface java.lang.Comparable<Var>