summaryrefslogtreecommitdiff
path: root/runtime.h
blob: 1b20329813da6eb04ea385400724e9f0beed14ee (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
#pragma once

#include <fstream>
#include <vector>
#include <string>

using namespace std;

enum Stackitemtype{
	SIT_INT,
	SIT_STR,
	SIT_ARR
};

struct Stackitem{
	Stackitemtype type=SIT_INT;
	string strval;
	int intval=0;
	vector<Stackitem> arrval;

	Stackitem(void);

	Stackitem(int _i); //int init
	Stackitem(const string&); //string init
	Stackitem(const vector<Stackitem>&); //array init

	Stackitem(const Stackitem&);
	Stackitem(Stackitem &&other);

	Stackitem& operator=(const Stackitem&);
	Stackitem& operator=(Stackitem &&other);

	explicit operator bool(void) const;

	bool operator==(const Stackitem &other) const;
	bool operator!=(const Stackitem &other) const;
};

string to_string(const Stackitem&);

vector<string> tokenise(istream &stream);
void run(vector<string> T);