-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
49 lines (39 loc) · 853 Bytes
/
main.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
#include <iostream>
#include <vector>
#include <regex>
#include <fstream>
#include "token/token.h"
#include "lexer/lexer.h"
#include "error/error.h"
using namespace std;
///////////////////////////////////////////////
// //
// MAIN //
// //
///////////////////////////////////////////////
int main() {
vector<char> program;
char data;
cout << "Basic >" << endl;
ofstream file("input.txt");
cin >> data;
do {
file << data;
cin >> data;
} while(data != 'E');
file.close();
char output;
ifstream file2("input.txt");
while(file2 >> output) {
program.push_back(output);
}
Lexer lex(program);
GeneratedTokens tokens = lex.make_tokens();
if(tokens.error_count == 0)
{
tokens.print();
}else{
cout << tokens.error.error_type << ": " << tokens.error.error_description << endl;
}
return 0;
}