Project

General

Profile

« Previous | Next » 

Revision ca7ff3f7

Added by LĂ©lio Brun 7 months ago

reformatting

View differences:

src/type_predef.ml
6 6
(*  LustreC is free software, distributed WITHOUT ANY WARRANTY      *)
7 7
(*  under the terms of the GNU Lesser General Public License        *)
8 8
(*  version 2.1.                                                    *)
9
(*                                                                  *) 
9
(*                                                                  *)
10 10
(*  This file was originally from the Prelude compiler              *)
11
(*                                                                  *) 
11
(*                                                                  *)
12 12
(********************************************************************)
13 13

  
14 14
(** Base types and predefined operator types. *)
15 15

  
16
  
17
module Make (T: Types.S) =
18
struct
16
module Make (T : Types.S) = struct
19 17
  (* module T = Types.Make (BT) *)
20 18
  module BT = T.BasicT
21
  include T 
22
  
19
  include T
20

  
23 21
  let type_int = new_ty type_int
22

  
24 23
  let type_real = new_ty type_real
24

  
25 25
  let type_bool = new_ty type_bool
26

  
26 27
  let type_string = new_ty type_string
28

  
27 29
  let type_clock ty = new_ty (Tclock ty)
30

  
28 31
  let type_const tname = new_ty (Tconst tname)
32

  
29 33
  let type_enum taglist = new_ty (Tenum taglist)
34

  
30 35
  let type_struct fieldlist = new_ty (Tstruct fieldlist)
36

  
31 37
  let type_tuple tl = new_ty (Ttuple tl)
38

  
32 39
  let type_arrow ty1 ty2 = new_ty (Tarrow (ty1, ty2))
40

  
33 41
  let type_array d ty = new_ty (Tarray (d, ty))
42

  
34 43
  let type_static d ty = new_ty (Tstatic (d, ty))
35
    
36
  let type_unary_bool_op =
37
    new_ty (Tarrow (type_bool, type_bool))
44

  
45
  let type_unary_bool_op = new_ty (Tarrow (type_bool, type_bool))
38 46

  
39 47
  let type_unary_poly_op =
40 48
    let univ = new_univar () in
41 49
    type_arrow univ univ
42 50

  
43
  let type_bin_int_op =
44
    type_arrow (type_tuple [type_int;type_int]) type_int
51
  let type_bin_int_op = type_arrow (type_tuple [ type_int; type_int ]) type_int
45 52

  
46 53
  let type_bin_bool_op =
47
    type_arrow (type_tuple [type_bool;type_bool]) type_bool
54
    type_arrow (type_tuple [ type_bool; type_bool ]) type_bool
48 55

  
49 56
  let type_ite_op =
50 57
    let univ = new_univar () in
51
    type_arrow (type_tuple [type_bool;univ;univ]) univ
58
    type_arrow (type_tuple [ type_bool; univ; univ ]) univ
52 59

  
53 60
  let type_bin_poly_op =
54 61
    let univ = new_univar () in
55
    type_arrow (type_tuple [univ;univ]) univ
62
    type_arrow (type_tuple [ univ; univ ]) univ
56 63

  
57 64
  let type_bin_comp_op =
58 65
    let univ = new_univar () in
59
    new_ty (Tarrow (new_ty (Ttuple [univ;univ]), type_bool))
66
    new_ty (Tarrow (new_ty (Ttuple [ univ; univ ]), type_bool))
60 67

  
61 68
  let type_univ_bool_univ =
62 69
    let univ = new_univar () in
63
    type_arrow (type_tuple [univ;type_bool]) univ
70
    type_arrow (type_tuple [ univ; type_bool ]) univ
64 71

  
65 72
  let type_bool_univ3 =
66 73
    let univ = new_univar () in
67
    type_arrow (type_tuple [type_bool;univ;univ]) univ
74
    type_arrow (type_tuple [ type_bool; univ; univ ]) univ
68 75

  
69 76
  let type_access =
70 77
    let d = Dimension.mkdim Location.dummy_loc Dimension.Dunivar in
71 78
    let d' = Dimension.mkdim Location.dummy_loc Dimension.Dunivar in
72 79
    let univ = new_univar () in
73
    type_arrow (type_tuple [type_array d univ; type_static d' type_int]) univ
80
    type_arrow (type_tuple [ type_array d univ; type_static d' type_int ]) univ
74 81

  
75 82
  let type_power =
76 83
    let d = Dimension.mkdim Location.dummy_loc Dimension.Dunivar in
77 84
    let univ = new_univar () in
78
    type_arrow (type_tuple [univ; type_static d type_int]) (type_array d univ)
85
    type_arrow (type_tuple [ univ; type_static d type_int ]) (type_array d univ)
79 86
end
80 87

  
81

  
82 88
(* module BaseBuilder = *)
83 89
(* struct *)
84 90
(*   let type_int_builder = Tbasic Basic.Tint *)
......
86 92
(*   let type_bool_builder = Tbasic Basic.Tbool *)
87 93
(*   let type_string_builder = Tbasic Basic.Tstring *)
88 94
(* end *)
89
  
95

  
90 96
module Main = Make (Types.Main)
91 97
include Main
92 98

  

Also available in: Unified diff