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 4317 - (download) (annotate)
Sat Jul 30 14:12:14 2016 UTC (4 years, 2 months ago) by jhr
File size: 1055 byte(s)
working on merge: expand tabs to eight spaces
(* 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_Tensor dd => let
                fun cvtDim 1 = NONE
                  | cvtDim d = SOME d
                in
                  DstTy.TensorTy(List.mapPartial cvtDim dd)
                end
            | Ty.T_Sequence(ty, optDim) => DstTy.SeqTy(tr ty, optDim)
            | Ty.T_Tuple tys => DstTy.TupleTy(List.map tr tys)
            | Ty.T_Strand n => DstTy.StrandTy n
            | Ty.T_Image info => DstTy.ImageTy info
            | Ty.T_Field fld => DstTy.FieldTy
            | Ty.T_Kernel => DstTy.KernelTy
          (* end case *))

  end

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