orc.ast.simple.expression
Class DeclareDefs

java.lang.Object
  extended by orc.ast.simple.expression.Expression
      extended by orc.ast.simple.expression.DeclareDefs

public class DeclareDefs
extends Expression

A group of mutually recursive definitions, and the expression to which they are scoped.

Author:
dkitchin

Field Summary
 Expression body
           
 java.util.List<Def> defs
           
 
Constructor Summary
DeclareDefs(java.util.List<Def> defs, Expression body)
           
 
Method Summary
 Expression convert(Env<Variable> vars, Env<TypeVariable> typevars)
          Converts abstract syntax tree into a serializable form, used to generate portable .oil (Orc Intermediate Language) files.
 Expression subst(Argument a, FreeVariable x)
          Performs the substitution [a/x], replacing occurrences of the free variable x with the new argument a (which could be any argument, including another variable).
 Expression subst(Type T, FreeTypeVariable X)
          Performs the substitution [T/X], replacing occurrences of the free type variable X with the type T (which could be any type, including another variable).
 java.lang.String toString()
           
 java.util.Set<Variable> vars()
          Find the set of all Variables (note: not FreeVariables) that are not bound within this expression.
 
Methods inherited from class orc.ast.simple.expression.Expression
convertAll, subMap, substAll, subvar, subvar
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

defs

public java.util.List<Def> defs

body

public Expression body
Constructor Detail

DeclareDefs

public DeclareDefs(java.util.List<Def> defs,
                   Expression body)
Method Detail

subst

public Expression subst(Argument a,
                        FreeVariable x)
Description copied from class: Expression
Performs the substitution [a/x], replacing occurrences of the free variable x with the new argument a (which could be any argument, including another variable).

Specified by:
subst in class Expression
Parameters:
a - The replacing variable or value
x - The free variable whose occurrences will be replaced
Returns:
A new copy of the expression with the substitution performed

subst

public Expression subst(Type T,
                        FreeTypeVariable X)
Description copied from class: Expression
Performs the substitution [T/X], replacing occurrences of the free type variable X with the type T (which could be any type, including another variable).

Specified by:
subst in class Expression
Parameters:
T - The replacing type
X - The free type variable whose occurrences will be replaced
Returns:
A new copy of the expression with the substitution performed

vars

public java.util.Set<Variable> vars()
Description copied from class: Expression
Find the set of all Variables (note: not FreeVariables) that are not bound within this expression.

Specified by:
vars in class Expression

convert

public Expression convert(Env<Variable> vars,
                          Env<TypeVariable> typevars)
                   throws CompilationException
Description copied from class: Expression
Converts abstract syntax tree into a serializable form, used to generate portable .oil (Orc Intermediate Language) files.

Specified by:
convert in class Expression
Parameters:
vars - The vars environment, used in content addressable mode to find the appropriate deBruijn index of a var.
typevars - The type vars environment, used in content addressable mode to find the appropriate deBruijn index of a type var.
Returns:
A new node.
Throws:
CompilationException

toString

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