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

SCM Repository

[diderot] View of /branches/vis15/src/compiler/translate/translate-ty.sml
ViewVC logotype

View of /branches/vis15/src/compiler/translate/translate-ty.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3476 - (download) (annotate)
Wed Dec 2 20:44:59 2015 UTC (3 years, 9 months ago) by jhr
File size: 1057 byte(s)
working on merge
(* translate-ty.sml
 *
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2015 The University of Chicago
 * All rights reserved.
 *)

structure TranslateTy : sig

    val tr : SimpleTypes.ty -> HighTypes.ty

  end = struct

    structure Ty = SimpleTypes
    structure DstTy = HighTypes

    fun tr ty = (case ty
           of Ty.T_Bool => DstTy.BoolTy
            | Ty.T_Int => DstTy.IntTy
            | Ty.T_String => DstTy.StringTy
            | Ty.T_Sequence(ty, optDim) => DstTy.SeqTy(tr ty, optDim)
            | Ty.T_Kernel _ => DstTy.KernelTy
            | Ty.T_Tensor dd => let
                fun cvtDim 1 = NONE
                  | cvtDim d = SOME d
                in
                  DstTy.TensorTy(List.mapPartial cvtDim dd)
                end
            | Ty.T_Image{dim, shape} => DstTy.ImageTy(ImageInfo.mkInfo(dim, shape))
            | Ty.T_Field fld => DstTy.FieldTy
            | ty => raise Fail("TranslateTy.tr: unexpected " ^ Ty.toString ty)
          (* end case *))

  end

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