## lustrec / src / type_predef.ml @ e6b644f4

History | View | Annotate | Download (3.2 KB)

1 | a2d97a3e | 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 | 22fe1c93 | ploc | |

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

15 | |||

16 | 66359a5e | ploc | |

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

38 | 22fe1c93 | ploc | |

39 | 66359a5e | ploc | let type_unary_poly_op = |

40 | let univ = new_univar () in |
||

41 | type_arrow univ univ |
||

42 | 22fe1c93 | ploc | |

43 | 66359a5e | ploc | let type_bin_int_op = |

44 | type_arrow (type_tuple [type_int;type_int]) type_int |
||

45 | 22fe1c93 | ploc | |

46 | 66359a5e | ploc | let type_bin_bool_op = |

47 | type_arrow (type_tuple [type_bool;type_bool]) type_bool |
||

48 | 22fe1c93 | ploc | |

49 | 66359a5e | ploc | let type_ite_op = |

50 | let univ = new_univar () in |
||

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

52 | 22fe1c93 | ploc | |

53 | 66359a5e | ploc | let type_bin_poly_op = |

54 | let univ = new_univar () in |
||

55 | type_arrow (type_tuple [univ;univ]) univ |
||

56 | 22fe1c93 | ploc | |

57 | 66359a5e | ploc | let type_bin_comp_op = |

58 | let univ = new_univar () in |
||

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

60 | 22fe1c93 | ploc | |

61 | 66359a5e | ploc | let type_univ_bool_univ = |

62 | let univ = new_univar () in |
||

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

64 | 22fe1c93 | ploc | |

65 | 66359a5e | ploc | let type_bool_univ3 = |

66 | let univ = new_univar () in |
||

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

68 | 22fe1c93 | ploc | |

69 | 66359a5e | ploc | 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 |
||

74 | 22fe1c93 | ploc | |

75 | 66359a5e | ploc | 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 |
||

80 | 22fe1c93 | ploc | |

81 | 66359a5e | ploc | |

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

92 | 22fe1c93 | ploc | |

93 | (* Local Variables: *) |
||

94 | (* compile-command:"make -C .." *) |
||

95 | (* End: *) |