Revert "improve abstraction for AssocList, fix bug in optional else (#315)" (#320)

This reverts commit bf6bb800c4.
This commit is contained in:
Dave Abrahams
2021-03-01 12:26:56 -05:00
committed by GitHub
parent 8b3bb7c5e9
commit f5300a84e5
55 changed files with 7431 additions and 293 deletions
+12 -16
View File
@@ -11,8 +11,6 @@
namespace Carbon {
bool tracing_output = false;
char* input_filename = nullptr;
void PrintSyntaxError(char* error, int line_num) {
@@ -21,27 +19,25 @@ void PrintSyntaxError(char* error, int line_num) {
}
void ExecProgram(std::list<Declaration>* fs) {
if (tracing_output) {
std::cout << "********** source program **********" << std::endl;
for (const auto& decl : *fs) {
decl.Print();
std::cout << "********** type checking **********" << std::endl;
std::cout << "********** source program **********" << std::endl;
for (const auto& decl : *fs) {
decl.Print();
}
std::cout << "********** type checking **********" << std::endl;
state = new State(); // Compile-time state.
std::pair<TypeEnv, Env> p = TopLevel(fs);
TypeEnv top = p.first;
Env ct_top = p.second;
std::pair<TypeEnv*, Env*> p = TopLevel(fs);
TypeEnv* top = p.first;
Env* ct_top = p.second;
std::list<Declaration> new_decls;
for (const auto& decl : *fs) {
new_decls.push_back(decl.TypeChecked(top, ct_top));
}
if (tracing_output) {
std::cout << std::endl;
std::cout << "********** type checking complete **********" << std::endl;
for (const auto& decl : new_decls) {
decl.Print();
}
std::cout << std::endl;
std::cout << "********** type checking complete **********" << std::endl;
for (const auto& decl : new_decls) {
decl.Print();
}
std::cout << "********** starting execution **********" << std::endl;
int result = InterpProgram(&new_decls);
std::cout << "result: " << result << std::endl;
}