diff options
Diffstat (limited to 'src/cps.cpp')
-rw-r--r-- | src/cps.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/cps.cpp b/src/cps.cpp index 694cbe6..3c4f38d 100644 --- a/src/cps.cpp +++ b/src/cps.cpp @@ -29,7 +29,7 @@ static const AST* cps_value(TEnv& tenv, AST* cont) const { - return tup<ATuple>(loc, cont, this, 0); + return tup(loc, cont, this, 0); } /** (cps (fn (a ...) body) cont) => (cont (fn (a ... k) (cps body k)) */ @@ -39,18 +39,18 @@ cps_fn(TEnv& tenv, AST* cont) const ATuple* copyProt = new ATuple(*prot()); ASymbol* contArg = tenv.penv.gensym("_k"); copyProt->push_back(contArg); - AFn* copy = tup<AFn>(loc, tenv.penv.sym("fn"), copyProt, 0); + AFn* copy = tup(loc, tenv.penv.sym("fn"), copyProt, 0); const_iterator p = begin(); ++(++p); for (; p != end(); ++p) copy->push_back((*p)->(tenv, contArg)); - return tup<ATuple>(loc, cont, copy, 0); + return tup(loc, cont, copy, 0); } static const AST* cps_primitive(TEnv& tenv, AST* cont) const { - return value() ? tup<ATuple>(loc, cont, this, 0) : ATuple::(tenv, cont); + return value() ? tup(loc, cont, this, 0) : ATuple::(tenv, cont); } /** (cps (f a b ...)) => (a (fn (x) (b (fn (y) ... (cont (f x y ...)) */ @@ -74,8 +74,8 @@ cps_tuple(TEnv& tenv, AST* cont) const } else { arg = tenv.penv.gensym("a"); - AFn* thisFn = tup<AFn>(loc, tenv.penv.sym("fn"), - tup<ATuple>((*i)->loc, arg, 0), + AFn* thisFn = tup(loc, tenv.penv.sym("fn"), + tup((*i)->loc, arg, 0), 0); if (firstFnIter == end()) { @@ -94,7 +94,7 @@ cps_tuple(TEnv& tenv, AST* cont) const if (firstFnIter != end()) { // Call this call's callee in the last argument evaluator - ATuple* call = tup<ATuple>(loc, 0); + ATuple* call = tup(loc, 0); assert(funcs.size() == size()); for (size_t i = 0; i < funcs.size(); ++i) call->push_back(funcs[i].second); @@ -104,7 +104,7 @@ cps_tuple(TEnv& tenv, AST* cont) const return (*firstFnIter)->(tenv, firstFn); } else { assert(head()->value()); - ATuple* ret = tup<ATuple>(loc, 0); + ATuple* ret = tup(loc, 0); FOREACHP(const_iterator, i, this) ret->push_back((*i)); if (!is_primitive(this)) @@ -120,7 +120,7 @@ cps_def(TEnv& tenv, AST* cont) const AST* val = body()->(tenv, cont); ATuple* valCall = val->to_tuple(); ATuple::iterator i = valCall->begin(); - return tup<ADef>(loc, tenv.penv.sym("def"), sym(), *++i, 0); + return tup(loc, tenv.penv.sym("def"), sym(), *++i, 0); } /** (cps (if c t ... e)) => */ @@ -133,13 +133,13 @@ cps_iff(TEnv& tenv, AST* cont) const AST* exp = *++i; AST* next = *++i; if (cond->value()) { - return tup<AIf>(loc, tenv.penv.sym("if"), cond, + return tup(loc, tenv.penv.sym("if"), cond, exp->(tenv, cont), next->(tenv, cont), 0); } else { - AFn* contFn = tup<AFn>(loc, tenv.penv.sym("fn"), - tup<ATuple>(cond->loc, argSym, tenv.penv.gensym("_k"), 0), - tup<AIf>(loc, tenv.penv.sym("if"), argSym, + AFn* contFn = tup(loc, tenv.penv.sym("fn"), + tup(cond->loc, argSym, tenv.penv.gensym("_k"), 0), + tup(loc, tenv.penv.sym("if"), argSym, exp->(tenv, cont), next->(tenv, cont), 0)); return cond->(tenv, contFn); |