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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1687 - (download) (annotate)
Wed Jan 25 13:02:32 2012 UTC (7 years, 10 months ago) by jhr
File size: 969 byte(s)
  Working on support for dynamic sequences; also adding support for type coercions.
(* translate-ty.sml
 *
 * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.
 *)

structure TranslateTy : sig

    val tr : Types.ty -> HighILTypes.ty

  end = struct

    structure Ty = Types
    structure DstTy = HighILTypes

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

  end

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