module Types:sig
..end
Types
typedate =
int
type
dir =
| |
IO_In |
| |
IO_Out |
| |
IO_Inout |
module VarSet:Set.S
with type elt = string
module Index:sig
..end
type
typ =
| |
TyEvent |
|||
| |
TyBool |
|||
| |
TyEnum of |
(* | Name, list of values | *) |
| |
TyInt of |
|||
| |
TyFloat |
|||
| |
TyChar |
|||
| |
TyArray of |
(* | size, subtype | *) |
| |
TyVar of |
(* | Internal use only | *) |
| |
TyArrow of |
(* | Internal use only | *) |
| |
TyProduct of |
(* | Internal use only | *) |
| |
TyRecord of |
(* | Name, fields | *) |
type
siz =
| |
SzExpr1 of |
(* | For ints: bit width, for arrays: dimension | *) |
| |
SzExpr2 of |
(* | For ints: range, for arrays: dimensions | *) |
| |
SzVar of |
type
name =
| |
NmLit of |
| |
NmVar of |
type 'a
var = {
|
stamp : |
|
mutable value : |
type 'a
value =
| |
Unknown |
| |
Known of |
type
typ_scheme = {
|
ts_tparams : |
|
ts_sparams : |
|
ts_body : |
val make_var : unit -> 'a var
val new_type_var : unit -> typ
val new_size_var : unit -> siz
val new_name_var : unit -> name
val real_type : typ -> typ
val real_size : siz -> siz
val real_name : name -> name
val no_type : typ
val type_int : int list -> typ
exception TypeConflict of typ * typ
exception TypeCircularity of typ * typ
val is_event_type : typ -> bool
is_event_type t
is true
iff t=TyEvent
val ivars_of : typ -> string list
ivars_of t
returns the list of index variables occuring in type t
val enums_of : typ -> (string * typ) list
tycons_of t
returns the list of enum constructors occuring in type t
, with the associated type
val size_of : typ -> int
size_of t
returns the "size" of type
val subtype_of : typ -> typ
subtype (TyArray (sz,ty')
returns the ty'
, ...
val is_lit_name : name -> bool
is_lit_name n
returns true
iff n=NmLit _
val subst_indexes : Index.env -> typ -> typ
subst_indexes env t
substitutes all index variables listed in env
in type t
val type_equal : strict:bool -> typ -> typ -> bool
type_equal b t t'
returns true iff types t
and t'
are "equivalent".
If b=true
, equivalence means structural equivalence (so that, for instance, TyInt None
is different from TyInt (Some (lo,hi)
.
If b=false
, all TyInt _
are equivalents and equivalence of enumerated types means
inclusion, so that, for instance, type_equal ~strict:false {On,Off} {On} = true
(but not
the other way).
val unify : typ -> typ -> unit
val type_instance : typ_scheme -> typ
val string_of_type_scheme : typ_scheme -> string
val string_of_type : ?szvars:bool -> typ -> string
val string_of_name : name -> string