Project

General

Profile

Download (3.21 KB) Statistics
| Branch: | Tag: | Revision:
1
(********************************************************************)
2
(*                                                                  *)
3
(*  The LustreC compiler toolset   /  The LustreC Development Team  *)
4
(*  Copyright 2012 -    --   ONERA - CNRS - INPT - LIFL             *)
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
(*  This file was originally from the Prelude compiler              *)
11
(*                                                                  *)
12
(********************************************************************)
13

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

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

    
21
  let type_int = new_ty type_int
22

    
23
  let type_real = new_ty type_real
24

    
25
  let type_bool = new_ty type_bool
26

    
27
  let type_string = new_ty type_string
28

    
29
  let type_clock ty = new_ty (Tclock ty)
30

    
31
  let type_const tname = new_ty (Tconst tname)
32

    
33
  let type_enum taglist = new_ty (Tenum taglist)
34

    
35
  let type_struct fieldlist = new_ty (Tstruct fieldlist)
36

    
37
  let type_tuple tl = new_ty (Ttuple tl)
38

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

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

    
43
  let type_static d ty = new_ty (Tstatic (d, ty))
44

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

    
47
  let type_unary_poly_op =
48
    let univ = new_univar () in
49
    type_arrow univ univ
50

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

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

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

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

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

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

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

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

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

    
88
(* module BaseBuilder = *)
89
(* struct *)
90
(*   let type_int_builder = Tbasic Basic.Tint *)
91
(*   let type_real_builder = Tbasic Basic.Treal *)
92
(*   let type_bool_builder = Tbasic Basic.Tbool *)
93
(*   let type_string_builder = Tbasic Basic.Tstring *)
94
(* end *)
95

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

    
99
(* Local Variables: *)
100
(* compile-command:"make -C .." *)
101
(* End: *)
(60-60/66)