-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompiler.cpp
More file actions
46 lines (38 loc) · 1.06 KB
/
compiler.cpp
File metadata and controls
46 lines (38 loc) · 1.06 KB
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
45
46
#include "compiler.hpp"
#include "builder/timeline.hpp"
#include "translate/translation.hpp"
#include "translate/build_symbol.hpp"
#include "ast/ast.hpp"
#include "utils.hpp"
#include <iostream>
#include <string>
using namespace GMAM;
GMAMCompiler::GMAMCompiler() {
program = NULL;
timeline = new builder::Timeline();
}
void GMAMCompiler::parse(const char *inputFile) {
if (program == NULL) program = parseFile(inputFile);
else {
ast::Program *newTree = parseFile(inputFile);
program->extend(newTree);
}
}
void GMAMCompiler::type_check() {
program->accept(new BuildSymbol());
}
void GMAMCompiler::compile() {
program->accept(new Translation(timeline));
}
void GMAMCompiler::debug_parse(std::ostream &os) {
os << program << std::endl;
}
void GMAMCompiler::debug_type_check(std::ostream &os) {
os << (scope::Scope *)program->ATTR(gscope) << std::endl;
}
void GMAMCompiler::debug_compile(std::ostream &os) {
timeline->debug_print(os);
}
void GMAMCompiler::final_print(std::ostream &os) {
timeline->final_print(os);
}