pSlipObject eval_assignment(pSlip gd, pSlipObject exp, pSlipEnvironment env) { pSlipObject a1; pSlipObject z1; pSlipObject z2; z1 = assignment_value(exp); assert(z1 != NULL); a1 = slip_eval(gd, z1, env); assert(a1 != NULL); z2 = assignment_variable(exp); assert(z2 != NULL); set_variable_value(gd, z2, a1, env); if (gd->running == SLIP_RUNNING) return gd->singleton_OKSymbol; else return gd->singleton_False; }
//one arg: exp static cellpoint eval_assignment(void) { //calls assignment_variable args_push(args_ref(1)); reg = assignment_variable(); stack_push(&vars_stack, reg); //compute assignment value args_push(args_ref(1)); reg = assignment_value(); args_push(a_false); args_push(reg); reg = eval(); stack_push(&vars_stack, reg); //calls set_var_val args_push(current_env); args_push(stack_pop(&vars_stack)); args_push(stack_pop(&vars_stack)); set_var_val(); args_pop(1); return make_symbol("ok"); }
object *eval_assignment(object *exp, object *env) { set_variable_value(assignment_variable(exp), eval(assignment_value(exp), env), env); return ok_symbol(); }
/**** Evaluation ****/ static object *eval_assignment(object *exp, object *env) { return set_variable_value(assignment_variable(exp), bs_eval(assignment_value(exp), env), env); }