static void Main(string[] args) { // Abstract Syntax Tree (AST) for 5*10 Exp e = new BinaryExp(new NumericConstant(5), new NumericConstant(10), OPERATOR.MUL); // // Evaluate the Expression // // Console.WriteLine(e.Evaluate(null)); // AST for -(10 + (30 + 50 ) ) e = new UnaryExp( new BinaryExp(new NumericConstant(10), new BinaryExp(new NumericConstant(30), new NumericConstant(50), OPERATOR.PLUS), OPERATOR.PLUS), OPERATOR.MINUS); // // Evaluate the Expression // Console.WriteLine(e.Evaluate(null)); // // Pause for a key stroke // Console.Read(); }
public override double Evaluate(RUNTIME_CONTEXT cont) { return(_ex1.Evaluate(cont)); }