Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / src / type_predef.ml @ 22fe1c93

History | View | Annotate | Download (2.88 KB)

1
(* ----------------------------------------------------------------------------
2
 * SchedMCore - A MultiCore Scheduling Framework
3
 * Copyright (C) 2009-2011, ONERA, Toulouse, FRANCE - LIFL, Lille, FRANCE
4
 *
5
 * This file is part of Prelude
6
 *
7
 * Prelude is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU Lesser General Public License
9
 * as published by the Free Software Foundation ; either version 2 of
10
 * the License, or (at your option) any later version.
11
 *
12
 * Prelude is distributed in the hope that it will be useful, but
13
 * WITHOUT ANY WARRANTY ; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
 * Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public
18
 * License along with this program ; if not, write to the Free Software
19
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20
 * USA
21
 *---------------------------------------------------------------------------- *)
22

    
23
(** Base types and predefined operator types. *)
24
open Types
25

    
26
let type_int = new_ty Tint
27
let type_real = new_ty Treal
28
let type_bool = new_ty Tbool
29
let type_clock ty = new_ty (Tclock ty)
30
let type_const tname = new_ty (Tconst tname)
31
let type_enum taglist = new_ty (Tenum taglist)
32
let type_tuple tl = new_ty (Ttuple tl)
33
let type_arrow ty1 ty2 = new_ty (Tarrow (ty1, ty2))
34
let type_array d ty = new_ty (Tarray (d, ty))
35
let type_static d ty = new_ty (Tstatic (d, ty))
36

    
37

    
38
let type_unary_bool_op =
39
  new_ty (Tarrow (type_bool, type_bool))
40

    
41
let type_unary_poly_op =
42
  let univ = new_univar () in
43
  new_ty (Tarrow (univ, univ))
44

    
45
let type_bin_int_op =
46
  new_ty (Tarrow (new_ty (Ttuple [type_int;type_int]), type_int))
47

    
48
let type_bin_bool_op =
49
  new_ty (Tarrow (new_ty (Ttuple [type_bool;type_bool]), type_bool))
50

    
51
let type_ite_op =
52
  let univ = new_univar () in
53
  new_ty (Tarrow ((new_ty (Ttuple [type_bool;univ;univ])), univ))
54

    
55
let type_bin_poly_op =
56
  let univ = new_univar () in
57
  new_ty (Tarrow ((new_ty (Ttuple [univ;univ])), univ))
58

    
59
let type_bin_comp_op =
60
  let univ = new_univar () in
61
  new_ty (Tarrow (new_ty (Ttuple [univ;univ]), type_bool))
62

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

    
67
let type_bool_univ3 =
68
  let univ = new_univar () in
69
  new_ty (Tarrow ((new_ty (Ttuple [type_bool;univ;univ])), univ))
70

    
71
let type_access =
72
  let d = Dimension.mkdim Location.dummy_loc Dimension.Dunivar in
73
  let d' = Dimension.mkdim Location.dummy_loc Dimension.Dunivar in
74
  let univ = new_univar () in
75
  type_arrow (type_tuple [type_array d univ; type_static d' type_int]) univ
76

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

    
82
(* Local Variables: *)
83
(* compile-command:"make -C .." *)
84
(* End: *)