diff options
Diffstat (limited to 'src/resp.hpp')
-rw-r--r-- | src/resp.hpp | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/src/resp.hpp b/src/resp.hpp index 0f372a1..724ed5d 100644 --- a/src/resp.hpp +++ b/src/resp.hpp @@ -525,15 +525,6 @@ struct List { typedef List<AType, AType> TList; -/// Function call/application, e.g. "(func arg1 arg2)" -struct ACall : public ATuple { - ACall(const ATuple* exp) : ATuple(*exp) {} - ACall(Cursor c, AST* ast, va_list args) : ATuple(c, ast, args) {} - ACall(AST* first, AST* rest, Cursor c) : ATuple(first, rest, c) {} - void constrain(TEnv& tenv, Constraints& c) const throw(Error); -}; - - /*************************************************************************** * Parser: S-Expressions (SExp) -> AST Nodes (AST) * ***************************************************************************/ @@ -718,7 +709,7 @@ struct Engine { const ATuple* args, const AType* type) = 0; - virtual void pushFunctionArgs(CEnv& cenv, const ACall* fn, const AType* type, CFunc f) = 0; + virtual void pushFunctionArgs(CEnv& cenv, const ATuple* fn, const AType* type, CFunc f) = 0; virtual void finishFunction(CEnv& cenv, CFunc f, CVal ret) = 0; virtual void eraseFunction(CEnv& cenv, CFunc f) = 0; @@ -727,9 +718,9 @@ struct Engine { virtual CVal compileLiteral(CEnv& cenv, const AST* lit) = 0; virtual CVal compileString(CEnv& cenv, const char* str) = 0; virtual CVal compileCall(CEnv& cenv, CFunc f, const AType* fT, ValVec& args) = 0; - virtual CVal compilePrimitive(CEnv& cenv, const ACall* prim) = 0; - virtual CVal compileIf(CEnv& cenv, const ACall* aif) = 0; - virtual CVal compileMatch(CEnv& cenv, const ACall* match) = 0; + virtual CVal compilePrimitive(CEnv& cenv, const ATuple* prim) = 0; + virtual CVal compileIf(CEnv& cenv, const ATuple* aif) = 0; + virtual CVal compileMatch(CEnv& cenv, const ATuple* match) = 0; virtual CVal compileGlobal(CEnv& cenv, const AType* t, const string& sym, CVal val) = 0; virtual CVal getGlobal(CEnv& cenv, const string& sym, CVal val) = 0; virtual void writeModule(CEnv& cenv, std::ostream& os) = 0; @@ -800,15 +791,15 @@ struct CEnv { Env<const ASymbol*, const AST*> code; - typedef map<const ACall*, CFunc> Impls; + typedef map<const ATuple*, CFunc> Impls; Impls impls; - CFunc findImpl(const ACall* fn, const AType* type) { + CFunc findImpl(const ATuple* fn, const AType* type) { Impls::const_iterator i = impls.find(fn); return (i != impls.end()) ? i->second : NULL; } - void addImpl(const ACall* fn, CFunc impl) { + void addImpl(const ATuple* fn, CFunc impl) { impls.insert(make_pair(fn, impl)); } @@ -817,8 +808,8 @@ struct CEnv { CFunc currentFn; ///< Currently compiling function struct FreeVars : public std::vector<ASymbol*> { - FreeVars(ACall* f, const std::string& n) : fn(f), implName(n) {} - ACall* const fn; + FreeVars(ATuple* f, const std::string& n) : fn(f), implName(n) {} + ATuple* const fn; const std::string implName; int32_t index(ASymbol* sym) { const_iterator i = find(begin(), end(), sym); @@ -833,15 +824,15 @@ struct CEnv { typedef std::stack<FreeVars> LiftStack; LiftStack liftStack; - typedef map<const ACall*, std::string> Names; + typedef map<const ATuple*, std::string> Names; Names names; - const std::string name(const ACall* fn) const { + const std::string name(const ATuple* fn) const { Names::const_iterator i = names.find(fn); return (i != names.end()) ? i->second : ""; } - void setName(const ACall* fn, const std::string& name) { + void setName(const ATuple* fn, const std::string& name) { names.insert(make_pair(fn, name)); } private: |