// ** This class was generated with DemFGen (vers:09/27/2009)

package gen;

import edu.neu.ccs.demeterf.lib.*;




/** Representation of ExecStack */
public class ExecStack{

    /** Construct a(n) ExecStack Instance */
    public ExecStack(){
    }
    /** Is the given object Equal to this ExecStack? */
    public boolean equals(Object o){
        if(!(o instanceof ExecStack))return false;
        if(o == this)return true;
        ExecStack oo = (ExecStack)o;
        return true;
    }
    /** Parse an instance of ExecStack from the given String */
    public static ExecStack parse(String inpt) throws ParseException{
        return new TheParser(new java.io.StringReader(inpt)).parse_ExecStack();
    }
    /** Parse an instance of ExecStack from the given Stream */
    public static ExecStack parse(java.io.InputStream inpt) throws ParseException{
        return new TheParser(inpt).parse_ExecStack();
    }
    /** Parse an instance of ExecStack from the given Reader */
    public static ExecStack parse(java.io.Reader inpt) throws ParseException{
        return new TheParser(inpt).parse_ExecStack();
    }


  List<Integer> env = List.create(), result = env;
  List<CodeEntry> labels = List.create();

  public ExecStack(List<Integer> e, List<Integer> r, List<CodeEntry> l)
  { env = e; result = r; labels = l; }
  public ExecStack(List<CodeEntry> e){ this(); labels = e; }
  ExecStack pushEnv(int i){ return make(env.push(i),result); }
  ExecStack pushRes(int i){ return make(env,result.push(i)); }
  ExecStack popEnv(){ return make(env.pop(),result); }
  ExecStack popRes(){ return make(env,result.pop()); }
  int load(int i){ return env.lookup(i); }
  public int top(){ return result.top(); }
  ExecStack make(List<Integer> e, List<Integer> r)
  { return new ExecStack(e,r,labels); }
  public String toStr(){
      return "    Env: ["+env+"]\n"+
             "    Res: ["+result+"]\n";
  }

    /** DGP method from Class Print */
    public String print(){ return gen.Print.PrintM(this); }

}