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

package gen;

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




/** Representation of OpList */
public abstract class OpList{

    /** Construct a(n) OpList Instance */
    public OpList(){
    }
    /** Parse an instance of OpList from the given String */
    public static OpList parse(String inpt) throws ParseException{
        return new TheParser(new java.io.StringReader(inpt)).parse_OpList();
    }
    /** Parse an instance of OpList from the given Stream */
    public static OpList parse(java.io.InputStream inpt) throws ParseException{
        return new TheParser(inpt).parse_OpList();
    }
    /** Parse an instance of OpList from the given Reader */
    public static OpList parse(java.io.Reader inpt) throws ParseException{
        return new TheParser(inpt).parse_OpList();
    }


  public abstract OpList append(Op o);
  public abstract OpList append(OpList ol);
  public abstract ExecStack eval(ExecStack s);
  public ExecStack eval(){ return eval(new ExecStack(labels())); }
  public OpList prepend(Op o){ return new OpCons(o,this); }
  public List<CodeEntry> labels(){ return labels(List.<CodeEntry>create()); }
  abstract List<CodeEntry> labels(List<CodeEntry> e);
  public static OpList fromList(List<Op> l){
      if(l.isEmpty())return new OpEmpty();
      return fromList(l.pop()).prepend(l.top());
  }

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

}