Project

General

Profile

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

    
3
type register_t = ResetFlag | StateVar of var_decl
4

    
5
type left_v
6

    
7
type right_v
8

    
9
type ('a, _) expression_t =
10
  | Val : 'a -> ('a, right_v) expression_t
11
  | Tag : ident -> ('a, right_v) expression_t
12
  | Var : var_decl -> ('a, left_v) expression_t
13
  | Memory : register_t -> ('a, left_v) expression_t
14

    
15
(** TODO: why moving this elsewhere makes the exhaustiveness check fail? *)
16
let type_of_l_value : type a. (a, left_v) expression_t -> Types.type_expr =
17
  function
18
  | Var v ->
19
    v.var_type
20
  | Memory ResetFlag ->
21
    Type_predef.type_bool
22
  | Memory (StateVar v) ->
23
    v.var_type
24

    
25
type 'a predicate_t =
26
  | Transition :
27
      ident (* node name *)
28
      * ident option
29
      (* instance *)
30
      * int option
31
      (* transition index *)
32
      * ('a, 'b) expression_t list
33
      (* variables *)
34
      * bool (* reset *)
35
      * Utils.ISet.t (* memory footprint *)
36
      * ident Utils.IMap.t
37
      (* memory instances footprint *)
38
      -> 'a predicate_t
39
  | Reset of ident * ident * 'a
40
  | MemoryPack of ident * ident option * int option
41
  | Initialization
42
  | ResetCleared of ident
43

    
44
type 'a formula_t =
45
  | True
46
  | False
47
  | Equal : ('a, left_v) expression_t * ('a, 'b) expression_t -> 'a formula_t
48
  | And of 'a formula_t list
49
  | Or of 'a formula_t list
50
  | Imply of 'a formula_t * 'a formula_t
51
  | Exists of var_decl list * 'a formula_t
52
  | Forall of var_decl list * 'a formula_t
53
  | Ternary :
54
      ('a, 'b) expression_t * 'a formula_t * 'a formula_t
55
      -> 'a formula_t
56
  | Predicate : 'a predicate_t -> 'a formula_t
57
  | StateVarPack of register_t
58
  | ExistsMem of ident * 'a formula_t * 'a formula_t
59

    
60
(* type 'a simulation_t = {
61
 *   sname: node_desc;
62
 *   sindex: option int;
63
 *   sformula: 'a formula_t;
64
 * } *)
65

    
66
type 'a memory_pack_t = {
67
  mpname : node_desc;
68
  mpindex : int option;
69
  mpformula : 'a formula_t;
70
}
71

    
72
type 'a transition_t = {
73
  tname : node_desc;
74
  tindex : int option;
75
  tvars : var_decl list;
76
  tformula : 'a formula_t;
77
  tmem_footprint : Utils.ISet.t;
78
  tinst_footprint : ident Utils.IMap.t;
79
}
(58-58/66)