Class Compiles

    • Constructor Detail

      • Compiles

        public Compiles()
    • 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.
      • toValDecl

        public static Ast.ValDecl toValDecl​(Ast.Exp statement)
        Converts e to val = e.