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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/ast/type-util.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/ast/type-util.sml

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

revision 3399, Wed Nov 11 01:18:26 2015 UTC revision 3400, Wed Nov 11 01:28:42 2015 UTC
# Line 13  Line 13 
13     *)     *)
14      val mkTensorTy : int -> Types.ty      val mkTensorTy : int -> Types.ty
15    
16    (* constructor for building a sequence type of unknown size *)    (* constructor for building a fixed-size sequence type of unknown size *)
17      val mkSequenceTy : Types.ty -> Types.ty      val mkSequenceTy : Types.ty -> Types.ty
18    
19    (* function to compute the slice of a tensor type based on a boolean    (* function to compute the slice of a tensor type based on a boolean
# Line 79  Line 79 
79            Ty.T_Tensor(            Ty.T_Tensor(
80              Ty.Shape(List.tabulate(order, fn _ => Ty.DimVar(MetaVar.newDimVar()))))              Ty.Shape(List.tabulate(order, fn _ => Ty.DimVar(MetaVar.newDimVar()))))
81    
82      fun mkSequenceTy ty =      fun mkSequenceTy ty = Ty.T_Sequence(ty, SOME(Ty.DimVar(MetaVar.newDimVar())))
           Ty.T_Sequence(ty, Ty.DimVar(MetaVar.newDimVar()))  
83    
84    (* prune out instantiated meta variables from a type.  We also normalize    (* prune out instantiated meta variables from a type.  We also normalize
85     * tensor dimensions (i.e., remove 1s).     * tensor dimensions (i.e., remove 1s).
# Line 242  Line 241 
241            (* end case *))            (* end case *))
242    
243      fun toString ty = (case pruneHead ty      fun toString ty = (case pruneHead ty
244             of Ty.T_Var tv => MV.tyVarToString tv             of Ty.T_Var(Ty.TV{bind=ref(SOME ty), ...}) => toString ty
245                | Ty.T_Var tv => MV.tyVarToString tv
246              | Ty.T_Bool => "bool"              | Ty.T_Bool => "bool"
247              | Ty.T_Int => "int"              | Ty.T_Int => "int"
248              | Ty.T_String => "string"              | Ty.T_String => "string"
# Line 274  Line 274 
274                  in                  in
275                    String.concat[tysToString tys1, " -> ", toString ty2]                    String.concat[tysToString tys1, " -> ", toString ty2]
276                  end                  end
277                | Ty.T_Error => "<error-type>"
278            (* end case *))            (* end case *))
279    
280    (* return the range (return type) of a function type *)    (* return the range (return type) of a function type *)

Legend:
Removed from v.3399  
changed lines
  Added in v.3400

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