aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compile.cpp16
-rw-r--r--src/llvm.cpp10
-rw-r--r--src/parse.cpp2
-rw-r--r--src/pprint.cpp10
-rw-r--r--src/repl.cpp8
-rw-r--r--src/resp.hpp24
6 files changed, 35 insertions, 35 deletions
diff --git a/src/compile.cpp b/src/compile.cpp
index f94967f..b5d7222 100644
--- a/src/compile.cpp
+++ b/src/compile.cpp
@@ -80,7 +80,7 @@ static CVal
compile_fn(CEnv& cenv, const ATuple* fn) throw()
{
assert(!cenv.currentFn);
-
+
const AType* type = cenv.type(fn);
CFunc f = cenv.findImpl(fn, type);
if (f)
@@ -98,9 +98,9 @@ compile_fn(CEnv& cenv, const ATuple* fn) throw()
// Write function conclusion and pop stack frame
cenv.engine()->finishFn(cenv, f, retVal);
- cenv.pop();
+ cenv.pop();
cenv.currentFn = NULL;
-
+
cenv.vals.def(cenv.penv.sym(cenv.name(fn)), f);
cenv.addImpl(fn, f);
return f;
@@ -130,19 +130,19 @@ compile_let(CEnv& cenv, const ATuple* let) throw()
const ATuple* vars = let->list_ref(1)->to_tuple();
cenv.push();
-
+
for (ATuple::const_iterator i = vars->begin(); i != vars->end();) {
const ASymbol* sym = (*i++)->to_symbol();
const AST* val = (*i++);
cenv.def(sym, val, cenv.type(val), resp_compile(cenv, val));
}
-
+
CVal ret = NULL;
for (ATuple::const_iterator i = let->iter_at(2); i != let->end(); ++i)
ret = resp_compile(cenv, *i);
cenv.pop();
-
+
return ret;
}
@@ -152,7 +152,7 @@ compile_match(CEnv& cenv, const ATuple* match) throw()
IfState state = cenv.engine()->compileIfStart(cenv);
CVal matchee = resp_compile(cenv, match->list_ref(1));
CVal rtti = cenv.engine()->compileDot(cenv, matchee, 0);
-
+
size_t idx = 1;
for (ATuple::const_iterator i = match->iter_at(2); i != match->end(); ++idx) {
const AST* pat = *i++;
@@ -160,7 +160,7 @@ compile_match(CEnv& cenv, const ATuple* match) throw()
const ASymbol* sym = pat->as_tuple()->head()->as_symbol();
CVal condV = cenv.engine()->compileIsA(cenv, rtti, sym);
-
+
cenv.engine()->compileIfBranch(cenv, state, condV, body);
}
diff --git a/src/llvm.cpp b/src/llvm.cpp
index c3f4d2c..de53baa 100644
--- a/src/llvm.cpp
+++ b/src/llvm.cpp
@@ -73,11 +73,11 @@ struct LLVMEngine : public Engine {
CVal compileLiteral(CEnv& cenv, const AST* lit);
CVal compilePrimitive(CEnv& cenv, const ATuple* prim);
CVal compileString(CEnv& cenv, const char* str);
-
+
void writeModule(CEnv& cenv, std::ostream& os);
const string call(CEnv& cenv, CFunc f, const AType* retT);
-
+
private:
typedef pair<Value*, BasicBlock*> IfBranch;
typedef vector<IfBranch> IfBranches;
@@ -93,7 +93,7 @@ private:
function->getBasicBlockList().push_back(block);
engine->builder.SetInsertPoint(block);
}
-
+
inline Value* llVal(CVal v) { return static_cast<Value*>(v); }
inline Function* llFunc(CFunc f) { return static_cast<Function*>(f); }
const Type* llType(const AType* t);
@@ -304,7 +304,7 @@ LLVMEngine::pushFnArgs(CEnv& cenv, const ATuple* prot, const AType* type, CFunc
const AType* argsT = type->prot()->as_type();
Function* f = llFunc(cfunc);
-
+
// Bind argument values in CEnv
ATuple::const_iterator p = prot->begin();
ATuple::const_iterator pT = argsT->begin();
@@ -361,7 +361,7 @@ LLVMEngine::compileIfBranch(CEnv& cenv, IfState s, CVal condV, const AST* then)
Value* thenV = llVal(resp_compile(cenv, then));
engine->builder.CreateBr(state->mergeBB);
state->branches.push_back(make_pair(thenV, thenBB));
-
+
appendBlock(engine, state->parent, nextBB);
}
diff --git a/src/parse.cpp b/src/parse.cpp
index 73925b3..a861aca 100644
--- a/src/parse.cpp
+++ b/src/parse.cpp
@@ -156,7 +156,7 @@ read_symbol(PEnv& penv, Cursor& cur, istream& in)
return penv.sym(str, cur);
}
-
+
/// Read an expression from @a in
const AST*
PEnv::parse(Cursor& cur, istream& in)
diff --git a/src/pprint.cpp b/src/pprint.cpp
index 92898ac..5d03c78 100644
--- a/src/pprint.cpp
+++ b/src/pprint.cpp
@@ -41,14 +41,14 @@ print_list_one_line(ostream& out, const ATuple* tup, ATuple::const_iterator i,
for (; i != tup->end(); ) {
ATuple::const_iterator next = i;
++next;
-
+
print_to(out, *i, indent, cenv, types);
if (elem_types)
out << " :" << cenv->tsubst.apply(cenv->tenv.var(*i));
if (next != tup->end())
out << " ";
-
+
i = next;
}
@@ -75,7 +75,7 @@ print_list(ostream& out, const ATuple* tup, ATuple::const_iterator i,
for (; i != tup->end(); ) {
ATuple::const_iterator next = i;
++next;
-
+
print_to(out, *i, indent, cenv, types);
if (next != tup->end()) {
newline(out, indent);
@@ -135,7 +135,7 @@ print_to(ostream& out, const AST* ast, unsigned indent, CEnv* cenv, bool types)
print_to(out, (*i++), child_indent, cenv, types);
out << ")";
newline(out, 0);
-
+
} else if (form == "fn") {
// Print prototype (possibly with parameter type annotations)
const ATuple* pat = (*i++)->as_tuple();
@@ -167,7 +167,7 @@ print_to(ostream& out, const AST* ast, unsigned indent, CEnv* cenv, bool types)
out << (*v);
if (types)
out << " :" << cenv->tsubst.apply(cenv->tenv.var(*v));
-
+
out << " " << (*++v);
if (++v != vars->end())
diff --git a/src/repl.cpp b/src/repl.cpp
index f5f7fd4..a1d3e74 100644
--- a/src/repl.cpp
+++ b/src/repl.cpp
@@ -48,7 +48,7 @@ readParseType(CEnv& cenv, Cursor& cursor, istream& is, const AST*& exp, const AS
resp_constrain(cenv.tenv, c, ast); // Constrain types
//cout << "(CONSTRAINTS " << endl << c << ")" << endl;
-
+
const Subst subst = unify(c); // Solve type constraints
for (Subst::const_iterator i = subst.begin(); i != subst.end(); ++i) {
if (!cenv.tsubst.contains(i->first)) { // Substitution's LHS is a new variable
@@ -89,11 +89,11 @@ eval(CEnv& cenv, Cursor& cursor, istream& is, bool execute)
typedef list<const AST*> Parsed;
Parsed parsed;
-
+
try {
while (readParseType(cenv, cursor, is, exp, ast))
parsed.push_back(ast);
-
+
if (cenv.args.find("-T") != cenv.args.end()) {
for (Parsed::const_iterator i = parsed.begin(); i != parsed.end(); ++i)
pprint(cout, *i, &cenv, true);
@@ -148,7 +148,7 @@ eval(CEnv& cenv, Cursor& cursor, istream& is, bool execute)
cenv.engine()->writeModule(cenv, cenv.out);
return 0;
}
-
+
// Call and print result
callPrintCollect(cenv, f, ast, type, execute);
diff --git a/src/resp.hpp b/src/resp.hpp
index 7767d33..d90ccf0 100644
--- a/src/resp.hpp
+++ b/src/resp.hpp
@@ -237,7 +237,7 @@ struct ATuple : public AST {
}
ATuple(Cursor c, AST* ast, va_list args) : AST(T_TUPLE, c), _len(0), _vec(0) {
if (!ast) return;
-
+
_len = 2;
_vec = (const AST**)malloc(sizeof(AST*) * _len);
_vec[0] = ast;
@@ -250,7 +250,7 @@ struct ATuple : public AST {
tail = tup;
}
}
-
+
const AST* head() const { assert(_len > 0); return _vec[0]; }
const AST* last() const { return _vec[_len - 1]; }
bool empty() const { return _len == 0; }
@@ -277,7 +277,7 @@ struct ATuple : public AST {
}
void last(AST* ast) { _vec[_len - 1] = ast; }
-
+
struct const_iterator {
explicit const_iterator(const ATuple* n) : node(n) {
assert(!n || n->tup_len() == 0 || n->tup_len() == 2);
@@ -310,7 +310,7 @@ struct ATuple : public AST {
const AST* operator*() { return node->head(); }
const ATuple* node;
};
-
+
const_iterator begin() const { assert(_len == 0 || _len == 2); return const_iterator(this); }
const_iterator end() const { return const_iterator(NULL); }
@@ -323,9 +323,9 @@ struct ATuple : public AST {
}
const AST* list_ref(unsigned index) const { return *iter_at(index); }
-
+
const ATuple* prot() const { return list_ref(1)->as_tuple(); }
-
+
private:
friend class GC;
size_t _len;
@@ -336,11 +336,11 @@ static bool
list_contains(const ATuple* head, const AST* child) {
if (*head == *child)
return true;
-
+
FOREACHP(ATuple::const_iterator, p, head) {
if (**p == *child)
return true;
-
+
const ATuple* tup = (*p)->to_tuple();
if (tup && list_contains(tup, child))
return true;
@@ -443,7 +443,7 @@ AST::operator==(const AST& rhs) const
const Tag tag = this->tag();
if (tag != rhs.tag())
return false;
-
+
switch (tag) {
case T_BOOL:
return literal_equals((const ALiteral<bool>*)this, (const ALiteral<bool>*)&rhs);
@@ -710,15 +710,15 @@ struct Engine {
const std::string& name,
const ATuple* args,
const AType* type) = 0;
-
+
virtual void pushFnArgs(CEnv& cenv,
const ATuple* prot,
const AType* type,
CFunc f) = 0;
-
+
virtual void finishFn(CEnv& cenv, CFunc f, CVal ret) = 0;
virtual void eraseFn(CEnv& cenv, CFunc f) = 0;
-
+
virtual CVal compileCall(CEnv& cenv, CFunc f, const AType* fT, CVals& args) = 0;
virtual CVal compileCons(CEnv& cenv, const AType* t, CVal rtti, CVals& f) = 0;
virtual CVal compileDot(CEnv& cenv, CVal tup, int32_t index) = 0;