-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
32 lines (25 loc) · 814 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
#include "ast.hpp"
#include "typecheck.hpp"
#include "codegeneration.hpp"
#include "parser.hpp"
extern int yydebug;
extern int yyparse();
ASTNode* astRoot;
int main(void) {
yydebug = 0; // Set this to 1 if you want the parser to output debug information and parse process
astRoot = NULL;
yyparse();
if (astRoot) {
TypeCheck* typecheck = new TypeCheck();
astRoot->accept(typecheck);
ClassTable* classTable = typecheck->classTable;
if (classTable) {
// Uncomment the following line to print the class table after it is generated
//print(*classTable);
CodeGenerator* codegen = new CodeGenerator();
codegen->classTable = classTable;
astRoot->accept(codegen);
}
}
return 0;
}