refactor: remove QBE backend, improve bootstrap compiler and stdlib
Bootstrap compiler improvements: - Extract findStdlibDir() to remove hardcoded path and deduplicate - Extract prepareProject()/mergeProject() to share code between cmdCheck/cmdBuild - Fix C backend to emit warning on unknown types instead of silent 'int' - Clean up all unused imports across 7 modules - Makefile: add strip, debug target, clean-all, selfhost strip QBE removal: - Remove vendor/qbe/ (74K lines) - Remove compiler/selfhost/qbe_backend.bux, nim_backend.bux Stdlib improvements: - Add Result.bux + Option.bux modules - Fix Json.bux memory leak (removed double String_Copy) - Add missing imports in Crypto.bux (Alloc/Free) and Test.bux (PrintLine/PrintInt) - Clean stale buxc_debug binary
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import std/[strformat, strutils, tables]
|
||||
import hir, types, token, source_location
|
||||
import std/[strformat, strutils]
|
||||
import hir, types, token
|
||||
|
||||
type
|
||||
CBackend* = object
|
||||
@@ -107,7 +107,12 @@ proc typeToC*(be: var CBackend, typ: Type): string =
|
||||
else: return typ.name
|
||||
of tkTuple: return "void*" # TODO: proper tuple struct
|
||||
of tkFunc: return "void*" # TODO: function pointer
|
||||
else: return "int"
|
||||
else:
|
||||
when defined(release):
|
||||
return "void*"
|
||||
else:
|
||||
stderr.writeLine("warning: C backend: unknown type kind " & $typ.kind & ", using void*")
|
||||
return "void*"
|
||||
|
||||
proc operatorToC(op: TokenKind): string =
|
||||
case op
|
||||
|
||||
Reference in New Issue
Block a user