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

SCM Repository

[diderot] Annotation of /branches/vis15/src/compiler/common/api-types.sml
ViewVC logotype

Annotation of /branches/vis15/src/compiler/common/api-types.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3810 - (view) (download)

1 : jhr 3810 (* api-types.sml
2 :     *
3 :     * A representation of the types of values that can be communicated to and from a
4 :     * Diderot program.
5 :     *
6 :     * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
7 :     *
8 :     * COPYRIGHT (c) 2016 The University of Chicago
9 :     * All rights reserved.
10 :     *)
11 :    
12 :     structure APITypes =
13 :     struct
14 :    
15 :     datatype t
16 :     = IntTy
17 :     | BoolTy
18 :     | TensorTy of int list
19 :     | StringTy
20 :     | ImageTy of int * int list
21 :     | SeqTy of t * int option
22 :    
23 :     val realTy = TensorTy[]
24 :    
25 :     fun toString IntTy = "int"
26 :     | toString BoolTy = "bool"
27 :     | toString (TensorTy[]) = "real"
28 :     | toString (TensorTy[2]) = "vec2"
29 :     | toString (TensorTy[3]) = "vec3"
30 :     | toString (TensorTy[4]) = "vec4"
31 :     | toString (TensorTy dd) = concat["tensor[", String.concatWithMap "," Int.toString dd, "]"]
32 :     | toString StringTy = "string"
33 :     | toString (ImageTy(d, dd)) = concat[
34 :     "image(", Int.toString d, ")[", String.concatWithMap "," Int.toString dd, "]"
35 :     ]
36 :     | toString (SeqTy(ty, NONE)) = toString ty ^ "[]"
37 :     | toString (SeqTy(ty, SOME d)) = concat[toString ty, "[", Int.toString d, "]"]
38 :    
39 :     end

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