orc.ast.simple.expression
Class Def
java.lang.Object
orc.ast.simple.expression.Def
public class Def
- extends java.lang.Object
A unit of syntax that encapsulates an expression definition.
Groups of mutually recursive definitions are scoped in the simplified abstract syntax tree by DeclareDefs.
- Author:
- dkitchin
Method Summary |
Def |
convert(Env<Variable> vars,
Env<TypeVariable> typevars)
|
static java.util.List<Def> |
convertAll(java.util.List<Def> ds,
Env<Variable> vars,
Env<TypeVariable> typevars)
Convenience method, to apply convert to a list of defs. |
Def |
subMap(java.util.Map<FreeVariable,? extends Argument> m)
|
Def |
subst(Argument a,
FreeVariable x)
|
Def |
subst(Type T,
FreeTypeVariable X)
|
static java.util.List<Def> |
substAll(java.util.List<Def> defs,
Argument a,
FreeVariable x)
|
static java.util.List<Def> |
substAll(java.util.List<Def> defs,
Type T,
FreeTypeVariable X)
|
java.lang.String |
toString()
|
java.util.Set<Variable> |
vars()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
name
public Variable name
formals
public java.util.List<Variable> formals
body
public Expression body
typeParams
protected java.util.List<TypeVariable> typeParams
argTypes
protected java.util.List<Type> argTypes
resultType
protected Type resultType
location
protected SourceLocation location
Def
public Def(Variable name,
java.util.List<Variable> formals,
Expression body,
java.util.List<TypeVariable> typeParams,
java.util.List<Type> argTypes,
Type resultType,
SourceLocation location)
- Note that the constructor takes a bound Var as a name parameter. This is because the
binding of expression names occurs at the level of mutually recursive groups, not at
the level of the individual definitions.
- Parameters:
location
-
subst
public Def subst(Argument a,
FreeVariable x)
subMap
public Def subMap(java.util.Map<FreeVariable,? extends Argument> m)
subst
public Def subst(Type T,
FreeTypeVariable X)
substAll
public static java.util.List<Def> substAll(java.util.List<Def> defs,
Argument a,
FreeVariable x)
substAll
public static java.util.List<Def> substAll(java.util.List<Def> defs,
Type T,
FreeTypeVariable X)
vars
public java.util.Set<Variable> vars()
convert
public Def convert(Env<Variable> vars,
Env<TypeVariable> typevars)
throws CompilationException
- Throws:
CompilationException
convertAll
public static java.util.List<Def> convertAll(java.util.List<Def> ds,
Env<Variable> vars,
Env<TypeVariable> typevars)
throws CompilationException
- Convenience method, to apply convert to a list of defs.
- Parameters:
ds
- A list of defsvars
- typevars
-
- Returns:
- The list of expressions, converted
- Throws:
CompilationException
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object