summaryrefslogtreecommitdiff
path: root/sugar.h
diff options
context:
space:
mode:
Diffstat (limited to 'sugar.h')
-rw-r--r--sugar.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/sugar.h b/sugar.h
new file mode 100644
index 0000000..1140ef3
--- /dev/null
+++ b/sugar.h
@@ -0,0 +1,35 @@
+#pragma once
+
+#include <iostream>
+#include <string>
+#include <unordered_map>
+#include <vector>
+#include "ast.h"
+#include "environment.h"
+
+using namespace std;
+
+
+using Hook2 = function<AST(Environment&,const AST&,const AST&)>;
+using Hook3 = function<AST(Environment&,const AST&,const AST&,const AST&)>;
+
+
+extern const unordered_map<AST::Type,string> typeName;
+
+ostream& operator<<(ostream &os,AST::Type t);
+
+template <typename T>
+string stringify(const vector<T> &v,const string &join=", ");
+
+
+Hook checkedHook(const Name &name,
+ const vector<AST::Type> &types,
+ const Hook &func);
+
+Hook checkedHook(const Name &name,
+ const vector<AST::Type> &types1,const vector<AST::Type> &types2,
+ const Hook2 &func);
+
+Hook checkedHook(const Name &name,
+ const vector<AST::Type> &types1,const vector<AST::Type> &types2,const vector<AST::Type> &types3,
+ const Hook3 &func);