public override int Eval(REnv env, FEnv fEnv) { int x = e1.Eval(env, fEnv); env.AllocateLocal(this.name); env.GetVariable(this.name).value = x; int y = e2.Eval(env, fEnv); env.PopEnv(); return(y); }
public override int Eval(REnv env, FEnv fEnv) { int res1 = e1.Eval(env, fEnv); env.AllocateLocal(varName); env.GetVariable(varName).value = res1; int res2 = e2.Eval(env, fEnv); env.PopEnv(); return(res2); }
public int Eval(REnv env, FEnv fenv, List <int> args) { int i = 0; foreach (var formArg in formArgs) { env.AllocateLocal(formArg.Fst); env.GetVariable(formArg.Fst).value = args[i]; i++; } int v = body.Eval(env, fenv); foreach (var formArg in formArgs) { env.PopEnv(); } return(v); }
public int Eval(REnv env, FEnv fenv, int[] values) { int v; if (formArgs.Count > 0) { int index = 0; foreach (Pair <String, Type> argPair in this.formArgs) { env.AllocateLocal(argPair.Fst); env.GetVariable(argPair.Fst).value = values[index++]; } v = body.Eval(env, fenv); foreach (Pair <String, Type> argPair in this.formArgs) { env.PopEnv(); } } else { v = body.Eval(env, fenv); } return(v); }
public override int Eval(REnv env, FEnv fEnv) { return(env.GetVariable(name).value); }