Add lexer and parser sources

This commit is contained in:
2025-06-14 23:57:48 +02:00
parent d5e2d53e9b
commit f524311f06
25 changed files with 3475 additions and 427 deletions

View File

@ -84,19 +84,21 @@ static void elna_parse_file(const char *filename)
{
for (const std::unique_ptr<elna::boot::program>& module_tree : outcome.modules)
{
std::unordered_map<std::string, tree> unresolved;
elna::boot::declaration_visitor declaration_visitor(filename, info_table);
auto semantic_errors = elna::gcc::do_semantic_analysis(filename, module_tree,
info_table, symbol_table, unresolved);
declaration_visitor.visit(module_tree.get());
if (semantic_errors.empty())
if (declaration_visitor.errors().empty())
{
std::unordered_map<std::string, tree> unresolved = elna::gcc::do_semantic_analysis(
info_table, symbol_table);
elna::gcc::generic_visitor generic_visitor{ symbol_table, std::move(unresolved) };
generic_visitor.visit(module_tree.get());
}
else
{
elna::gcc::report_errors(semantic_errors);
elna::gcc::report_errors(declaration_visitor.errors());
}
}
}