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
module Env : Map.S with type key = string
9
module Fv : Set.S with type elt = string
10
type env = Types.descr Env.t
11
12
13
14
type ti
type glb = ti Env.t

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

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

22

23
24
25
26
27
28
val type_check: 
  Types.descr Env.t -> Typed.texpr -> Types.descr -> bool -> Types.descr
  (* [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].
  *)
29
val type_let_decl: env -> Typed.let_decl -> (string * Types.descr) list
30
     
31
32
val type_rec_funs: env -> Typed.let_decl list -> (string * Types.descr) list
  (* Assume that all the expressions are Absstractions *)