-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdorado.cpp
53 lines (50 loc) · 1.1 KB
/
dorado.cpp
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
// Dorado编译器工具集
// 2017 北京石油化工学院
// 王万霖 梁永宁
// g++ dorado.cpp -o dorado --std=c++11
#include <iostream>
#include <fstream>
#include <sstream>
#include <codecvt>
#include <locale>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cstdlib>
using namespace std;
#include "u16string.h"
#include "dorado.h"
#include "preProcess.h"
#include "splitBlock.h"
#include "participle.h"
#include "msm.h"
int main(int argc, char* argv[])
{
fstream getSourceFile("test/a.cpp", std::ios::in);
string getSourceFileEachRow;
vector<u16string> lines;
while (getline(getSourceFile, getSourceFileEachRow))
{
lines.push_back(from_bytes(getSourceFileEachRow));
}
preProcess(lines);
auto blocks = splitBlock(lines);
auto mainLines = fetchMainFunction(blocks);
vector<string> mips;
for (auto line: mainLines)
{
vector<u16string> mips16 = wordSegment(line);
for (auto element: mips16)
{
mips.push_back(to_bytes(element));
}
}
mips.push_back("end");
msm(mips);
return 0;
}