@@ -0,0 +1,1765 @@
+package env;%0A%0Aimport java.util.IdentityHashMap;%0Aimport java.util.Map;%0Aimport java.util.Set;%0A%0Aclass Binder%3CV%3E %7B%0A   V value;%0A   String prevtop;%0A   Binder%3CV%3E tail;%0A%0A   Binder(V v, String p, Binder%3CV%3E t) %7B%0A      value = v;%0A      prevtop = p;%0A      tail = t;%0A   %7D%0A%7D%0A%0A/**%0A * The Table class is similar to java.util.Dictionary, except that each key must%0A * be a symbol and there is a scope mechanism.%0A */%0A%0Apublic class Table%3CV%3E %7B%0A   private Map%3CString, Binder%3CV%3E%3E dict;%0A   private String top;%0A   private Binder%3CV%3E marks;%0A%0A   public Table() %7B%0A      dict = new IdentityHashMap%3CString, Binder%3CV%3E%3E();%0A   %7D%0A%0A   /**%0A    * Gets the object associated with the specified symbol in the Table.%0A    */%0A   public V get(String key) %7B%0A      Binder%3CV%3E e = dict.get(key);%0A      if (e == null)%0A         return null;%0A      else%0A         return e.value;%0A   %7D%0A%0A   /**%0A    * Puts the specified value into the Table, bound to the specified symbol.%0A    */%0A   public void put(String key, V value) %7B%0A      dict.put(key, new Binder%3CV%3E(value, top, dict.get(key)));%0A      top = key;%0A   %7D%0A%0A   /**%0A    * Remembers the current state of the Table.%0A    */%0A   public void beginScope() %7B%0A      marks = new Binder%3CV%3E(null, top, marks);%0A      top = null;%0A   %7D%0A%0A   /**%0A    * Restores the table to what it was at the most recent beginScope that has%0A    * not already been ended.%0A    */%0A   public void endScope() %7B%0A      while (top != null) %7B%0A         Binder%3CV%3E e = dict.get(top);%0A         if (e.tail != null)%0A            dict.put(top, e.tail);%0A         else%0A            dict.remove(top);%0A         top = e.prevtop;%0A      %7D%0A      top = marks.prevtop;%0A      marks = marks.tail;%0A   %7D%0A%0A   /**%0A    * Returns a Set view of the Table's symbols.%0A    */%0A   public Set%3CString%3E keySet() %7B%0A      return dict.keySet();%0A   %7D%0A%7D%0A

Add table