feat: restructure repo, borrow checker, expanded stdlib

- Reorganize repository to Rust-style layout:
  compiler/bootstrap/  compiler/selfhost/  compiler/tests/
  library/std/  library/runtime/  tests/  tools/
- Add buxs/ Windows-compatible project root
- Add borrow checker tests and implement:
  - Alias analysis (double mutable borrow detection)
  - Use-after-move detection for own T
- Expand standard library:
  - Std::Os: Args, Env, Cwd, Chdir
  - Std::Time: NowMs, NowUs, SleepMs
  - Std::Process: Run, Output
  - Std::Io: PrintInt64 (fixes 32-bit truncation bug)
- Add examples: os_time.bux, process.bux
- Fix PrintInt to use int64_t in C runtime
This commit is contained in:
2026-06-05 20:08:17 +03:00
parent a45a2ecd49
commit 9c6b516453
75 changed files with 581 additions and 79 deletions
+8 -6
View File
@@ -1,5 +1,5 @@
NIM := nim
SRC := src/main.nim
SRC := compiler/bootstrap/main.nim
OUT := buxc
BUILD_DIR := build
@@ -17,13 +17,15 @@ dev:
test: build test-examples
@echo "Running lexer tests..."
$(NIM) c -r tests/lexer_test.nim
$(NIM) c -r compiler/tests/lexer_test.nim
@echo "Running parser tests..."
$(NIM) c -r tests/parser_test.nim
$(NIM) c -r compiler/tests/parser_test.nim
@echo "Running sema tests..."
$(NIM) c -r tests/sema_test.nim
$(NIM) c -r compiler/tests/sema_test.nim
@echo "Running HIR tests..."
$(NIM) c -r tests/hir_test.nim
$(NIM) c -r compiler/tests/hir_test.nim
@echo "Running borrow checker tests..."
$(NIM) c -r compiler/tests/borrow_test.nim
@echo "Running integration tests..."
rm -rf _test_tmp_pkg
./$(OUT) new _test_tmp_pkg
@@ -58,7 +60,7 @@ selfhost: build
@echo "=== Phase 7.9: Building self-hosted compiler ==="
@rm -rf _selfhost/src
@mkdir -p _selfhost/src
@cp src_bux/*.bux _selfhost/src/
@cp compiler/selfhost/*.bux _selfhost/src/
@mv _selfhost/src/main.bux _selfhost/src/Main.bux 2>/dev/null || true
@cd _selfhost && ../$(OUT) build
@echo "=== Self-hosted compiler built successfully ==="