-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
24 lines (22 loc) · 677 Bytes
/
main.cpp
File metadata and controls
24 lines (22 loc) · 677 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
/*
* Main class of the Oberon-0 compiler.
*
* Created by Michael Grossniklaus on 12/14/17.
*/
#include <iostream>
#include "scanner/Scanner.h"
#include "parser/Parser.h"
int main(const int argc, const char *argv[]) {
if (argc != 2) {
std::cout << "Usage: oberon0c <filename>" << std::endl;
return 1;
}
std::string filename = argv[1];
auto logger = std::make_unique<Logger>();
logger->setLevel(LogLevel::DEBUG);
auto scanner = std::make_unique<Scanner>(filename, logger.get());
auto parser = std::make_unique<Parser>(scanner.get(), logger.get());
parser->parse();
logger->info(filename, "Parsing complete.");
exit(0);
}