-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
27 lines (25 loc) · 860 Bytes
/
main.cpp
File metadata and controls
27 lines (25 loc) · 860 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
#include <iostream>
#include "RuM.h"
/*
* DISCLAIMERS:
* File reading code was taken from here: http://stackoverflow.com/questions/18398167/how-to-copy-a-txt-file-to-a-char-array-in-c
* and from here: http://stackoverflow.com/questions/347949/how-to-convert-a-stdstring-to-const-char-or-char
*
* Additionally, some inspiration was taken from the sample project code provided
*/
int main(int argc, char* argv[]) {
RuMInterpreter interpreter;
interpreter.setDisplayParseTree(false);
if (argc == 2) {
// Pass the filename to the interpreter
try {
std::cout << "Running file: " << argv[1] << std::endl;
interpreter.fileMode(argv[1]);
}
catch (const std::runtime_error& e) {
std::cout << e.what() << std::endl;
}
}
interpreter.interactiveMode();
return 0;
}