SCM Repository
View of /trunk/src/ast/types.sml
Parent Directory
|
Revision Log
Revision 40 -
(download)
(annotate)
Wed Mar 3 14:51:38 2010 UTC (10 years, 10 months ago) by jhr
File size: 1253 byte(s)
Wed Mar 3 14:51:38 2010 UTC (10 years, 10 months ago) by jhr
File size: 1253 byte(s)
Added intialization syntax
(* types.sml * * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu) * All rights reserved. * * Internal representation of Diderot types *) structure Types = struct datatype kind = ScalarKind | TypeKind and ty = TyVar of ty_var | TyBool | TyInt | TyReal | TyString | TyKernel of {diff : dim} | TyField of {diff : dim, order : dim list, dim : dim} | TyTensor of {order : dim list} | TyImage of {order : dim list, dim : dim} | TyArray of ty * dim list and dim = DimConst of int (* i *) | DimExp of (dim * int) (* d + i *) | DimVar of dim_var fun dimToString (DimConst of n) = Int.toString n | dimToString (DimExp(d, n)) = if (n < 0) then concat[dimToString d, "-", Int.toString(~n)] else concat[dimToString d, "+", Int.toString n] | dimToString (DimVar dv) = ?? fun toString ty = (case ty of TyVar tv => ?? | TyBool => "bool" | TyInt => "int" | TyReal => "real" | TyString => "string" | TyKernel{diff} => "kernel#" ^ dimToString diff | TyField{diff, order, dim} => | TyTensor{order, dim} => | TyArray(ty, dim) => (* end case *)) end
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |