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

SCM Repository

[diderot] Diff of /branches/vis12-cl/src/compiler/ast/var.sml
ViewVC logotype

Diff of /branches/vis12-cl/src/compiler/ast/var.sml

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

revision 2682, Mon Aug 25 17:20:56 2014 UTC revision 2683, Mon Aug 25 18:56:17 2014 UTC
# Line 18  Line 18 
18      fun kindOf (V{kind, ...}) = kind      fun kindOf (V{kind, ...}) = kind
19      fun uniqueNameOf (V{name, id, ...}) = name ^ Stamp.toString id      fun uniqueNameOf (V{name, id, ...}) = name ^ Stamp.toString id
20    
     fun new (name, kind, ty) = let  
           val id = Stamp.new()  
           in  
             V{name=Atom.toString name, id=id, kind=kind, ty=([], ty)}  
           end  
   
21      fun newPoly (name, kind, scheme) = let      fun newPoly (name, kind, scheme) = let
22            val id = Stamp.new()            val id = Stamp.new()
23            in            in
24              V{name=Atom.toString name, id=id, kind=kind, ty=scheme}              V{name=Atom.toString name, id=id, kind=kind, ty=scheme, props=PropList.newHolder()}
25            end            end
26    
27      fun copy (V{name, kind, ty, ...}) = V{name=name, id=Stamp.new(), kind=kind, ty=ty}      fun new (name, kind, ty) = newPoly (name, kind, ([], ty))
28    
29        fun copy (V{name, kind, ty, ...}) =
30              V{name=name, id=Stamp.new(), kind=kind, ty=ty, props=PropList.newHolder()}
31    
32    (* return true if variable has global scope *)    (* return true if variable has global scope *)
33      fun isGlobal (V{kind, ...}) = (case kind      fun isGlobal (V{kind, ...}) = (case kind
# Line 41  Line 38 
38              | _ => false              | _ => false
39            (* end case *))            (* end case *))
40    
41        fun newProp initFn = PropList.newProp (fn (V{props, ...}) => props, initFn)
42        fun newFlag () = PropList.newFlag (fn (V{props, ...}) => props)
43    
44      fun compare (V{id=a, ...}, V{id=b, ...}) = Stamp.compare(a, b)      fun compare (V{id=a, ...}, V{id=b, ...}) = Stamp.compare(a, b)
45      fun same (V{id=a, ...}, V{id=b, ...}) = Stamp.same(a, b)      fun same (V{id=a, ...}, V{id=b, ...}) = Stamp.same(a, b)
46      fun hash (V{id, ...}) = Stamp.hash id      fun hash (V{id, ...}) = Stamp.hash id
47    
48        fun kindToString (V{kind, ...}) = (case kind
49              of BasisVar => "basis variable"
50               | InputVar => "input variable"
51               | GlobalVar => "global variable"
52               | FunVar => "function"
53               | StrandParam => "strand parameter"
54               | StrandStateVar => "state variable"
55               | StrandOutputVar => "strand output variable"
56               | LocalVar => "variable"
57              (* end case *))
58    
59      local      local
60        structure V =        structure V =
61          struct          struct

Legend:
Removed from v.2682  
changed lines
  Added in v.2683

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