diff options
-rw-r--r-- | builtin.cpp | 4 | ||||
-rw-r--r-- | main.cpp | 4 | ||||
-rw-r--r-- | model.cpp | 12 |
3 files changed, 10 insertions, 10 deletions
diff --git a/builtin.cpp b/builtin.cpp index 0228b45..e435c8c 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -701,9 +701,9 @@ void SpecialOptDefine::prepare(Cons *pc) { if (!pc->cdr->is_cons_obj()) throw TokenError(name, RUN_ERR_WRONG_NUM_OF_ARGS); - pc = TO_CONS(pc->cdr); - if (pc->car->is_simple_obj()) // Simple value assignment + if (TO_CONS(pc->cdr)->car->is_simple_obj()) // Simple value assignment { + pc = TO_CONS(pc->cdr); if (!pc->cdr->is_cons_obj()) throw TokenError(name, RUN_ERR_WRONG_NUM_OF_ARGS); pc->skip = true; // Skip the identifier @@ -17,7 +17,7 @@ void tree_print(Cons *ptr) { #endif int main() { -// freopen("in.scm", "r", stdin); + //freopen("in.scm", "r", stdin); Tokenizor *tk = new Tokenizor(); ASTGenerator *ast = new ASTGenerator(); Evaluator *eval = new Evaluator(); @@ -25,7 +25,7 @@ int main() { int rcnt = 0; while (1) { - printf("Sonsi> "); + fprintf(stderr, "Sonsi> "); try { Cons *tree = ast->absorb(tk); @@ -145,19 +145,19 @@ Cons *ProcObj::call(ArgList *args, Environment * &genvt, // Create local env and recall the closure Environment *_envt = new Environment(envt); // static_cast<SymObj*> because the para_list is already checked - Cons *ptr, *ppar; + Cons *ppar; EvalObj *nptr; - for (ptr = TO_CONS(args->cdr), ppar = para_list; + for (ppar = para_list; ppar != empty_list; ppar = TO_CONS(ppar->cdr)) { - _envt->add_binding(static_cast<SymObj*>(ppar->car), ptr->car); - if ((nptr = ptr->cdr)->is_cons_obj()) - ptr = TO_CONS(nptr); + if ((nptr = args->cdr)->is_cons_obj()) + args = TO_CONS(nptr); else break; + _envt->add_binding(static_cast<SymObj*>(ppar->car), args->car); } - if (ptr->cdr != empty_list || ppar->cdr != empty_list) + if (args->cdr != empty_list || ppar != empty_list) throw TokenError("", RUN_ERR_WRONG_NUM_OF_ARGS); genvt = _envt; |