Project

General

Profile

Download (8.42 KB) Statistics
| Branch: | Tag: | Revision:
1
(********************************************************************)
2
(*                                                                  *)
3
(*  The LustreC compiler toolset   /  The LustreC Development Team  *)
4
(*  Copyright 2012 -    --   ONERA - CNRS - INPT                    *)
5
(*                                                                  *)
6
(*  LustreC is free software, distributed WITHOUT ANY WARRANTY      *)
7
(*  under the terms of the GNU Lesser General Public License        *)
8
(*  version 2.1.                                                    *)
9
(*                                                                  *)
10
(********************************************************************)
11

    
12
open Lustre_types
13

    
14
module VDeclModule : sig
15
  type t
16

    
17
  val compare : t -> t -> int
18
end
19
with type t = Lustre_types.var_decl
20

    
21
module VSet : sig
22
  include Set.S
23

    
24
  val pp : Format.formatter -> t -> unit
25

    
26
  val get : ident -> t -> elt
27
end
28
with type elt = Lustre_types.var_decl
29

    
30
val dummy_type_dec : type_dec
31

    
32
val dummy_clock_dec : clock_dec
33

    
34
val mktyp : Location.t -> type_dec_desc -> type_dec
35

    
36
val mkclock : Location.t -> clock_dec_desc -> clock_dec
37

    
38
val mkvar_decl :
39
  Location.t ->
40
  ?orig:bool ->
41
  ident
42
  * type_dec
43
  * clock_dec
44
  * bool (* is const *)
45
  * expr option
46
  (* value *)
47
  * string option
48
  (* parent id *) ->
49
  var_decl
50

    
51
val dummy_var_decl : ident -> Types.type_expr -> var_decl
52

    
53
val var_decl_of_const : ?parentid:ident option -> const_desc -> var_decl
54

    
55
val mkexpr : Location.t -> expr_desc -> expr
56

    
57
val mkeq : Location.t -> ident list * expr -> eq
58

    
59
val mkassert : Location.t -> expr -> assert_t
60

    
61
val mktop_decl : Location.t -> ident -> bool -> top_decl_desc -> top_decl
62

    
63
val mkpredef_call : Location.t -> ident -> expr list -> expr
64

    
65
val mk_new_name : (ident -> bool) -> ident -> ident
66

    
67
val mk_new_node_name : node_desc -> ident -> ident
68

    
69
val mktop : top_decl_desc -> top_decl
70

    
71
(* constructor for machine types *)
72
val mkinstr :
73
  ?lustre_eq:(* ?lustre_expr:expr -> *)
74
             eq ->
75
  ?instr_spec:Machine_code_types.value_t Spec_types.formula_t list ->
76
  Machine_code_types.instr_t_desc ->
77
  Machine_code_types.instr_t
78

    
79
val get_instr_desc :
80
  Machine_code_types.instr_t -> Machine_code_types.instr_t_desc
81

    
82
val update_instr_desc :
83
  Machine_code_types.instr_t ->
84
  Machine_code_types.instr_t_desc ->
85
  Machine_code_types.instr_t
