SCM Repository
[diderot] Diff of /trunk/src/compiler/ast/type-util.sml
Diff of /trunk/src/compiler/ast/type-util.sml
Parent Directory
|
Revision Log
|
Patch
6 |
|
|
7 |
structure TypeUtil : sig |
structure TypeUtil : sig |
8 |
|
|
9 |
|
(* constructor for building a tensor type of known order, but unknown |
10 |
|
* dimensions. |
11 |
|
*) |
12 |
|
val mkTensorTy : int -> Types.ty |
13 |
|
|
14 |
(* returns true if the type is a value type (bool, int, string, or tensor) *) |
(* returns true if the type is a value type (bool, int, string, or tensor) *) |
15 |
val isValueType : Types.ty -> bool |
val isValueType : Types.ty -> bool |
16 |
|
|
40 |
structure Ty = Types |
structure Ty = Types |
41 |
structure MV = MetaVar |
structure MV = MetaVar |
42 |
|
|
43 |
|
(* constructor for building a tensor type of known order, but unknown |
44 |
|
* dimensions. |
45 |
|
*) |
46 |
|
fun mkTensorTy order = |
47 |
|
Ty.T_Tensor( |
48 |
|
Ty.Shape(List.tabulate(order, fn _ => Ty.DimVar(MetaVar.newDimVar())))) |
49 |
|
|
50 |
(* prune out instantiated meta variables from a type *) |
(* prune out instantiated meta variables from a type *) |
51 |
fun prune ty = (case ty |
fun prune ty = (case ty |
52 |
of (ty as Ty.T_Var(Ty.TV{bind, ...})) => (case !bind |
of (ty as Ty.T_Var(Ty.TV{bind, ...})) => (case !bind |
|
Legend:
Removed from v.380 |
|
changed lines |
|
Added in v.381 |
|
|