diff options
Diffstat (limited to 'src/cps.cpp')
-rw-r--r-- | src/cps.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/cps.cpp b/src/cps.cpp index 6711556..831f53f 100644 --- a/src/cps.cpp +++ b/src/cps.cpp @@ -1,18 +1,18 @@ -/* Tuplr Type Inferencing +/* Resp Type Inferencing * Copyright (C) 2008-2009 David Robillard <dave@drobilla.net> * - * Tuplr is free software: you can redistribute it and/or modify it under + * Resp is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. * - * Tuplr is distributed in the hope that it will be useful, but WITHOUT + * Resp is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General * Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with Tuplr. If not, see <http://www.gnu.org/licenses/>. + * along with Resp. If not, see <http://www.gnu.org/licenses/>. */ /** @file @@ -20,18 +20,18 @@ */ #include <set> -#include "tuplr.hpp" +#include "resp.hpp" /** (cps x cont) => (cont x) */ AST* -AST::cps(TEnv& tenv, AST* cont) +AST::cps(TEnv& tenv, AST* cont) const { return tup<ACall>(loc, cont, this, 0); } /** (cps (fn (a ...) body) cont) => (cont (fn (a ... k) (cps body k)) */ AST* -AFn::cps(TEnv& tenv, AST* cont) +AFn::cps(TEnv& tenv, AST* cont) const { ATuple* copyProt = new ATuple(*prot()); ASymbol* contArg = tenv.penv.gensym("_k"); @@ -45,14 +45,14 @@ AFn::cps(TEnv& tenv, AST* cont) } AST* -APrimitive::cps(TEnv& tenv, AST* cont) +APrimitive::cps(TEnv& tenv, AST* cont) const { return value() ? tup<ACall>(loc, cont, this, 0) : ACall::cps(tenv, cont); } /** (cps (f a b ...)) => (a (fn (x) (b (fn (y) ... (cont (f x y ...)) */ AST* -ACall::cps(TEnv& tenv, AST* cont) +ACall::cps(TEnv& tenv, AST* cont) const { std::vector< std::pair<AFn*, AST*> > funcs; AFn* fn = NULL; @@ -62,10 +62,10 @@ ACall::cps(TEnv& tenv, AST* cont) // Argument evaluation continuations are not themselves in CPS. // Each makes a tail call to the next, and the last makes a tail // call to the continuation of this call - iterator firstFnIter = end(); - AFn* firstFn = NULL; - ssize_t index = 0; - FOREACHP(iterator, i, this) { + const_iterator firstFnIter = end(); + AFn* firstFn = NULL; + ssize_t index = 0; + FOREACHP(const_iterator, i, this) { if (!(*i)->to<ATuple*>()) { funcs.push_back(make_pair((AFn*)NULL, (*i))); } else { @@ -102,9 +102,9 @@ ACall::cps(TEnv& tenv, AST* cont) } else { assert(head()->value()); ACall* ret = tup<ACall>(loc, 0); - FOREACHP(iterator, i, this) + FOREACHP(const_iterator, i, this) ret->push_back((*i)); - if (!to<APrimitive*>()) + if (!to<const APrimitive*>()) ret->push_back(cont); return ret; } @@ -112,7 +112,7 @@ ACall::cps(TEnv& tenv, AST* cont) /** (cps (def x y)) => (y (fn (x) (cont))) */ AST* -ADef::cps(TEnv& tenv, AST* cont) +ADef::cps(TEnv& tenv, AST* cont) const { AST* val = body()->cps(tenv, cont); ACall* valCall = val->to<ACall*>(); @@ -122,7 +122,7 @@ ADef::cps(TEnv& tenv, AST* cont) /** (cps (if c t ... e)) => */ AST* -AIf::cps(TEnv& tenv, AST* cont) +AIf::cps(TEnv& tenv, AST* cont) const { ASymbol* argSym = tenv.penv.gensym("c"); const_iterator i = begin(); |