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

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

let type_struct fieldlist = new_ty (Tstruct fieldlist)

24

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

let type_unary_bool_op =

30

new_ty (Tarrow (type_bool, type_bool))

31


32

let type_unary_poly_op =

33

let univ = new_univar () in

34

type_arrow univ univ

35


36

let type_bin_int_op =

37

type_arrow (type_tuple [type_int;type_int]) type_int

38


39

let type_bin_bool_op =

40

type_arrow (type_tuple [type_bool;type_bool]) type_bool

41


42

let type_ite_op =

43

let univ = new_univar () in

44

type_arrow (type_tuple [type_bool;univ;univ]) univ

45


46

let type_bin_poly_op =

47

let univ = new_univar () in

48

type_arrow (type_tuple [univ;univ]) univ

49


50

let type_bin_comp_op =

51

let univ = new_univar () in

52

new_ty (Tarrow (new_ty (Ttuple [univ;univ]), type_bool))

53


54

let type_univ_bool_univ =

55

let univ = new_univar () in

56

type_arrow (type_tuple [univ;type_bool]) univ

57


58

let type_bool_univ3 =

59

let univ = new_univar () in

60

type_arrow (type_tuple [type_bool;univ;univ]) univ

61


62

let type_access =

63

let d = Dimension.mkdim Location.dummy_loc Dimension.Dunivar in

64

let d' = Dimension.mkdim Location.dummy_loc Dimension.Dunivar in

65

let univ = new_univar () in

66

type_arrow (type_tuple [type_array d univ; type_static d' type_int]) univ

67


68

let type_power =

69

let d = Dimension.mkdim Location.dummy_loc Dimension.Dunivar in

70

let univ = new_univar () in

71

type_arrow (type_tuple [univ; type_static d type_int]) (type_array d univ)

72


73

(* Local Variables: *)

74

(* compilecommand:"make C .." *)

75

(* End: *)
