SCM Repository
View of /trunk/src/ast/types.sml
Parent Directory
|
Revision Log
Revision 62 -
(download)
(annotate)
Tue May 11 16:03:31 2010 UTC (10 years, 9 months ago) by jhr
File size: 1880 byte(s)
Tue May 11 16:03:31 2010 UTC (10 years, 9 months ago) by jhr
File size: 1880 byte(s)
edit comments
(* types.sml * * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu) * All rights reserved. * * Internal representation of Diderot types *) structure Types = struct (* kinds for type variables *) datatype kind = TK_NAT (* ranges over natural numbers (0, 1, 2, ...) *) | TK_INT (* ranges over integer types *) | TK_FLT (* ranges over floating-point types *) | TK_RAW (* ranges over raw (scalar) types *) | TK_TYPE (* ranges over types *) (* Question: do we want kinds for tensors of different orders (e.g., TK_TENSOR of word?); * Then TK_RAW would be TK_TENSOR of 0w0. *) (* raw numeric types as supported by NRRD *) datatype raw_ty = RT_Int8 | RT_UInt8 | RT_Int16 | RT_UInt16 | RT_Int32 | RT_UInt32 | RT_Int64 | RT_UInt64 | RT_Float | RT_Double | RT_Var of var and ty = T_Var of var | T_Bool | T_Int (* scalars, vectors, matrices, etc. *) | T_Tensor of nat list (* tensor shape *) (* data sets from NRRD *) | T_Image of { dim : nat, (* 2D or 3D data set *) shape : nat list (* tensor shape; order is length of list *) } (* continuous field reconstructed from a data set *) | T_Field of { diff : nat, (* number of levels of differentiation supported *) dim : nat, (* dimension of domain (2D or 3D field) *) shape : nat list (* shape of tensors in range; order is length of list *) } and nat = NatConst of int (* i *) | NatExp of (nat * int) (* d + i *) | NatVar of var (* type variables; the kind field restricts their range *) and var = TV of { kind : kind, stamp : Stamp.stamp } (* useful types *) val realTy = T_Tensor[] fun vec2Ty = T_Tensor[NatConst 2] fun vec3Ty = T_Tensor[NatConst 3] fun vec4Ty = T_Tensor[NatConst 4] end
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |