typer.mli 1.19 KB
Newer Older
1
exception NonExhaustive of Types.descr
2
exception MultipleLabel of Types.label
3
exception Constraint of Types.descr * Types.descr * string
4
exception ShouldHave of Types.descr * string
5
exception WrongLabel of Types.descr * Types.label
6
exception UnboundId of string
7

8 9 10
open Ident
module Env : Map.S with type key = Ident.id
module TypeEnv : Map.S with type key = string
11
type env = Types.descr Env.t
12
type ti
13
type glb = ti TypeEnv.t
14 15

val compile_regexp : Ast.regexp -> Ast.ppat -> Ast.ppat
16

17 18 19
val register_global_types : glb -> (string * Ast.ppat) list -> glb
val typ : glb -> Ast.ppat -> Typed.ttyp
val pat : glb -> Ast.ppat -> Typed.tpat
20
val expr: glb -> Ast.pexpr -> fv * Typed.texpr
21
val let_decl : glb -> Ast.ppat -> Ast.pexpr -> Typed.let_decl
22

23

24
val type_check: 
25
  env -> Typed.texpr -> Types.descr -> bool -> Types.descr
26 27 28 29
  (* [compute_type env e t precise] checks that expression [e] 
     has type [t] under typing environment [env]; if [precise=true], 
     also returns a possible more precise type for [e].
  *)
30
val type_let_decl: env -> Typed.let_decl -> (id * Types.descr) list
31
     
32
val type_rec_funs: env -> Typed.let_decl list -> (id * Types.descr) list
33
  (* Assume that all the expressions are Absstractions *)