-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRuntime.h
More file actions
79 lines (45 loc) · 1.36 KB
/
Copy pathRuntime.h
File metadata and controls
79 lines (45 loc) · 1.36 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef H_RUNTIME
#define H_RUNTIME
#include "Variables.h"
#include "ControlFlow.h"
#include "Parser.h"
struct RuaEnv {
std::string name;
std::map<int, uint> varmap;
std::stack<uLL> varstk;
};
class RuaRuntime {
private:
uint m_nxt_temp_tok_id;
RuaVarManager m_vm;
RuaEnv *m_global_env;
std::stack<ruaCLass*> m_this_stk;
std::stack<RuaEnv> m_env_stk;
RuaParser m_parser;
RuaData m_tmp;
TokenInfo m_ti;
RuaControlFLow* m_global_cf;
std::map<uint, RuaOpeInfo> m_opeMap;
std::deque<uint> m_tmpTokCycQueue;
RuaSentence parseExpression(int prio);
RuaControlFLow parseControlFlow();
inline void popStack(RuaSentence& rs, std::stack<RuaCommand>& stk);
int runControlFlow(RuaControlFLow* cf);
int runSentence(RuaSentence* sent, bool keep_top);
int runCommand(RuaCommand cmd);
void UnrefVar(uLL tok);
int giveValue(uLL src, uLL dst);
public:
RuaControlFLow*& GetGlobalControlFlow();
RuaEnv* GetGlobalEnvironment();
uint nxtTempTokId();
uint FindRealVar(uLL tokid, bool translated = true);
RuaVarManager* GetVarManager();
typedef uint _ruaFunc(RuaRuntime*, uint);
RuaRuntime();
void SetConstant(std::string text, RuaVariable value);
int Preprocess(std::string text);
void Run();
void Execute(std::string program);
};
#endif //H_RUNTIME