mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2025-12-17 20:38:44 +00:00
partition fixes, main file fix
This commit is contained in:
parent
a97a6125de
commit
93ac5f8e33
8 changed files with 33 additions and 18 deletions
20
src/main.cpp
20
src/main.cpp
|
|
@ -37,7 +37,7 @@ int main(int argc, char** argv) { // TODO, only test version
|
|||
parser::ParseTree parse_tree(source);
|
||||
|
||||
if (!parse_tree.IsProperlyParsed()) {
|
||||
error_handling::HandleParsingError("There are some parsing errors in file.", {0, 0}, {0, 0});
|
||||
error_handling::HandleParsingError("There are some parsing errors in file", {0, 0}, {0, 0});
|
||||
}
|
||||
|
||||
std::unique_ptr<interpreter::tokens::SourceFile> source_file =
|
||||
|
|
@ -53,10 +53,6 @@ int main(int argc, char** argv) { // TODO, only test version
|
|||
interpreter::LinkSymbolsVisitor link_symbols_visitor(global_info);
|
||||
interpreter::TypeCheckVisitor type_check_visitor(global_info, type_context_manager);
|
||||
interpreter::TypedPrintVisitor typed_print_visitor(std::cout, type_context_manager);
|
||||
interpreter::ExecuteVisitor execute_visitor(global_info,
|
||||
type_context_manager,
|
||||
context_manager,
|
||||
nullptr); // TODO
|
||||
|
||||
build_visitor.VisitSourceFile(source_file.get());
|
||||
|
||||
|
|
@ -67,6 +63,20 @@ int main(int argc, char** argv) { // TODO, only test version
|
|||
link_symbols_visitor.VisitSourceFile(source_file.get());
|
||||
type_check_visitor.VisitSourceFile(source_file.get());
|
||||
|
||||
std::optional<utils::IdType> maybe_main_partition_id = global_info.FindPartition({"main"});
|
||||
|
||||
if (!maybe_main_partition_id.has_value()) {
|
||||
error_handling::HandleGeneralError("No main partition found");
|
||||
}
|
||||
|
||||
const info::GlobalInfo::PartitionInfo& main_partition =
|
||||
global_info.GetPartitionInfo(maybe_main_partition_id.value());
|
||||
|
||||
interpreter::ExecuteVisitor execute_visitor(global_info,
|
||||
type_context_manager,
|
||||
context_manager,
|
||||
main_partition.node);
|
||||
|
||||
std::cout << "\n---------------------------------- Typed -------------------------------------\n\n";
|
||||
typed_print_visitor.VisitSourceFile(source_file.get());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue