Add output and fix two bugs.

This commit is contained in:
2019-08-26 21:05:44 -07:00
parent 7e40af4830
commit 2dd81cf07a
7 changed files with 116 additions and 3 deletions

View File

@@ -2,6 +2,26 @@
#include <sstream>
#include <algorithm>
void type_var::print(const type_mgr& mgr, std::ostream& to) const {
auto it = mgr.types.find(name);
if(it != mgr.types.end()) {
it->second->print(mgr, to);
} else {
to << name;
}
}
void type_base::print(const type_mgr& mgr, std::ostream& to) const {
to << name;
}
void type_arr::print(const type_mgr& mgr, std::ostream& to) const {
left->print(mgr, to);
to << " -> (";
right->print(mgr, to);
to << ")";
}
std::string type_mgr::new_type_name() {
int temp = last_id++;
std::string str = "";