aboutsummaryrefslogtreecommitdiffstats
path: root/tuplr.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'tuplr.hpp')
-rw-r--r--tuplr.hpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/tuplr.hpp b/tuplr.hpp
index 16a9a75..cc0b086 100644
--- a/tuplr.hpp
+++ b/tuplr.hpp
@@ -406,10 +406,6 @@ struct Env : public list< map<K,V> > {
* Typing (Prefix T for Type) *
***************************************************************************/
-struct TSubst : public map<AType*, AType*> {
- TSubst(AType* s=0, AType* t=0) { if (s && t) insert(make_pair(s, t)); }
-};
-
/// Type-Time Environment
struct TEnv : public Env<const AST*,AType*> {
TEnv(PEnv& p) : penv(p), varID(1) {}
@@ -417,6 +413,9 @@ struct TEnv : public Env<const AST*,AType*> {
Constraint(AType* a, AType* b, Cursor c) : pair<AType*,AType*>(a, b), loc(c) {}
Cursor loc;
};
+ struct Subst : public map<AType*, AType*> {
+ Subst(AType* s=0, AType* t=0) { if (s && t) insert(make_pair(s, t)); }
+ };
typedef list<Constraint> Constraints;
AType* var(Cursor c=Cursor()) { return new AType(varID++, c); }
AType* type(const AST* ast) {
@@ -430,9 +429,9 @@ struct TEnv : public Env<const AST*,AType*> {
assert(!dynamic_cast<const AType*>(o));
constraints.push_back(Constraint(type(o), t, o->loc));
}
- void solve() { apply(unify(constraints)); }
- void apply(const TSubst& substs);
- static TSubst unify(const Constraints& c);
+ void solve() { apply(unify(constraints)); }
+ void apply(const Subst& substs);
+ static Subst unify(const Constraints& c);
PEnv& penv;
Constraints constraints;
@@ -444,8 +443,6 @@ struct TEnv : public Env<const AST*,AType*> {
* Code Generation *
***************************************************************************/
-struct CEnvPimpl;
-
/// Compile-Time Environment
struct CEnv {
CEnv(PEnv& p, TEnv& t, CEngine& e, ostream& os=std::cout, ostream& es=std::cerr);
@@ -472,7 +469,8 @@ struct CEnv {
Log log;
private:
- CEnvPimpl* _pimpl;
+ struct PImpl; ///< Private Implementation
+ PImpl* _pimpl;
};