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

SCM Repository

[diderot] View of /branches/lamont/src/compiler/high-il/high-il-types.sml
ViewVC logotype

View of /branches/lamont/src/compiler/high-il/high-il-types.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 393 - (download) (annotate)
Thu Oct 14 15:45:01 2010 UTC (9 years ago) by jhr
Original Path: trunk/src/compiler/high-il/high-il-types.sml
File size: 705 byte(s)
  new files
(* high-il-types.sml
 *
 * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu)
 * All rights reserved.
 *)

structure HighILTypes =
  struct

    datatype ty = BoolTy | StringTy | IntTy | TensorTy of int list

    fun same (ty1 : ty, ty2) = (ty1 = ty2)

    fun hash BoolTy = 0w1
      | hash StringTy = 0w2
      | hash IntTy = 0w3
      | hash (TensorTy dd) = List.foldl (fn (d, s) => Word.fromInt d + s) 0w4 dd

    fun toString BoolTy = "bool"
      | toString StringTy = "string"
      | toString IntTy = "int"
      | toString (TensorTy[]) = "real"
      | toString (TensorTy dd) = String.concat[
	    "tensor[", String.concatWith "," (List.map Int.toString dd), "]"
	  ]

  end

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