Project

General

Profile

Download (3.18 KB) Statistics
| Branch: | Tag: | Revision:
1
open Utils
2

    
3
module type BASIC_TYPES = sig
4
  type t
5

    
6
  val pp : Format.formatter -> t -> unit
7

    
8
  val pp_c : Format.formatter -> t -> unit
9

    
10
  val is_scalar_type : t -> bool
11

    
12
  val is_numeric_type : t -> bool
13

    
14
  val is_int_type : t -> bool
15

    
16
  val is_real_type : t -> bool
17

    
18
  val is_bool_type : t -> bool
19

    
20
  val is_dimension_type : t -> bool
21

    
22
  val type_int_builder : t
23

    
24
  val type_real_builder : t
25

    
26
  val type_bool_builder : t
27

    
28
  val type_string_builder : t
29

    
30
  val unify : t -> t -> unit
31

    
32
  val is_unifiable : t -> t -> bool
33
end
34

    
35
module type S = sig
36
  module BasicT : BASIC_TYPES
37

    
38
  type basic_type = BasicT.t
39

    
40
  type t = { mutable tdesc : type_desc; tid : int }
41

    
42
  and type_desc =
43
    | Tconst of ident
44
    (* type constant *)
45
    | Tbasic of basic_type
46
    | Tclock of t
47
    (* A type expression explicitely tagged as carrying a clock *)
48
    | Tarrow of t * t
49
    | Ttuple of t list
50
    | Tenum of ident list
51
    | Tstruct of (ident * t) list
52
    | Tarray of Dimension.t * t
53
    | Tstatic of Dimension.t * t
54
    (* a type carried by a dimension expression *)
55
    | Tlink of t
56
    (* During unification, make links instead of substitutions *)
57
    | Tvar
58
    (* Monomorphic type variable *)
59
    | Tunivar
60
  (* Polymorphic type variable *)
61

    
62
  type error =
63
    | Unbound_value of ident
64
    | Already_bound of ident
65
    | Already_defined of ident
66
    | Undefined_var of ISet.t
67
    | Declared_but_undefined of ident
68
    | Unbound_type of ident
69
    | Not_a_dimension
70
    | Not_a_constant
71
    | Assigned_constant of ident
72
    | WrongArity of int * int
73
    | WrongMorphism of int * int
74
    | Type_mismatch of ident
75
    | Type_clash of t * t
76
    | Poly_imported_node of ident
77

    
78
  exception Unify of t * t
79

    
80
  exception Error of Location.t * error
81

    
82
  val is_real_type : t -> bool
83

    
84
  val is_int_type : t -> bool
85

    
86
  val is_bool_type : t -> bool
87

    
88
  val is_const_type : t -> ident -> bool
89

    
90
  val is_static_type : t -> bool
91

    
92
  val is_array_type : t -> bool
93

    
94
  val is_dimension_type : t -> bool
95

    
96
  val is_address_type : t -> bool
97

    
98
  val is_generic_type : t -> bool
99

    
100
  val pp : Format.formatter -> t -> unit
101

    
102
  val repr : t -> t
103

    
104
  val dynamic_type : t -> t
105

    
106
  val type_desc : t -> type_desc
107

    
108
  val new_var : unit -> t
109

    
110
  val new_univar : unit -> t
111

    
112
  val new_ty : type_desc -> t
113

    
114
  val type_int : type_desc
115

    
116
  val type_real : type_desc
117

    
118
  val type_bool : type_desc
119

    
120
  val type_string : type_desc
121

    
122
  val array_element_type : t -> t
123

    
124
  val type_list_of_type : t -> t list
125

    
126
  val pp_node_ty : Format.formatter -> t -> unit
127

    
128
  val get_clock_base_type : t -> t option
129

    
130
  val get_static_value : t -> Dimension.t option
131

    
132
  val types_of_tuple_type : t -> t list
133

    
134
  val is_tuple_type : t -> bool
135

    
136
  val type_of_type_list : t list -> t
137

    
138
  val split_arrow : t -> t * t
139

    
140
  val unclock_type : t -> t
141

    
142
  val bottom : t
143

    
144
  val map_tuple_type : (t -> t) -> t -> t
145

    
146
  val array_base_type : t -> t
147

    
148
  val array_type_dimension : t -> Dimension.t
149

    
150
  val pp_error : Format.formatter -> error -> unit
151

    
152
  val struct_field_type : t -> ident -> t
153

    
154
  val array_type_multi_dimension : t -> Dimension.t list
155
end
156

    
157
module Make (BasicT : BASIC_TYPES) : sig
158
  include S
159

    
160
  val pp_ty_param :
161
    (Format.formatter -> basic_type -> unit) -> Format.formatter -> t -> unit
162
end
163
with module BasicT = BasicT
164

    
165
include S
(90-90/99)