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

SCM Repository

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

View of /trunk/src/compiler/translate/translate-ty.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2476 - (download) (annotate)
Mon Oct 14 09:36:13 2013 UTC (5 years, 10 months ago) by jhr
File size: 839 byte(s)
  New SimpleAST representation that uses types with meta-variables
  resolved (i.e., removed).
(* translate-ty.sml
 *
 * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.
 *)

structure TranslateTy : sig

    val tr : SimpleTypes.ty -> HighILTypes.ty

  end = struct

    structure Ty = SimpleTypes
    structure DstTy = HighILTypes

    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, d) => DstTy.SeqTy(tr ty, d)
	    | 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 dim
	    | 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