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

SCM Repository

[diderot] View of /trunk/src/typechecker/env.sml
ViewVC logotype

View of /trunk/src/typechecker/env.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 71 - (download) (annotate)
Sat May 22 22:16:04 2010 UTC (9 years, 1 month ago) by jhr
File size: 752 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')

  end

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