fixes, new examples

This commit is contained in:
ProgramSnail 2023-05-23 11:54:15 +03:00
parent 823fa30fa8
commit 7f4266821c
15 changed files with 322 additions and 74 deletions

View file

@ -59,9 +59,17 @@ int main(int argc, char** argv) { // TODO, only test version
// std::cout << "\n---------------------------------- Untyped -------------------------------------\n\n";
// print_visitor.VisitSourceFile(source_file.get());
find_symbols_visitor.VisitSourceFile(source_file.get());
link_symbols_visitor.VisitSourceFile(source_file.get());
type_check_visitor.VisitSourceFile(source_file.get());
try {
find_symbols_visitor.VisitSourceFile(source_file.get());
} catch (...) { error_handling::HandleInternalError("find_symbols_visitor exception", "main", std::nullopt); }
try {
link_symbols_visitor.VisitSourceFile(source_file.get());
} catch (...) { error_handling::HandleInternalError("link_symbols_visitor exception", "main", std::nullopt); }
try {
type_check_visitor.VisitSourceFile(source_file.get());
} catch (...) { error_handling::HandleInternalError("type_check_visitor exception", "main", std::nullopt); }
std::optional<utils::IdType> maybe_main_partition_id = global_info.FindPartition({"main"});
@ -72,13 +80,15 @@ int main(int argc, char** argv) { // TODO, only test version
const info::GlobalInfo::PartitionInfo& main_partition =
global_info.GetPartitionInfo(maybe_main_partition_id.value());
std::cout << "\n---------------------------------- Execution -------------------------------------\n\n";
// std::cout << "\n---------------------------------- Execution -------------------------------------\n\n";
interpreter::ExecuteVisitor execute_visitor(global_info,
type_context_manager,
context_manager);
execute_visitor.ExecutePartition(main_partition.node);
try {
execute_visitor.ExecutePartition(main_partition.node);
} catch (...) { error_handling::HandleInternalError("execute_visitor exception", "main", std::nullopt); }
// std::cout << "\n---------------------------------- Typed -------------------------------------\n\n";
// typed_print_visitor.VisitSourceFile(source_file.get());