Phase 7.10: multi-file project build, module braces, else-if fix, UTF-8 lexer

Runtime (stdlib/runtime.c):
- bux_list_dir() — directory listing with extension filter
- bux_run_cc() — invoke C compiler on generated C code
- bux_mkdir_if_needed() — create build directory
- bux_dir_exists() — check if directory exists
- Removed duplicate bux_path_join

Parser (src_bux/parser.bux):
- Module parsing with braces: module X { ... }
- else-if parsing: wraps inner if in synthetic Block
- Infinite-loop safeguards in module body and struct body parsing

Lexer (src_bux/lexer.bux):
- lexPeek: mask with & 255 to handle UTF-8 signed char bytes

CLI (src_bux/cli.bux):
- Cli_BuildProject(): multi-file build from src/ directory
  - Lists .bux files, parses each, merges declarations inline
  - Runs sema + HIR + C codegen on merged module
  - Invokes C compiler to produce binary
- New extern declarations: bux_file_exists, bux_dir_exists, bux_path_join,
  bux_mkdir_if_needed, bux_run_cc, bux_list_dir
- FileExists(), DirExists() wrapper functions
- "project" command dispatch

Known issue: else-if chain not fully emitted by buxc2 C backend
(lexSkipWhitespace missing comment handling in generated C).

All 18 examples pass, all unit tests pass.
This commit is contained in:
2026-05-31 18:14:35 +03:00
parent 35b856bab4
commit 74117595d2
7 changed files with 627 additions and 8 deletions
+1 -1
View File
@@ -101,7 +101,7 @@ func lexIsAtEnd(lex: *Lexer) -> bool {
func lexPeek(lex: *Lexer, ahead: int) -> uint32 {
let i: int = lex.pos + ahead;
if i < lex.sourceLen {
return lex.source[i] as uint32;
return (lex.source[i] as uint32) & 255;
}
return 0;
}