Run tests and check expectations in 2 loops
This commit is contained in:
23
cli/cl.cpp
23
cli/cl.cpp
@ -2,6 +2,7 @@
|
||||
#include "elna/backend/target.hpp"
|
||||
#include "elna/source/semantic.hpp"
|
||||
#include "elna/source/optimizer.hpp"
|
||||
#include "elna/source/types.hpp"
|
||||
#include <iostream>
|
||||
|
||||
namespace elna::cli
|
||||
@ -13,6 +14,26 @@ namespace elna::cli
|
||||
<< ": " << compile_error->what() << std::endl;
|
||||
}
|
||||
|
||||
static std::shared_ptr<source::symbol_table> add_builtin_symbols()
|
||||
{
|
||||
source::symbol_table result;
|
||||
|
||||
auto boolean_info = std::make_shared<source::type_info>(source::boolean_type);
|
||||
auto int_info = std::make_shared<source::type_info>(source::int_type);
|
||||
result.enter("Boolean", boolean_info);
|
||||
result.enter("Int", int_info);
|
||||
|
||||
auto writei = std::make_shared<source::intrinsic_info>();
|
||||
writei->parameter_infos.emplace_back(int_info->type());
|
||||
result.enter("writei", writei);
|
||||
|
||||
auto writeb = std::make_shared<source::intrinsic_info>();
|
||||
writeb->parameter_infos.emplace_back(boolean_info->type());
|
||||
result.enter("writeb", writeb);
|
||||
|
||||
return std::make_shared<source::symbol_table>(std::move(result));
|
||||
}
|
||||
|
||||
int compile(const std::filesystem::path& in_file, const std::filesystem::path& out_file)
|
||||
{
|
||||
try
|
||||
@ -31,7 +52,7 @@ namespace elna::cli
|
||||
print_errors(parser.errors().cbegin(), parser.errors().cend());
|
||||
return 2;
|
||||
}
|
||||
auto global_scope = std::make_shared<source::symbol_table>();
|
||||
auto global_scope = add_builtin_symbols();
|
||||
source::name_analysis_visitor(global_scope).visit(ast.get());
|
||||
source::type_analysis_visitor().visit(ast.get());
|
||||
source::allocator_visitor(global_scope).visit(ast.get());
|
||||
|
Reference in New Issue
Block a user