orc.ast.simple
Class Expression

java.lang.Object
  extended by orc.ast.simple.Expression
Direct Known Subclasses:
Call, Defs, Let, Parallel, Semi, Sequential, Silent, Where, WithLocation

public abstract class Expression
extends java.lang.Object

Base class for the simplified abstract syntax tree.

Author:
dkitchin, wcook

Constructor Summary
Expression()
           
 
Method Summary
 Node compile(Node output)
          Intermediate step to allow a one-step compile from the simple AST.
abstract  Expr convert(Env<Var> vars)
          Converts abstract syntax tree into a serializable form, used to generate portable .oil (Orc Intermediate Language) files.
 Expression suball(java.util.Map<NamedVar,? extends Argument> m)
          Perform a set of substitutions defined by a map.
abstract  Expression subst(Argument a, NamedVar 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).
abstract  java.util.Set<Var> vars()
          Find the set of all unbound Vars (note: not FreeVars) in this expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Expression

public Expression()
Method Detail

convert

public abstract Expr convert(Env<Var> vars)
                      throws CompilationException
Converts abstract syntax tree into a serializable form, used to generate portable .oil (Orc Intermediate Language) files.

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

subst

public abstract Expression subst(Argument a,
                                 NamedVar 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).

Parameters:
a - The replacing variable or value
x - The free variable whose occurrences will be replaced

suball

public Expression suball(java.util.Map<NamedVar,? extends Argument> m)
Perform a set of substitutions defined by a map. For each x |-> a in the map, the substitution [a/x] occurs.

Parameters:
m -

vars

public abstract java.util.Set<Var> vars()
Find the set of all unbound Vars (note: not FreeVars) in this expression.


compile

public Node compile(Node output)
             throws CompilationException
Intermediate step to allow a one-step compile from the simple AST. Obviously this is only useful if the compilation and execution environments are colocated.

Throws:
CompilationException