-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.C
37 lines (32 loc) · 767 Bytes
/
main.C
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
#include <iostream>
#include <iomanip>
#include "parser.H"
#include "sem.H"
#include "codegen.H"
using namespace std;
int main(int argc,char* argv[]) {
const char* fn = 0;
if (argc == 2)
fn = argv[1];
//cout << argc << ":input filename:" << fn << endl;
Parser p;
p.run(fn);
// cout << "root:" << p.getRoot() << endl;
AST::Node* root = p.getRoot();
if (root) {
// root->print(std::cout);
try {
SEM::Env env;
env.analyze(root);
// root->print(std::cout);
IR::Code gen;
gen.generate(root);
} catch(int ec) {
return ec;
}
/* Code code;
code.generate(root);
code.dump();
*/
} else std::cout << "couldn't parse" << std::endl;
}