37# include <gtest/gtest.h>
54 "let value = add(1, 2);\n");
59 const auto *
module = parser.parse_module();
68 const auto * hir =
lowering.lower_module(module);
74 " Function(add): fn(Int, Int) -> Int\n"
75 " Params: x: Int, y: Int\n"
79 " Binary(Plus): Int\n"
87 " Variable(add): fn(Int, Int) -> Int\n"
89 " Constant(Integer, 1): Int\n"
90 " Constant(Integer, 2): Int\n");
100 " if ((flag)) { return 1; }\n"
107 const auto *
module = parser.parse_module();
116 const auto * hir =
lowering.lower_module(module);
117 const auto * function = hir->functions.access(0);
143 const auto *
module = parser.parse_module();
152 const auto * hir =
lowering.lower_module(module);
153 const auto * function = hir->functions.access(0);
166 EXPECT_EQ(body->statements.access(0)->kind, Compiler_HIR_Stmt_Kind::Eval);
167 EXPECT_EQ(body->statements.access(1)->kind, Compiler_HIR_Stmt_Kind::Continue);
Lowering from the current MVP typed AST into the reusable HIR model.
Recursive-descent parser for the compiler-support MVP grammar.
Arena-backed ownership context for AST nodes.
Arena-backed ownership context for HIR nodes.
Lowers the MVP typed AST into HIR.
Recursive-descent parser that produces an AST in Compiler_Ast_Context.
std::string to_string(const Compiler_Type_Id id) const
Renders one type to a deterministic human-readable string.
Inference-oriented semantic pass for the MVP compiler front-end.
void analyze_module(const Compiler_Module *module)
Runs the typed semantic analysis for module.
const Compiler_Type_Context & type_context() const noexcept
Returns the internal type context.
Diagnostic accumulator and renderer.
bool has_errors() const noexcept
Returns whether any error or fatal diagnostic was emitted.
Stores source files and resolves offsets into human-readable data.
Source_File_Id add_virtual_file(const std::string &name, const std::string &text)
Registers an in-memory source file.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
Main namespace for Aleph-w library functions.
std::string compiler_dump_hir_module(const Compiler_HIR_Module *module, const Compiler_Type_Context &types)
Dumps one HIR module in a deterministic text format.
Structured block statement.
Structured conditional statement.
Structured while-loop statement.