-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommandCompiler.h
More file actions
40 lines (33 loc) · 767 Bytes
/
CommandCompiler.h
File metadata and controls
40 lines (33 loc) · 767 Bytes
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
#pragma once
#include <string>
#include <vector>
#include "CommandScanner.h"
#include "CommandVm.h"
struct CommandStringObj {
std::string command;
bool clears;
};
struct CommandJson {
std::string command;
std::string name;
bool clears;
int num;
};
struct RootJson {
std::vector<CommandJson> commands;
};
class CommandCompiler {
public:
CommandCompiler();
~CommandCompiler();
void init(const char* path);
const CommandCode* getCommand(int index) const;
std::string opcodeToString(CommandOp opcode);
private:
void compile(const char* inputString, bool clears);
CommandCode compileNode();
void printCode(const CommandCode& code);
std::vector<CommandCode> commands;
CommandScanner commandScanner;
CommandToken* currentToken;
};