equal
deleted
inserted
replaced
13 |
13 |
14 signature BASIC_CODE_THINGOL = |
14 signature BASIC_CODE_THINGOL = |
15 sig |
15 sig |
16 type vname = string; |
16 type vname = string; |
17 datatype dict = |
17 datatype dict = |
18 Dict of (string list * plain_dict) |
18 Dict of string list * plain_dict |
19 and plain_dict = |
19 and plain_dict = |
20 Dict_Const of string * dict list list |
20 Dict_Const of string * dict list list |
21 | Dict_Var of vname * (int * int) |
21 | Dict_Var of vname * (int * int) |
22 datatype itype = |
22 datatype itype = |
23 `%% of string * itype list |
23 `%% of string * itype list |
24 | ITyVar of vname; |
24 | ITyVar of vname; |
25 type const = string * ((itype list * dict list list) * itype list (*types of arguments*)) |
25 type const = string * ((itype list * dict list list) * itype list) |
|
26 (* f [T1..Tn] {dicts} (_::S1) .. (_..Sm) =^= (f, (([T1..Tn], dicts), [S1..Sm]) *) |
26 datatype iterm = |
27 datatype iterm = |
27 IConst of const |
28 IConst of const |
28 | IVar of vname option |
29 | IVar of vname option |
29 | `$ of iterm * iterm |
30 | `$ of iterm * iterm |
30 | `|=> of (vname option * itype) * iterm |
31 | `|=> of (vname option * itype) * iterm |
49 val unfold_let: iterm -> ((iterm * itype) * iterm) list * iterm |
50 val unfold_let: iterm -> ((iterm * itype) * iterm) list * iterm |
50 val split_pat_abs: iterm -> ((iterm * itype) * iterm) option |
51 val split_pat_abs: iterm -> ((iterm * itype) * iterm) option |
51 val unfold_pat_abs: iterm -> (iterm * itype) list * iterm |
52 val unfold_pat_abs: iterm -> (iterm * itype) list * iterm |
52 val unfold_const_app: iterm -> (const * iterm list) option |
53 val unfold_const_app: iterm -> (const * iterm list) option |
53 val is_IVar: iterm -> bool |
54 val is_IVar: iterm -> bool |
|
55 val is_IAbs: iterm -> bool |
54 val eta_expand: int -> const * iterm list -> iterm |
56 val eta_expand: int -> const * iterm list -> iterm |
55 val contains_dict_var: iterm -> bool |
57 val contains_dict_var: iterm -> bool |
56 val locally_monomorphic: iterm -> bool |
58 val locally_monomorphic: iterm -> bool |
57 val add_constnames: iterm -> string list -> string list |
59 val add_constnames: iterm -> string list -> string list |
58 val add_tyconames: iterm -> string list -> string list |
60 val add_tyconames: iterm -> string list -> string list |
132 (** language core - types, terms **) |
134 (** language core - types, terms **) |
133 |
135 |
134 type vname = string; |
136 type vname = string; |
135 |
137 |
136 datatype dict = |
138 datatype dict = |
137 Dict of (string list * plain_dict) |
139 Dict of string list * plain_dict |
138 and plain_dict = |
140 and plain_dict = |
139 Dict_Const of string * dict list list |
141 Dict_Const of string * dict list list |
140 | Dict_Var of vname * (int * int) |
142 | Dict_Var of vname * (int * int) |
141 |
143 |
142 datatype itype = |
144 datatype itype = |
153 | ICase of ((iterm * itype) * (iterm * iterm) list) * iterm; |
155 | ICase of ((iterm * itype) * (iterm * iterm) list) * iterm; |
154 (*see also signature*) |
156 (*see also signature*) |
155 |
157 |
156 fun is_IVar (IVar _) = true |
158 fun is_IVar (IVar _) = true |
157 | is_IVar _ = false; |
159 | is_IVar _ = false; |
|
160 |
|
161 fun is_IAbs (_ `|=> _) = true |
|
162 | is_IAbs _ = false; |
158 |
163 |
159 val op `$$ = Library.foldl (op `$); |
164 val op `$$ = Library.foldl (op `$); |
160 val op `|==> = Library.foldr (op `|=>); |
165 val op `|==> = Library.foldr (op `|=>); |
161 |
166 |
162 val unfold_app = unfoldl |
167 val unfold_app = unfoldl |