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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 71 - (view) (download)
Original Path: trunk/src/typechecker/env.sml

1 : jhr 71 (* env.sml
2 :     *
3 :     * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu)
4 :     * All rights reserved.
5 :     *)
6 :    
7 :     structure Env : sig
8 :    
9 :     type env
10 :    
11 :     val findVar : env * Atom.atom -> AST.var option
12 :    
13 :     end = struct
14 :    
15 :     structure ATbl = AtomTable
16 :     structure AMap = AtomMap
17 :    
18 :     (* global environment holds global variables and actors *)
19 :     datatype global_env = GE of {
20 :     vEnv : AST.var ATbl.hash_table
21 :     }
22 :    
23 :     datatype env = E of {
24 :     g : global_env,
25 :     vEnv : AST.var AMap.map
26 :     }
27 :    
28 :     fun findVar (E{g=GE{vEnv=gvEnv, ...}, vEnv}, x) = (case AMap.find(vEnv, x)
29 :     of NONE => ATbl.find gvEnv x
30 :     | someVar => someVar
31 :     (* end case *))
32 :    
33 :     fun insertGlobal (env as E{g=GE{vEnv, ...}, ...}, x, x') =
34 :     ATbl.insert vEnv (x, x')
35 :    
36 :     end

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