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

package gen;

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




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

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


    public abstract int eval(Env ev);
    public int eval(){ return eval(Env.empty); }
    public abstract List<Op> compile(List<ident> env);
    public abstract Exp simplify();
    public abstract int maxEnv();

    public static abstract class Vis<X>{
        public abstract X visit(Num n);
        public abstract X visit(Var v);
        public abstract X visit(Bin b);
        public abstract X visit(Def d);
        public abstract X visit(Ifz i);
    }
    public abstract <X> X accept(Vis<X> v);
    public boolean isNum(){ return false; }
    public boolean isZero(){ return false; }
    static class Zero extends Num{
        Zero(){ super(0); }
        public boolean isZero(){ return true; }
    }
 
    /** DGP method from Class Print */
    public String print(){ return gen.Print.PrintM(this); }

}