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 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; } }