lustrec / src / type_predef.ml @ 29f59e36
History | View | Annotate | Download (2.66 KB)
1 | b38ffff3 | ploc | (********************************************************************) |
---|---|---|---|
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 | 0cbf0839 | ploc | |
14 | (** Base types and predefined operator types. *) |
||
15 | open Types |
||
16 | |||
17 | let type_int = new_ty Tint |
||
18 | let type_real = new_ty Treal |
||
19 | let type_bool = new_ty Tbool |
||
20 | let type_clock ty = new_ty (Tclock ty) |
||
21 | let type_const tname = new_ty (Tconst tname) |
||
22 | let type_enum taglist = new_ty (Tenum taglist) |
||
23 | aa223e69 | xthirioux | let type_struct fieldlist = new_ty (Tstruct fieldlist) |
24 | 0cbf0839 | ploc | let type_tuple tl = new_ty (Ttuple tl) |
25 | let type_arrow ty1 ty2 = new_ty (Tarrow (ty1, ty2)) |
||
26 | let type_array d ty = new_ty (Tarray (d, ty)) |
||
27 | let type_static d ty = new_ty (Tstatic (d, ty)) |
||
28 | |||
29 | |||
30 | let type_unary_bool_op = |
||
31 | new_ty (Tarrow (type_bool, type_bool)) |
||
32 | |||
33 | let type_unary_poly_op = |
||
34 | let univ = new_univar () in |
||
35 | 6b4d172f | xthirioux | type_arrow univ univ |
36 | 0cbf0839 | ploc | |
37 | let type_bin_int_op = |
||
38 | 6b4d172f | xthirioux | type_arrow (type_tuple [type_int;type_int]) type_int |
39 | 0cbf0839 | ploc | |
40 | let type_bin_bool_op = |
||
41 | 6b4d172f | xthirioux | type_arrow (type_tuple [type_bool;type_bool]) type_bool |
42 | 0cbf0839 | ploc | |
43 | let type_ite_op = |
||
44 | let univ = new_univar () in |
||
45 | 6b4d172f | xthirioux | type_arrow (type_tuple [type_bool;univ;univ]) univ |
46 | 0cbf0839 | ploc | |
47 | let type_bin_poly_op = |
||
48 | let univ = new_univar () in |
||
49 | 6b4d172f | xthirioux | type_arrow (type_tuple [univ;univ]) univ |
50 | 0cbf0839 | ploc | |
51 | let type_bin_comp_op = |
||
52 | let univ = new_univar () in |
||
53 | new_ty (Tarrow (new_ty (Ttuple [univ;univ]), type_bool)) |
||
54 | |||
55 | let type_univ_bool_univ = |
||
56 | let univ = new_univar () in |
||
57 | 6b4d172f | xthirioux | type_arrow (type_tuple [univ;type_bool]) univ |
58 | 0cbf0839 | ploc | |
59 | let type_bool_univ3 = |
||
60 | let univ = new_univar () in |
||
61 | 6b4d172f | xthirioux | type_arrow (type_tuple [type_bool;univ;univ]) univ |
62 | 0cbf0839 | ploc | |
63 | let type_access = |
||
64 | let d = Dimension.mkdim Location.dummy_loc Dimension.Dunivar in |
||
65 | let d' = Dimension.mkdim Location.dummy_loc Dimension.Dunivar in |
||
66 | let univ = new_univar () in |
||
67 | type_arrow (type_tuple [type_array d univ; type_static d' type_int]) univ |
||
68 | |||
69 | let type_power = |
||
70 | let d = Dimension.mkdim Location.dummy_loc Dimension.Dunivar in |
||
71 | let univ = new_univar () in |
||
72 | type_arrow (type_tuple [univ; type_static d type_int]) (type_array d univ) |
||
73 | |||
74 | (* Local Variables: *) |
||
75 | (* compile-command:"make -C .." *) |
||
76 | (* End: *) |