8e255b2125
Phase 8.2 — Gradual Ownership: - Add tkRef/tkMutRef types and `mut` keyword - Add @[Checked] attribute for opt-in borrow checking - Reject assignment through &T in checked functions - examples/ownership.bux Phase 8.4 — CTFE: - Evaluate const func at compile-time via evalExpr/evalBlock - Fold const declarations to literals; emit #define in C - examples/ctfe.bux (Factorial(10) → 3628800) Phase 8.5 — Trait Bounds: - Change declFuncTypeParams from seq[string] to seq[TypeParam] (name + bound) - Parser handles <T: Comparable> - Sema checks typeImplements at call sites - Fix C backend: generic receivers + pointer self field access - examples/trait_bounds.bux Phase 9.1 — Package Manager: - Inline tables/arrays in TOML parser - bux add, bux install, bux.lock generation - Dependency resolution with git/path sources - Build pipeline merges dependency .bux sources C Backend Fixes: - resolveExprType(ekIdent) now applies typeSubst for generic params - Method desugaring works for monomorphized generic receivers - Pointer checks use isPointer (covers tkRef/tkMutRef) - Field access on &T emits -> instead of . Remove accidentally committed test binaries from tracking
65 lines
1.9 KiB
Makefile
65 lines
1.9 KiB
Makefile
NIM := nim
|
|
SRC := src/main.nim
|
|
OUT := buxc
|
|
BUILD_DIR := build
|
|
|
|
EXAMPLES := hello fibonacci factorial structs enums methods algebraic_enums generics generics_struct generic_infer generic_infer2 extend_generic pattern_matching strings strings2 map result_option try_operator ownership ctfe
|
|
|
|
.PHONY: all build dev test clean test-examples
|
|
|
|
all: build
|
|
|
|
build:
|
|
$(NIM) c -o:$(OUT) -d:release $(SRC)
|
|
|
|
dev:
|
|
$(NIM) c -o:$(OUT) $(SRC)
|
|
|
|
test: build test-examples
|
|
@echo "Running lexer tests..."
|
|
$(NIM) c -r tests/lexer_test.nim
|
|
@echo "Running parser tests..."
|
|
$(NIM) c -r tests/parser_test.nim
|
|
@echo "Running sema tests..."
|
|
$(NIM) c -r tests/sema_test.nim
|
|
@echo "Running HIR tests..."
|
|
$(NIM) c -r tests/hir_test.nim
|
|
@echo "Running integration tests..."
|
|
rm -rf _test_tmp_pkg
|
|
./$(OUT) new _test_tmp_pkg
|
|
./$(OUT) --version
|
|
|
|
test-examples: build
|
|
@for ex in $(EXAMPLES); do \
|
|
echo "=== Testing example: $$ex ==="; \
|
|
mkdir -p examples_pkg/$$ex/src; \
|
|
cp examples/$$ex.bux examples_pkg/$$ex/src/Main.bux; \
|
|
if [ ! -f examples_pkg/$$ex/bux.toml ]; then \
|
|
echo '[Package]' > examples_pkg/$$ex/bux.toml; \
|
|
echo 'Name = "'$$ex'"' >> examples_pkg/$$ex/bux.toml; \
|
|
echo 'Version = "0.1.0"' >> examples_pkg/$$ex/bux.toml; \
|
|
echo 'Type = "bin"' >> examples_pkg/$$ex/bux.toml; \
|
|
echo '' >> examples_pkg/$$ex/bux.toml; \
|
|
echo '[Build]' >> examples_pkg/$$ex/bux.toml; \
|
|
echo 'Output = "Bin"' >> examples_pkg/$$ex/bux.toml; \
|
|
fi; \
|
|
(cd examples_pkg/$$ex && timeout 10 ../../$(OUT) run) || exit 1; \
|
|
done
|
|
@echo "All examples passed!"
|
|
|
|
clean:
|
|
rm -f $(OUT)
|
|
rm -rf $(BUILD_DIR)
|
|
rm -rf nimcache
|
|
rm -rf examples_pkg
|
|
rm -rf _test_tmp_pkg
|
|
|
|
selfhost: build
|
|
@echo "=== Phase 7.9: Building self-hosted compiler ==="
|
|
@rm -rf _selfhost/src
|
|
@mkdir -p _selfhost/src
|
|
@cp src_bux/*.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 ==="
|