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

SCM Repository

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

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

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

trunk/src/typechecker/env.sml revision 71, Sat May 22 22:16:04 2010 UTC trunk/src/compiler/env/env.sml revision 110, Wed Jun 23 19:28:48 2010 UTC
# Line 8  Line 8 
8    
9      type env      type env
10    
11        val new : unit -> env
12    
13      val findVar : env * Atom.atom -> AST.var option      val findVar : env * Atom.atom -> AST.var option
14    
15        val insertGlobal : env * Atom.atom * AST.var -> env
16        val insertLocal : env * Atom.atom * AST.var -> env
17    
18    end = struct    end = struct
19    
20      structure ATbl = AtomTable      structure ATbl = AtomTable
# Line 25  Line 30 
30          vEnv : AST.var AMap.map          vEnv : AST.var AMap.map
31        }        }
32    
33        fun new () = E{
34                g = GE{vEnv = ATbl.mkTable(128, Fail "global env")},
35                vEnv = AMap.empty
36              }
37    
38      fun findVar (E{g=GE{vEnv=gvEnv, ...}, vEnv}, x) = (case AMap.find(vEnv, x)      fun findVar (E{g=GE{vEnv=gvEnv, ...}, vEnv}, x) = (case AMap.find(vEnv, x)
39             of NONE => ATbl.find gvEnv x             of NONE => ATbl.find gvEnv x
40              | someVar => someVar              | someVar => someVar
41            (* end case *))            (* end case *))
42    
43      fun insertGlobal (env as E{g=GE{vEnv, ...}, ...}, x, x') =      fun insertGlobal (env as E{g=GE{vEnv, ...}, ...}, x, x') = (
44            ATbl.insert vEnv (x, x')            ATbl.insert vEnv (x, x');
45              env)
46    
47        fun insertLocal (env as E{vEnv, g}, x, x') =
48              E{vEnv = AMap.insert(vEnv, x, x'), g = g}
49    
50    end    end

Legend:
Removed from v.71  
changed lines
  Added in v.110

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