From 3b390967e7c2ee4ac6d1a67c77f40ed43005e012 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Sun, 20 Nov 2016 11:27:07 +0100 Subject: Initial --- environment.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 environment.h (limited to 'environment.h') diff --git a/environment.h b/environment.h new file mode 100644 index 0000000..5776122 --- /dev/null +++ b/environment.h @@ -0,0 +1,34 @@ +#pragma once + +#include +#include +#include +#include "ast.h" +#include "global.h" + +using namespace std; + + +class Environment{ +public: + using Hook = function; + using Hook2 = function; + +private: + unordered_map defs; + unordered_map hooks; + + void reduce(AST &ast,i64 depth=0); + bool betareduce(AST &ast,i64 depth); + +public: + void load(const Environment &other); + + AST run(const AST &ast); + + void define(const Name &name,const AST &ast); + void define(const Name &name,const Hook &hook); + void define2(const Name &name,const Hook2 &hook2); + + AST get(const Name &name); +}; -- cgit v1.2.3-70-g09d2