public BinopExp(Exp l, Token op, Exp r) { Left = l; Right = r; ExpType = typeof(int); switch(op.Type){ case TokenType.PLUS: Oper = Operator.ADD; break; case TokenType.MINUS: Oper = Operator.SUB; break; case TokenType.MUL: Oper = Operator.MUL; break; case TokenType.DIVIDE: Oper = Operator.DIVIDE; break; } }
public DoVarDef(String n, Exp init, Exp it, int p) { Name = n; Init = init; Iter = it; Pos = p; }
public DoCondExp(Exp c, Exp r) { Cond = c; Ret = r; }
public ToIntExp(Exp v) { Value = v; }
public ToListExp(Exp v) { Value = v; }
public GlobalVarDef(String n, Exp v) { Name = n; Value = v; ExpType = Value.ExpType; }
public FunctionDef(String n, ArrayList p, Exp b) { Name = n; Params = p; Body = b; Count = Params.Count; //ExpType = Body.ExpType; }
public CallExp(String c, String f, Exp[] p, Type t) { ClassName = c; FunctionName = f; Params = p; System = true; ExpType = t; }
public IfExp(Exp e, Exp thene, Exp elsee) { EvalExp = e; ThenExp = thene; ElseExp = elsee; }
public SubstExp(Exp r, Exp f, Exp e) { Replace = r; Find = f; Expr = e; }
public CallExp(String c, String f, Exp[] p) { ClassName = c; FunctionName = f; Params = p; System = false; }
public ConsExp(Exp l, Exp r) { Left = l; Right = r; }
public CarExp(Exp l) { Left = l; }
public CdrExp(Exp l) { Left = l; }
public IsNullExp(Exp e) { Expr = e; }
public CompareExp(Exp l, Token op, Exp r) { Left = l; Right = r; switch(op.Type){ case TokenType.LT: Oper = Operator.LT; break; case TokenType.GT: Oper = Operator.GT; break; case TokenType.EQ: Oper = Operator.EQ; break; case TokenType.LE: Oper = Operator.LE; break; case TokenType.GE: Oper = Operator.GE; break; } }