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

SCM Repository

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

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

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

revision 806, Tue Apr 12 14:07:55 2011 UTC revision 807, Tue Apr 12 15:41:18 2011 UTC
# Line 38  Line 38 
38      val resolveShape : Types.shape_var -> Types.shape      val resolveShape : Types.shape_var -> Types.shape
39      val resolveDim : Types.dim_var -> Types.dim      val resolveDim : Types.dim_var -> Types.dim
40    
41      (* equality testing *)
42        val sameDim : Types.dim * Types.dim -> bool
43    
44    (* string representations of types, etc *)    (* string representations of types, etc *)
45      val toString : Types.ty -> string      val toString : Types.ty -> string
46      val diffToString : Types.diff -> string      val diffToString : Types.diff -> string
# Line 151  Line 154 
154              prune' ty              prune' ty
155            end            end
156    
157      (* returns true if the type is a value type (bool, int, string, or tensor) *)
158        fun isValueType ty = (case prune ty
159               of Ty.T_Bool => true
160                | Ty.T_Int => true
161                | Ty.T_String => true
162                | Ty.T_Sequence _ => true
163                | Ty.T_Tensor _ => true
164                | _ => false
165              (* end case *))
166    
167      (* equality testing *)
168        fun sameDim (Ty.DimConst d1, Ty.DimConst d2) = (d1 = d2)
169          | sameDim (Ty.DimVar v1, Ty.DimVar v2) = MetaVar.sameDimVar(v1, v2)
170          | sameDim _ = false
171    
172      fun listToString fmt sep items = String.concatWith sep (List.map fmt items)      fun listToString fmt sep items = String.concatWith sep (List.map fmt items)
173    
174      fun diffToString diff = (case pruneDiff diff      fun diffToString diff = (case pruneDiff diff
# Line 178  Line 196 
196              | Ty.DimVar v => MV.dimVarToString v              | Ty.DimVar v => MV.dimVarToString v
197            (* end case *))            (* end case *))
198    
   (* returns true if the type is a value type (bool, int, string, or tensor) *)  
     fun isValueType ty = (case prune ty  
            of Ty.T_Bool => true  
             | Ty.T_Int => true  
             | Ty.T_String => true  
             | Ty.T_Sequence _ => true  
             | Ty.T_Tensor _ => true  
             | _ => false  
           (* end case *))  
   
199      fun toString ty = (case pruneHead ty      fun toString ty = (case pruneHead ty
200             of Ty.T_Var tv => MV.tyVarToString tv             of Ty.T_Var tv => MV.tyVarToString tv
201              | Ty.T_Bool => "bool"              | Ty.T_Bool => "bool"

Legend:
Removed from v.806  
changed lines
  Added in v.807

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