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

SCM Repository

[diderot] View of /trunk/src/compiler/IL/gen/high-il.in
ViewVC logotype

View of /trunk/src/compiler/IL/gen/high-il.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 336 - (download) (annotate)
Tue Aug 24 20:24:21 2010 UTC (8 years, 9 months ago) by jhr
File size: 1132 byte(s)
  Added some comments
(* high-il.sml
 *
 * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu)
 * All rights reserved.
 *
 * High-level version of the Diderot IL.
 *
 * Note: this file is generated from gen/high-il.spec and gen/high-il.in.
 *)

structure HighOps =
  struct

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

  (* required helper functions for the "ty" type *)
    fun samety (ty1 : ty, ty2) = (ty1 = ty2)
    fun hashty BoolTy = 0w1
      | hashty StringTy = 0w2
      | hashty IntTy = 0w3
      | hashty (TensorTy dd) = List.foldl (fn (d, s) => Word.fromInt d + s) 0w4 dd
    fun tyToString BoolTy = "bool"
      | tyToString StringTy = "string"
      | tyToString IntTy = "int"
      | tyToString (TensorTy[]) = "real"
      | tyToString (TensorTy dd) = String.concat[
	    "tensor[", String.concatWith "," (List.map Int.toString dd), "]"
	  ]

  (* required helper functions for the string type *)
    fun samestring (s1 : string, s2) = (s1 = s2)
    val hashstring = HashString.hashString
    fun stringToString s = String.concat["\"", s, "\""]

@BODY@

  end

structure HighIL = SSAFn(HighOps)

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