// ** 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 Var */
public class Var extends Exp{
    protected final ident id;

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

    /** Field Class for Var.id */
    public static class id extends edu.neu.ccs.demeterf.control.Fields.any{}

    public int eval(Env ev){ return ev.apply(id); }
    public List<Op> compile(List<ident> env){
        return List.<Op>create(new Load(env.index(id)));
    }
    public <X> X accept(Vis<X> v){ return v.visit(this); }
    public Exp simplify(){ return new Var(id); }
    public int maxEnv(){ return 0; }
 
    /** DGP method from Class Print */
    public String print(){ return gen.Print.PrintM(this); }
    /** Getter for field Var.id */
    public ident getId(){ return id; }

}