Module Checker.Typecheck

the module that performs type checking (not borrow checking) and convert a source program into the ANF IR. This module also defines a data structure holding source information that link IR values to their source in the surface syntax. See Typecheck.type_info

type type_info = {
block_typs : (IR.label, string * Syntax.typ option) Stdlib.Hashtbl.t;
functions : (string, Syntax.function_typ) Stdlib.Hashtbl.t;
variables : (IR.variableIR.source * IR.var_kind) Stdlib.Hashtbl.t;
}
  • block_typs contains the type of the parameters of blocks in the IR. It also contains a short string description for every block.
  • functions contains the syntactic type of every function
  • variables contains, for each IR variable:

    • the source expression it corresponds to
    • whether it is temporary or not (see IR.var_kind)
val make_type_info : unit -> type_info
val check_function : type_info -> Syntax.function_def -> IR.function_def