fix: selfhost CLI run command, lexer char literal, parser test path, calloc in runtime

- Fix lexer unterminated char error test (was treating 'a as lifetime)
- Fix parser test sample.bux path for root-dir execution
- Add bux_system() to runtime.c and run command to selfhost CLI
- Switch bux_alloc from malloc to calloc for zero-init
- Fix module flattening in Cli_Check/Cli_Compile to scan full decl list
- Make test passes fully, selfhost builds successfully
This commit is contained in:
2026-06-02 00:50:16 +03:00
parent 2b911410cb
commit 975cc347d0
7 changed files with 93 additions and 12 deletions
+6 -1
View File
@@ -22,7 +22,7 @@ char* bux_argv(int index) {
/* Memory allocation */
void* bux_alloc(size_t size) {
void* ptr = malloc(size);
void* ptr = calloc(1, size);
if (ptr == NULL) {
fprintf(stderr, "bux runtime: out of memory (alloc %zu bytes)\n", size);
abort();
@@ -75,6 +75,11 @@ int bux_run_nim(const char* nim_file, const char* out_bin) {
return system(cmd);
}
int bux_system(const char* cmd) {
if (cmd == NULL) return -1;
return system(cmd);
}
int bux_strlen_c(const char* s) {
if (s == NULL) return 0;
const char* p = s;