blob: a6718515b74bd70f11c6555968ae3445124e62c3 (
plain)
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
|
#include "translation_unit.hpp"
#include <iostream>
// Translation Unit definition
TranslationUnit::TranslationUnit(Node* external_declaration)
{
push(external_declaration);
}
void TranslationUnit::print() const
{
for(auto& node : translation_unit_) {
node->print();
}
}
void TranslationUnit::printXml() const
{
std::cout << "<?xml version=\"1.0\"?>\n<Program>" << std::endl;
for(auto& node : translation_unit_) {
node->printXml();
}
std::cout << "</Program>" << std::endl;
}
VariableStackBindings TranslationUnit::printAsm(VariableStackBindings bindings) const
{
for(auto& node : translation_unit_) {
node->printAsm(bindings);
}
return bindings;
}
void TranslationUnit::push(Node* external_declaration)
{
NodePtr node_ptr(external_declaration);
translation_unit_.push_back(node_ptr);
}
|