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

SCM Repository

[diderot] Annotation of /branches/staging/src/compiler/ast/var.sml
ViewVC logotype

Annotation of /branches/staging/src/compiler/ast/var.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 136 - (view) (download)
Original Path: trunk/src/compiler/ast/var.sml

1 : jhr 71 (* var.sml
2 :     *
3 :     * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu)
4 :     * All rights reserved.
5 :     *)
6 :    
7 :     structure Var =
8 :     struct
9 :    
10 :     datatype var = datatype AST.var
11 :    
12 : jhr 72 datatype var_kind = datatype AST.var_kind
13 :    
14 : jhr 79 fun nameOf (V{name, ...}) = name
15 : jhr 71 fun typeOf (V{ty, ...}) = ty
16 : jhr 72 fun kindOf (V{kind, ...}) = kind
17 : jhr 71
18 :     fun new (name, kind, ty) = let
19 :     val id = Stamp.new()
20 :     in
21 :     V{name=Atom.toString name, id=id, kind=kind, ty=([], ty)}
22 :     end
23 :    
24 : jhr 78 fun newPoly (name, kind, scheme) = let
25 :     val id = Stamp.new()
26 :     in
27 :     V{name=Atom.toString name, id=id, kind=kind, ty=scheme}
28 :     end
29 :    
30 : jhr 136 fun compare (V{id=a, ...}, V{id=b, ...}) = Stamp.compare(a, b)
31 :     fun same (V{id=a, ...}, V{id=b, ...}) = Stamp.same(a, b)
32 :     fun hash (V{id, ...}) = Stamp.hash id
33 :    
34 :     local
35 :     structure V =
36 :     struct
37 :     type ord_key = var
38 :     val compare = compare
39 :     end
40 :     in
41 :     structure Map = RedBlackMapFn (V)
42 :     structure Set = RedBlackSetFn (V)
43 :     end
44 :    
45 : jhr 71 end

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