Package net.hydromatic.morel.compile
Class Compiles
- java.lang.Object
-
- net.hydromatic.morel.compile.Compiles
-
public abstract class Compiles extends java.lang.ObjectHelpers forCompilerandTypeResolver.
-
-
Constructor Summary
Constructors Constructor Description Compiles()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.Iterable<Binding>bindings(TypeSystem typeSystem, java.util.Map<java.lang.String,ForeignValue> map)static EnvironmentcreateEnvironment(TypeSystem typeSystem, java.util.Map<java.lang.String,ForeignValue> valueMap)Creates an environment containing the given foreign values.private static CompiledStatementprepareDecl(TypeSystem typeSystem, Environment env, Ast.Decl decl)Validates and compiles an declaration, and compiles it to code that can be evaluated by the interpreter.static CompiledStatementprepareStatement(TypeSystem typeSystem, Environment env, AstNode statement)Validates and compiles a statement (expression or declaration), and compiles it to code that can be evaluated by the interpreter.static Ast.ExptoExp(Ast.ValDecl decl)static Ast.ValDecltoValDecl(Ast.Exp statement)Convertsetoval = e.static TypeResolver.ResolvedvalidateExpression(Ast.Exp exp, java.util.Map<java.lang.String,ForeignValue> valueMap)Validates an expression, deducing its type and perhaps rewriting the expression to a form that can more easily be compiled.
-
-
-
Method Detail
-
validateExpression
public static TypeResolver.Resolved validateExpression(Ast.Exp exp, java.util.Map<java.lang.String,ForeignValue> valueMap)
Validates an expression, deducing its type and perhaps rewriting the expression to a form that can more easily be compiled.Used for testing.
-
createEnvironment
public static Environment createEnvironment(TypeSystem typeSystem, java.util.Map<java.lang.String,ForeignValue> valueMap)
Creates an environment containing the given foreign values.
-
bindings
private static java.lang.Iterable<Binding> bindings(TypeSystem typeSystem, java.util.Map<java.lang.String,ForeignValue> map)
-
prepareStatement
public static CompiledStatement prepareStatement(TypeSystem typeSystem, Environment env, AstNode statement)
Validates and compiles a statement (expression or declaration), and compiles it to code that can be evaluated by the interpreter.
-
prepareDecl
private static CompiledStatement prepareDecl(TypeSystem typeSystem, Environment env, Ast.Decl decl)
Validates and compiles an declaration, and compiles it to code that can be evaluated by the interpreter.
-
toValDecl
public static Ast.ValDecl toValDecl(Ast.Exp statement)
Convertsetoval = e.
-
toExp
public static Ast.Exp toExp(Ast.ValDecl decl)
-
-