Esempio n. 1
0
        public int Run(int label, Dictionary <string, int> env, Program p)
        {
            var ne = new Dictionary <string, int>(env);

            ne[var] = exp.Eval(env);
            return(p.GetCommand(label + 1).Run(label + 1, ne, p));
        }
Esempio n. 2
0
        public int Run(int label, Dictionary <string, int> env, Program p)
        {
            var v = cond.Eval(env);

            if (v == 0)
            {
                return(p.GetCommand(falseLabel).Run(falseLabel, env, p));
            }
            else
            {
                return(p.GetCommand(trueLabel).Run(trueLabel, env, p));
            }
        }
Esempio n. 3
0
 public double Eval(Dictionary <char, double> variablesValue) => _left.Eval(variablesValue) + _right.Eval(variablesValue);
 public void ConstEvalTest1() =>
 Assert.Equal(7, _constExpr1.Eval());
Esempio n. 5
0
 public int Eval(Dictionary <string, int> env)
 {
     return(op(left.Eval(env), right.Eval(env)));
 }
Esempio n. 6
0
 public int Eval(Dictionary <string, int> env)
 {
     return(op(exp.Eval(env)));
 }
Esempio n. 7
0
 public int Run(int label, Dictionary <string, int> env, Program p)
 {
     return(value.Eval(env));
 }
 public double Eval(Dictionary <char, double> variablesValue)
 {
     return(Math.Pow(_base.Eval(variablesValue), _power.Eval(variablesValue)));
 }
 public double Eval(Dictionary <char, double> variablesValue) => _expr.Eval(variablesValue) * -1;