Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /trunk/src/ast/types.sml
ViewVC logotype

Diff of /trunk/src/ast/types.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 62, Tue May 11 16:03:31 2010 UTC revision 63, Thu May 13 00:29:39 2010 UTC
# Line 3  Line 3 
3   * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu)   * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu)
4   * All rights reserved.   * All rights reserved.
5   *   *
6   * Internal representation of Diderot types   * Internal representation of Diderot types.  These are the types produced
7     * by the type checker.
8   *)   *)
9    
10  structure Types =  structure Types =
# Line 12  Line 13 
13    (* kinds for type variables *)    (* kinds for type variables *)
14      datatype kind      datatype kind
15        = TK_NAT          (* ranges over natural numbers (0, 1, 2, ...) *)        = TK_NAT          (* ranges over natural numbers (0, 1, 2, ...) *)
16        | TK_INT          (* ranges over integer types *)        | TK_SHAPE        (* ranges over tensor shapes *)
       | TK_FLT          (* ranges over floating-point types *)  
       | TK_RAW          (* ranges over raw (scalar) types *)  
17        | TK_TYPE         (* ranges over 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.  
  *)  
18    
19    (* raw numeric types as supported by NRRD *)    (* raw numeric types as supported by NRRD *)
20      datatype raw_ty      datatype raw_ty
# Line 33  Line 29 
29        = T_Var of var        = T_Var of var
30        | T_Bool        | T_Bool
31        | T_Int        | T_Int
32      (* scalars, vectors, matrices, etc. *)        | T_String
33        | T_Tensor of nat list    (* tensor shape *)      (* convolution kernel; argument is number of levels of differentiation *)
34          | T_Kernel of nat
35        (* scalars, vectors, matrices, etc.; argument is tensor shape *)
36          | T_Tensor of shape
37      (* data sets from NRRD *)      (* data sets from NRRD *)
38        | T_Image of {        | T_Image of {
39            dim : nat,            (* 2D or 3D data set *)            dim : nat,            (* 2D or 3D data set *)
40            shape : nat list      (* tensor shape; order is length of list *)            shape : shape         (* tensor shape; order is length of list *)
41          }          }
42      (* continuous field reconstructed from a data set *)      (* continuous field reconstructed from a data set *)
43        | T_Field of {        | T_Field of {
44            diff : nat,           (* number of levels of differentiation supported *)            diff : nat,           (* number of levels of differentiation supported *)
45            dim : nat,            (* dimension of domain (2D or 3D field) *)            dim : nat,            (* dimension of domain (2D or 3D field) *)
46            shape : nat list      (* shape of tensors in range; order is length of list *)            shape : shape         (* shape of tensors in range; order is length of list *)
47          }          }
48          | T_Fun of ty list * ty list
49    
50        and shape
51          = Shape of nat list
52          | ShapeVar of var
53          | ShapeExt of shape * nat         (* extension of shape (i.e., for D operator) *)
54    
55      and nat      and nat
56        = NatConst of int                 (* i *)        = NatConst of int                 (* i *)
# Line 58  Line 63 
63            stamp : Stamp.stamp            stamp : Stamp.stamp
64          }          }
65    
66        type scheme = var list * ty
67    
68    (* useful types *)    (* useful types *)
69      val realTy = T_Tensor[]      val realTy = T_Tensor(Shape[])
70      fun vec2Ty = T_Tensor[NatConst 2]      val vec2Ty = T_Tensor(Shape[NatConst 2])
71      fun vec3Ty = T_Tensor[NatConst 3]      val vec3Ty = T_Tensor(Shape[NatConst 3])
72      fun vec4Ty = T_Tensor[NatConst 4]      val vec4Ty = T_Tensor(Shape[NatConst 4])
73    
74    end    end

Legend:
Removed from v.62  
changed lines
  Added in v.63

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0