Revision 66359a5e src/type_predef.ml
src/type_predef.ml  

12  12 
(********************************************************************) 
13  13  
14  14 
(** Base types and predefined operator types. *) 
15 
open Types 

16  15  
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)) 

16 


17 
module Make (T: Types.S) = 

18 
struct 

19 
(* module T = Types.Make (BT) *) 

20 
module BT = T.BasicT 

21 
include T 

22 


23 
let type_int = new_ty type_int 

24 
let type_real = new_ty type_real 

25 
let type_bool = new_ty type_bool 

26 
let type_string = new_ty type_string 

27 
let type_clock ty = new_ty (Tclock ty) 

28 
let type_const tname = new_ty (Tconst tname) 

29 
let type_enum taglist = new_ty (Tenum taglist) 

30 
let type_struct fieldlist = new_ty (Tstruct fieldlist) 

31 
let type_tuple tl = new_ty (Ttuple tl) 

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

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

34 
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)) 

28  38  
29 
let type_unary_bool_op = 

30 
new_ty (Tarrow (type_bool, type_bool)) 

39 
let type_unary_poly_op = 

40 
let univ = new_univar () in 

41 
type_arrow univ univ 

31  42  
32 
let type_unary_poly_op = 

33 
let univ = new_univar () in 

34 
type_arrow univ univ 

43 
let type_bin_int_op = 

44 
type_arrow (type_tuple [type_int;type_int]) type_int 

35  45  
36 
let type_bin_int_op =


37 
type_arrow (type_tuple [type_int;type_int]) type_int


46 
let type_bin_bool_op =


47 
type_arrow (type_tuple [type_bool;type_bool]) type_bool


38  48  
39 
let type_bin_bool_op = 

40 
type_arrow (type_tuple [type_bool;type_bool]) type_bool 

49 
let type_ite_op = 

50 
let univ = new_univar () in 

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

41  52  
42 
let type_ite_op =


43 
let univ = new_univar () in 

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


53 
let type_bin_poly_op =


54 
let univ = new_univar () in


55 
type_arrow (type_tuple [univ;univ]) univ


45  56  
46 
let type_bin_poly_op =


47 
let univ = new_univar () in 

48 
type_arrow (type_tuple [univ;univ]) univ


57 
let type_bin_comp_op =


58 
let univ = new_univar () in


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


49  60  
50 
let type_bin_comp_op =


51 
let univ = new_univar () in 

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


61 
let type_univ_bool_univ =


62 
let univ = new_univar () in


63 
type_arrow (type_tuple [univ;type_bool]) univ


53  64  
54 
let type_univ_bool_univ =


55 
let univ = new_univar () in 

56 
type_arrow (type_tuple [univ;type_bool]) univ


65 
let type_bool_univ3 =


66 
let univ = new_univar () in


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


57  68  
58 
let type_bool_univ3 = 

59 
let univ = new_univar () in 

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

69 
let type_access = 

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

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

72 
let univ = new_univar () in 

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

61  74  
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


75 
let type_power =


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


77 
let univ = new_univar () in


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


79 
end


67  80  
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) 

81  
82 
(* module BaseBuilder = *) 

83 
(* struct *) 

84 
(* let type_int_builder = Tbasic Basic.Tint *) 

85 
(* let type_real_builder = Tbasic Basic.Treal *) 

86 
(* let type_bool_builder = Tbasic Basic.Tbool *) 

87 
(* let type_string_builder = Tbasic Basic.Tstring *) 

88 
(* end *) 

89 


90 
module Main = Make (Types.Main) 

91 
include Main 

72  92  
73  93 
(* Local Variables: *) 
74  94 
(* compilecommand:"make C .." *) 
Also available in: Unified diff