This commit is contained in:
agra
2026-02-26 02:25:02 +02:00
parent 7209e8e69d
commit dd14f1206b
23 changed files with 5433 additions and 9 deletions

View File

@@ -6,6 +6,7 @@ const sema = @import("sema.zig");
const codegen = @import("codegen.zig");
const errors = @import("errors.zig");
const c_import = @import("c_import.zig");
const ir = @import("ir/ir.zig");
const Node = ast.Node;
pub const TargetConfig = codegen.TargetConfig;
@@ -112,6 +113,15 @@ pub const Compilation = struct {
return c_import.collectCImportSources(self.allocator, root);
}
/// Lower the parsed AST to the sx IR module (shadow pipeline).
pub fn lowerToIR(self: *Compilation) ir.Module {
const root = self.resolved_root orelse self.root orelse return ir.Module.init(self.allocator);
var module = ir.Module.init(self.allocator);
var lowering = ir.Lowering.init(&module);
lowering.lowerRoot(root);
return module;
}
pub fn renderErrors(self: *const Compilation) void {
self.diagnostics.renderDebug();
}