7ee6a73ea4
Add standard library modules: - Std::String: strlen, strcmp, concat, copy, starts_with wrappers - Std::Map: linear-probing hash map with String keys, int values Add error handling: - Result and Option algebraic enum examples - ? try operator for automatic error propagation in HIR lowering Compiler bugfixes: - Fix sizeof() for user-defined structs (new hSizeOf HIR node) - Fix HIR type lowering for char8, bool8, int8, uint8, etc. - Fix let statement lowering for pointer types (*char8 → int* bug) - Fix PrintInt ABI mismatch (int64_t → int in io.c) - Fix Makefile test bug (_test_tmp_pkg already exists) Documentation: - Rewrite README.md with features, examples, project structure - Add docs/LanguageRef.md — complete language reference - Add docs/Stdlib.md — standard library documentation - Add docs/BuildAndTest.md — build and test guide New examples: strings, map, result_option, try_operator (13 total)
56 lines
1.5 KiB
Makefile
56 lines
1.5 KiB
Makefile
NIM := nim
|
|
SRC := src/main.nim
|
|
OUT := buxc
|
|
BUILD_DIR := build
|
|
|
|
EXAMPLES := hello fibonacci factorial structs enums methods algebraic_enums generics pattern_matching strings map result_option try_operator
|
|
|
|
.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
|