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

SCM Repository

[diderot] Annotation of /branches/pure-cfg/src/compiler/high-il/high-il-types.sml
ViewVC logotype

Annotation of /branches/pure-cfg/src/compiler/high-il/high-il-types.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 393 - (view) (download)
Original Path: trunk/src/compiler/high-il/high-il-types.sml

1 : jhr 393 (* high-il-types.sml
2 :     *
3 :     * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu)
4 :     * All rights reserved.
5 :     *)
6 :    
7 :     structure HighILTypes =
8 :     struct
9 :    
10 :     datatype ty = BoolTy | StringTy | IntTy | TensorTy of int list
11 :    
12 :     fun same (ty1 : ty, ty2) = (ty1 = ty2)
13 :    
14 :     fun hash BoolTy = 0w1
15 :     | hash StringTy = 0w2
16 :     | hash IntTy = 0w3
17 :     | hash (TensorTy dd) = List.foldl (fn (d, s) => Word.fromInt d + s) 0w4 dd
18 :    
19 :     fun toString BoolTy = "bool"
20 :     | toString StringTy = "string"
21 :     | toString IntTy = "int"
22 :     | toString (TensorTy[]) = "real"
23 :     | toString (TensorTy dd) = String.concat[
24 :     "tensor[", String.concatWith "," (List.map Int.toString dd), "]"
25 :     ]
26 :    
27 :     end

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