86

    
87
(*val node_table : (ident, top_decl) Hashtbl.t*)
88
val print_node_table : Format.formatter -> unit -> unit
89

    
90
val node_name : top_decl -> ident
91

    
92
val node_inputs : top_decl -> var_decl list
93

    
94
val node_from_name : ident -> top_decl
95

    
96
val update_node : ident -> top_decl -> unit
97

    
98
val is_generic_node : top_decl -> bool
99

    
100
val is_imported_node : top_decl -> bool
101

    
102
val is_contract : top_decl -> bool
103

    
104
val is_node_contract : node_desc -> bool
105

    
106
val get_node_contract : node_desc -> contract_desc
107

    
108
val consts_table : (ident, top_decl) Hashtbl.t
109

    
110
val print_consts_table : Format.formatter -> unit -> unit
111

    
112
val type_table : (type_dec_desc, top_decl) Hashtbl.t
113

    
114
val print_type_table : Format.formatter -> unit -> unit
115

    
116
val is_clock_dec_type : type_dec_desc -> bool
117

    
118
val get_repr_type : type_dec_desc -> type_dec_desc
119

    
120
val is_user_type : type_dec_desc -> bool
121

    
122
val coretype_equal : type_dec_desc -> type_dec_desc -> bool
123

    
124
val tag_default : label
125

    
126
val tag_table : (label, top_decl) Hashtbl.t
127

    
128
val field_table : (label, top_decl) Hashtbl.t
129

    
130
val get_enum_type_tags : type_dec_desc -> label list
131

    
132
val get_struct_type_fields : type_dec_desc -> (label * type_dec_desc) list
133

    
134
val consts_of_enum_type : top_decl -> top_decl list
135

    
136
val const_of_bool : bool -> constant
137

    
138
val const_is_bool : constant -> bool
139

    
140
val const_negation : constant -> constant
141

    
142
val const_or : constant -> constant -> constant
143

    
144
val const_and : constant -> constant -> constant
145

    
146
val const_xor : constant -> constant -> constant
147

    
148
val const_impl : constant -> constant -> constant
149

    
150
val get_var : ident -> var_decl list -> var_decl
151

    
152
val get_node_vars : node_desc -> var_decl list
153

    
154
val get_node_var : ident -> node_desc -> var_decl
155

    
156
val get_node_eqs : node_desc -> eq list * automata_desc list
157

    
158
val get_node_eq : ident -> node_desc -> eq
159

    
160
val get_node_interface : node_desc -> imported_node_desc
161

    
162
(* val get_const: ident -> constant *)
163

    
164
val sort_handlers : (label * 'a) list -> (label * 'a) list
165

    
166
val is_eq_expr : expr -> expr -> bool
167

    
168
(* val pp_error : Format.formatter -> error -> unit *)
169

    
170
(* Caution, returns an untyped, unclocked, etc, expression *)
171
val is_tuple_expr : expr -> bool
172

    
173
val ident_of_expr : expr -> ident
174

    
175
val expr_of_vdecl : var_decl -> expr
176

    
177
val expr_of_ident : ident -> Location.t -> expr
178

    
179
val expr_list_of_expr : expr -> expr list
180

    
181
val expr_of_expr_list : Location.t -> expr list -> expr
182

    
183
val call_of_expr : expr -> ident * expr list * expr option
184

    
185
val expr_of_dimension : Dimension.dim_expr -> expr
186

    
187
val dimension_of_expr : expr -> Dimension.dim_expr
188

    
189
val dimension_of_const : Location.t -> constant -> Dimension.dim_expr
190

    
191
val expr_to_eexpr : expr -> eexpr
192
(* REMOVED, pushed in utils.ml val new_tag : unit -> tag *)
193

    
194
val add_internal_funs : unit -> unit
195

    
196
val pp_prog_type : Format.formatter -> program_t -> unit
197

    
198
val pp_prog_clock : Format.formatter -> program_t -> unit
199

    
200
val const_of_top : top_decl -> const_desc
201

    
202
val node_of_top : top_decl -> node_desc
203

    
204
val imported_node_of_top : top_decl -> imported_node_desc
205

    
206
val typedef_of_top : top_decl -> typedef_desc
207

    
208
val dependency_of_top : top_decl -> bool * ident
209

    
210
val get_nodes : program_t -> top_decl list
211

    
212
val get_imported_nodes : program_t -> top_decl list
213

    
214
val get_consts : program_t -> top_decl list
215

    
216
val get_typedefs : program_t -> top_decl list
217

    
218
val get_dependencies : program_t -> top_decl list
219
(* val prog_unfold_consts: program_t -> program_t *)
220

    
221
val get_node : ident -> program_t -> node_desc
222
(** Returns the node named ident in the provided program. Raise Not_found *)
223

    
224
val rename_static :
225
  (ident -> Dimension.dim_expr) -> type_dec_desc -> type_dec_desc
