summaryrefslogtreecommitdiff
path: root/evaluate.h
blob: 9c50b24acf7dba787b70c86ce3a25bf47273cb90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once

#include <string>
#include <unordered_map>
#include "ast.h"

using namespace std;


class ScopeVal;

class Value{
public:
	enum class Type{
		number,
		string,
		scope,
	};

	Type type;
	double numval;
	string strval;
	ScopeVal *scope;

	Value(double numval);
	Value(const string &strval);
	Value(ScopeVal *scope);
};

class ScopeVal{
public:
	unordered_map<string,Value> values;
};


namespace A {

	template <typename T>
	T* ref(T *value);

	template <typename T>
	void unref(T *value);

}


void evaluateSTL(const StatementList &stl);