orc.ast.oil.expression.argument
Class Variable

java.lang.Object
  extended by orc.ast.oil.expression.Expression
      extended by orc.ast.oil.expression.argument.Argument
          extended by orc.ast.oil.expression.argument.Variable
All Implemented Interfaces:
java.lang.Comparable<Variable>

public class Variable
extends Argument
implements java.lang.Comparable<Variable>

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

Author:
dkitchin

Field Summary
 int index
           
 
Constructor Summary
Variable(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(Variable o)
           
 boolean equals(java.lang.Object v)
           
 int hashCode()
           
 Argument marshal()
           
 java.lang.Object resolve(Env<java.lang.Object> env)
           
<T> T
resolveGeneric(Env<T> env)
           
 java.lang.String toString()
           
 Type typesynth(TypingContext ctx)
           
 
Methods inherited from class orc.ast.oil.expression.argument.Argument
asField, enter, populateContinuations
 
Methods inherited from class orc.ast.oil.expression.Expression
freeVars, getPublishContinuation, leave, marshalAll, setPublishContinuation, typecheck
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

index

public int index
Constructor Detail

Variable

public Variable(int index)
Method Detail

hashCode

public int hashCode()
Specified by:
hashCode in class Argument

equals

public boolean equals(java.lang.Object v)
Specified by:
equals in class Argument

compareTo

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

resolve

public java.lang.Object resolve(Env<java.lang.Object> env)
Specified by:
resolve in class Argument

resolveGeneric

public <T> T resolveGeneric(Env<T> env)

addIndices

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

Overrides:
addIndices in class Argument
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 Expression

typesynth

public Type typesynth(TypingContext ctx)
               throws TypeException
Specified by:
typesynth in class Expression
Throws:
TypeException

marshal

public Argument marshal()
                 throws CompilationException
Specified by:
marshal in class Argument
Throws:
CompilationException