feat: LIR backend replaces direct HIR→C emission (v0.3.0)

- 42 LIR instructions in bootstrap/lir.nim

- HIR→LIR lowering in bootstrap/lir_lower.nim

- LIR→C emission with full struct/enum/vtable support

- All 22 examples + 5 Nim unit tests passing

- Updated README status and backend description
This commit is contained in:
2026-06-06 18:55:59 +03:00
parent aff03ffb5a
commit 62a9c8b84a
6 changed files with 1507 additions and 5 deletions
+4 -3
View File
@@ -1,5 +1,5 @@
import std/[os, strutils, terminal, strformat, osproc, sets]
import lexer, parser, ast, sema, manifest, hir_lower, c_backend
import lexer, parser, ast, sema, manifest, hir_lower, lir, lir_lower, lir_c_backend
type
ColorMode* = enum
@@ -454,8 +454,9 @@ proc cmdBuild*(args: seq[string], opts: GlobalOptions): int =
return 1
let hirMod = lowerModule(unifiedModule, semaCtx)
var cbe = initCBackend()
var allCCode = cbe.emitModule(hirMod)
let lirBuilder = lowerModuleToLir(hirMod)
var lirCbe = initLirCBackend()
var allCCode = lirCbe.emitModule(lirBuilder, hirMod)
# Write C file
let cFile = buildDir / "main.c"