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

SCM Repository

[diderot] Diff of /trunk/src/compiler/translate/translate.sml
ViewVC logotype

Diff of /trunk/src/compiler/translate/translate.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 393, Thu Oct 14 15:45:01 2010 UTC revision 394, Thu Oct 14 16:30:29 2010 UTC
# Line 13  Line 13 
13    end = struct    end = struct
14    
15      structure S = Simple      structure S = Simple
16        structure Ty = Types
17      structure VMap = Var.Map      structure VMap = Var.Map
18      structure VSet = Var.Set      structure VSet = Var.Set
19      structure IL = HighIL      structure IL = HighIL
20        structure DstTy = HighILTypes
21    
22      fun lookup env x = (case VMap.find (env, x)      fun lookup env x = (case VMap.find (env, x)
23             of SOME x' => x'             of SOME x' => x'
# Line 24  Line 26 
26                  ])                  ])
27            (* end case *))            (* end case *))
28    
29        fun cvtTy ty = (case TypeUtil.prune ty
30               of Ty.T_Bool => DstTy.BoolTy
31                | Ty.T_Int => DstTy.IntTy
32                | Ty.T_String => DstTy.StringTy
33                | Ty.T_Kernel _ => DstTy.KernelTy
34                | Ty.T_Tensor(Ty.Shape dd) => DstTy.TensorTy(List.map (fn (Ty.DimConst d) => d) dd)
35                | Ty.T_Image _ => DstTy.ImageTy
36                | Ty.T_Field _ => DstTy.FieldTy
37                | ty => raise Fail("cvtTy: unexpected " ^ TypeUtil.toString ty)
38              (* end case *))
39    
40    (* create a new instance of a variable *)    (* create a new instance of a variable *)
41      fun newVar x = IL.Var.new (Var.nameOf x)      fun newVar x = IL.Var.new (Var.nameOf x, cvtTy(Var.monoTypeOf x))
42    
43    (* expression translation *)    (* expression translation *)
44      fun cvtExp (env, lhs, exp) = (case exp      fun cvtExp (env, lhs, exp) = (case exp

Legend:
Removed from v.393  
changed lines
  Added in v.394

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