package rfsm

  1. Overview
  2. Docs

Module Rfsm.TypesSource

Types

Sourcetype date = int
Sourcetype dir =
  1. | IO_In
  2. | IO_Out
  3. | IO_Inout
Sourcemodule VarSet : Set.S with type elt = string
Sourcemodule Index : sig ... end
Sourcetype typ =
  1. | TyEvent
  2. | TyBool
  3. | TyEnum of name * string list
    (*

    Name, list of values

    *)
  4. | TyInt of siz
  5. | TyFloat
  6. | TyChar
  7. | TyArray of Index.t * typ
    (*

    size, subtype

    *)
  8. | TyVar of typ var
    (*

    Internal use only

    *)
  9. | TyArrow of typ * typ
    (*

    Internal use only

    *)
  10. | TyProduct of typ list
    (*

    Internal use only

    *)
  11. | TyRecord of name * (string * typ) list
    (*

    Name, fields

    *)
Sourceand siz =
  1. | SzExpr1 of Index.t
    (*

    For ints: bit width, for arrays: dimension

    *)
  2. | SzExpr2 of Index.t * Index.t
    (*

    For ints: range, for arrays: dimensions

    *)
  3. | SzVar of siz var
Sourceand name =
  1. | NmLit of string
  2. | NmVar of name var
Sourceand 'a var = {
  1. stamp : string;
  2. mutable value : 'a value;
}
Sourceand 'a value =
  1. | Unknown
  2. | Known of 'a
Sourcetype typ_scheme = {
  1. ts_tparams : typ var list;
  2. ts_sparams : siz var list;
  3. ts_body : typ;
}
Sourceval make_var : unit -> 'a var
Sourceval new_type_var : unit -> typ
Sourceval new_size_var : unit -> siz
Sourceval new_name_var : unit -> name
Sourceval real_type : typ -> typ
Sourceval real_size : siz -> siz
Sourceval real_name : name -> name
Sourceval no_type : typ
Sourceval type_int : int list -> typ

Exceptions

Sourceexception TypeConflict of typ * typ
Sourceexception TypeCircularity of typ * typ

Accessors

Sourceval is_event_type : typ -> bool

is_event_type t is true iff t=TyEvent

Sourceval ivars_of : typ -> string list

ivars_of t returns the list of index variables occuring in type t

Sourceval enums_of : typ -> (string * typ) list

tycons_of t returns the list of enum constructors occuring in type t, with the associated type

Sourceval size_of : typ -> int

size_of t returns the "size" of type

Sourceval subtype_of : typ -> typ

subtype (TyArray (sz,ty') returns the ty', ...

Sourceval is_lit_name : name -> bool

is_lit_name n returns true iff n=NmLit _

Typing

Sourceval subst_indexes : Index.env -> typ -> typ

subst_indexes env t substitutes all index variables listed in env in type t

Sourceval 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).

Sourceval unify : typ -> typ -> unit
Sourceval type_instance : typ_scheme -> typ

Printers

Sourceval string_of_type_scheme : typ_scheme -> string
Sourceval string_of_type : ?szvars:bool -> typ -> string
Sourceval string_of_name : name -> string