SCM Repository
[diderot] / trunk / src / typechecker / env.sml |
View of /trunk/src/typechecker/env.sml
Parent Directory
|
Revision Log
Revision 72 -
(download)
(annotate)
Sat May 22 22:48:47 2010 UTC (12 years, 1 month ago) by jhr
File size: 847 byte(s)
Sat May 22 22:48:47 2010 UTC (12 years, 1 month ago) by jhr
File size: 847 byte(s)
Working on typechecker
(* env.sml * * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu) * All rights reserved. *) structure Env : sig type env val findVar : env * Atom.atom -> AST.var option end = struct structure ATbl = AtomTable structure AMap = AtomMap (* global environment holds global variables and actors *) datatype global_env = GE of { vEnv : AST.var ATbl.hash_table } datatype env = E of { g : global_env, vEnv : AST.var AMap.map } fun findVar (E{g=GE{vEnv=gvEnv, ...}, vEnv}, x) = (case AMap.find(vEnv, x) of NONE => ATbl.find gvEnv x | someVar => someVar (* end case *)) fun insertGlobal (env as E{g=GE{vEnv, ...}, ...}, x, x') = ATbl.insert vEnv (x, x') fun insertLocal (env as E{vEnv, g}, x, x') = E{vEnv = VMap.insert(vEnv, x, x'), g = g} end
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |