-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
44 lines (36 loc) · 808 Bytes
/
Main.cpp
File metadata and controls
44 lines (36 loc) · 808 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
41
42
43
44
#include <string>
#include <vector>
#include <sstream>
#include <fstream>
#include <iostream>
#include <Lexer/Lexer.hpp>
#include <Parser/AST.hpp>
int main(int argc, char **argv)
{
std::vector<std::string> Args;
for (int Index = 1; Index < argc; ++Index)
{
Args.push_back(std::string(argv[Index]));
}
for (auto &Item : Args)
{
merc::Lexer L;
std::ifstream File(Item);
std::cerr << "open " << Item << std::endl;
if (!File.is_open())
{
std::cerr << "Unable to open " << Item << std::endl;
continue;
}
std::stringstream Stream;
Stream << File.rdbuf();
L.ParseString(Stream.str());
std::list<merc::Token> Toks = L.GetTokens();
for (auto &I : Toks)
{
std::cout << "(" << I.Token << ", " << I.Type << ")" << std::endl;
}
merc::ParseTokens(Toks);
}
return 0;
}