226

    
227
val rename_carrier : (ident -> ident) -> clock_dec_desc -> clock_dec_desc
228

    
229
val get_expr_vars : expr -> Utils.ISet.t
230
(*val expr_replace_var: (ident -> ident) -> expr -> expr*)
231

    
232
val eq_replace_rhs_var : (ident -> bool) -> (ident -> ident) -> eq -> eq
233

    
234
val rename_expr : (ident -> ident) -> (ident -> ident) -> expr -> expr
235
(** val rename_expr f_node f_var expr *)
236

    
237
val rename_eq : (ident -> ident) -> (ident -> ident) -> eq -> eq
238
(** val rename_eq f_node f_var eq *)
239

    
240
val rename_aut :
241
  (ident -> ident) -> (ident -> ident) -> automata_desc -> automata_desc
242
(** val rename_aut f_node f_var aut *)
243

    
244
val rename_prog :
245
  (ident -> ident) ->
246
  (ident -> ident) ->
247
  (ident -> ident) ->
248
  program_t ->
249
  program_t
250
(** rename_prog f_node f_var f_const prog *)
251

    
252
val rename_node : (ident -> ident) -> (ident -> ident) -> node_desc -> node_desc
253

    
254
val substitute_expr : var_decl list -> eq list -> expr -> expr
255

    
256
val copy_var_decl : var_decl -> var_decl
257

    
258
val copy_const : const_desc -> const_desc
259

    
260
val copy_node : node_desc -> node_desc
261

    
262
val copy_top : top_decl -> top_decl
263

    
264
val copy_prog : top_decl list -> top_decl list
265

    
266
val mkeexpr : Location.t -> expr -> eexpr
267
(** Annotation expression related functions *)
268

    
269
val empty_contract : contract_desc
270

    
271
val mk_contract_var :
272
  ident -> bool -> type_dec option -> expr -> Location.t -> contract_desc
273

    
274
val mk_contract_guarantees : string option -> eexpr -> contract_desc
275

    
276
val mk_contract_assume : string option -> eexpr -> contract_desc
277

    
278
val mk_contract_mode :
279
  ident -> eexpr list -> eexpr list -> Location.t -> contract_desc
280

    
281
val mk_contract_import : ident -> expr -> expr -> Location.t -> contract_desc
282

    
283
val merge_contracts : contract_desc -> contract_desc -> contract_desc
284

    
285
val extend_eexpr : (quantifier_type * var_decl list) list -> eexpr -> eexpr
286

    
287
val update_expr_annot : ident -> expr -> expr_annot -> expr
288
(* val mkpredef_call: Location.t -> ident -> eexpr list -> eexpr*)
289

    
290
val expr_contains_expr : tag -> expr -> bool
291

    
292
val reset_cpt_fresh : unit -> unit
293

    
294
(* mk_fresh_var parentid to be registered as parent_nodeid, vars is the list of
295
   existing vars in that context *)
296
val mk_fresh_var :
297
  ident * var_decl list ->
298
  Location.t ->
299
  Types.type_expr ->
300
  Clocks.clock_expr ->
301
  var_decl
302

    
303
val find_eq : ident list -> eq list -> eq * eq list
304

    
305
val get_expr_calls : top_decl list -> expr -> Utils.ISet.t
306

    
307
(* val eq_has_arrows: eq -> bool *)
308

    
309
val push_negations : ?neg:bool -> expr -> expr
310

    
311
val add_pre_expr : ident list -> expr -> expr
312

    
313
val mk_eq : Location.t -> expr -> expr -> expr
314

    
315
(* Simple transformations: eg computation over constants *)
316
val partial_eval : expr -> expr
317

    
318
(* Local Variables: *)
319
(* compile-command:"make -C .." *)
320
(* End: *)
(16-16/66)