SCM Repository
Annotation of /sml/branches/SMLNJ/src/compiler/FLINT/kernel/ltybasic.sig
Parent Directory
|
Revision Log
Revision 24 - (view) (download) (as text)
1 : | monnier | 16 | (* Copyright (c) 1998 YALE FLINT PROJECT *) |
2 : | (* ltybasic.sig *) | ||
3 : | |||
4 : | (* | ||
5 : | * This file contains all the standard operations defined in LtyDef plus | ||
6 : | * the set of common functions used to manipulate kinds, tycs, and ltys. | ||
7 : | * The rule of thumb about what should be included in this file rather | ||
8 : | * than the ltyextern.sml: well, all primitive lambda tkinds, tycs and | ||
9 : | * ltys should be here, all common utility functions on tkinds, tycs, | ||
10 : | * and ltys should be here. Functions that are of specific use should | ||
11 : | * go to the ltyextern.sml. Still, the module LtyExtern will include | ||
12 : | * all functions defined here, so all clients should use functions via | ||
13 : | * the LtyExtern structure. | ||
14 : | *) | ||
15 : | |||
16 : | signature LTYBASIC = | ||
17 : | sig | ||
18 : | |||
19 : | (* | ||
20 : | * The abstract definitions of tkind, tyc, and lty are in separate files, | ||
21 : | * i.e., ltydef.sig and ltydef.sml. The internal implementation of tkind, | ||
22 : | * tyc, and lty are in the ltykernel.sig and ltykernel.sml files. In general, | ||
23 : | * the clients of the lambda types should never need to understand what is | ||
24 : | * going on inside the LtyKernel. | ||
25 : | *) | ||
26 : | |||
27 : | (** the definitions of tkind, tyc, and lty *) | ||
28 : | include LTYDEF (* see ltydef.sig for details *) | ||
29 : | |||
30 : | (** new a type variable, currently not used *) | ||
31 : | val mkTvar : unit -> tvar | ||
32 : | |||
33 : | (** utility functions for constructing tkinds *) | ||
34 : | val tkc_int : int -> tkind | ||
35 : | val tkc_arg : int -> tkind list | ||
36 : | |||
37 : | (** primitive lambda tycs *) | ||
38 : | val tcc_int : tyc | ||
39 : | val tcc_int32 : tyc | ||
40 : | val tcc_real : tyc | ||
41 : | val tcc_string : tyc | ||
42 : | val tcc_exn : tyc | ||
43 : | val tcc_void : tyc | ||
44 : | val tcc_unit : tyc | ||
45 : | val tcc_bool : tyc | ||
46 : | |||
47 : | val tcc_tv : int -> tyc | ||
48 : | val tcc_ref : tyc -> tyc | ||
49 : | val tcc_array : tyc -> tyc | ||
50 : | val tcc_vector : tyc -> tyc | ||
51 : | val tcc_etag : tyc -> tyc | ||
52 : | |||
53 : | (** primitive lambda ltys *) | ||
54 : | val ltc_int : lty | ||
55 : | val ltc_int32 : lty | ||
56 : | val ltc_real : lty | ||
57 : | val ltc_string : lty | ||
58 : | val ltc_exn : lty | ||
59 : | val ltc_void : lty | ||
60 : | val ltc_unit : lty | ||
61 : | val ltc_bool : lty | ||
62 : | |||
63 : | val ltc_tv : int -> lty | ||
64 : | val ltc_ref : lty -> lty | ||
65 : | val ltc_array : lty -> lty | ||
66 : | val ltc_vector : lty -> lty | ||
67 : | val ltc_etag : lty -> lty | ||
68 : | |||
69 : | val ltc_top : lty (* used in a dirty hack in prim.sml *) | ||
70 : | |||
71 : | (** testing equivalence of tkinds, tycs, and ltys *) | ||
72 : | val tk_eqv : tkind * tkind -> bool | ||
73 : | val tc_eqv : tyc * tyc -> bool | ||
74 : | val lt_eqv : lty * lty -> bool | ||
75 : | |||
76 : | (** testing the equivalence for tycs and ltys with relaxed constraints *) | ||
77 : | val tc_eqv_bx: tyc * tyc -> bool | ||
78 : | val lt_eqv_bx: lty * lty -> bool | ||
79 : | |||
80 : | (** pretty printing of tkinds, tycs, and ltys *) | ||
81 : | val tk_print : tkind -> string | ||
82 : | val tc_print : tyc -> string | ||
83 : | val lt_print : lty -> string | ||
84 : | |||
85 : | (** adjusting an lty or tyc from one depth to another *) | ||
86 : | val lt_adj : lty * depth * depth -> lty | ||
87 : | val tc_adj : tyc * depth * depth -> tyc | ||
88 : | monnier | 24 | val tc_adj_one : tyc * depth * depth -> tyc |
89 : | (* used by trans/transtypes.sml *) | ||
90 : | monnier | 16 | |
91 : | (** finding out the depth for a tyc's innermost-bound free variables *) | ||
92 : | val tc_depth : tyc * depth -> depth | ||
93 : | val tcs_depth: tyc list * depth -> depth | ||
94 : | |||
95 : | (** automatically flattening the argument or the result type *) | ||
96 : | val lt_autoflat : lty -> bool * lty list * bool | ||
97 : | |||
98 : | (** utility functions on tkindEnv *) | ||
99 : | type tkindEnv | ||
100 : | exception tkUnbound | ||
101 : | val initTkEnv: tkindEnv | ||
102 : | val tkLookup : tkindEnv * int * int -> tkind | ||
103 : | val tkInsert : tkindEnv * tkind list -> tkindEnv | ||
104 : | |||
105 : | (** utility functions on tycEnv *) | ||
106 : | exception tcUnbound | ||
107 : | type tycEnv = LtyKernel.tycEnv | ||
108 : | val initTycEnv : tycEnv | ||
109 : | val tcInsert : tycEnv * (tyc list option * int) -> tycEnv | ||
110 : | |||
111 : | (** the ltyEnv maps from lvar to its lty; notice lty is depth-dependent *) | ||
112 : | type ltyEnv | ||
113 : | exception ltUnbound | ||
114 : | val initLtyEnv : ltyEnv | ||
115 : | val ltLookup : ltyEnv * LambdaVar.lvar * depth -> lty | ||
116 : | val ltInsert : ltyEnv * LambdaVar.lvar * lty * depth -> ltyEnv | ||
117 : | |||
118 : | end (* signature LTYBASIC *) | ||
119 : |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |