- Cli_BuildProject now appends declarations (preserving original file order)
instead of prepending (which reversed order)
- Added per-file declaration count debug output
- This makes merge order match Nim bootstrap behavior
- Makefile: new targets `test-golden` and `selfhost-loop`
- selfhost-loop verifies C codegen determinism (2-pass bootstrap)
- test-golden compares C output against expected.c golden files
- Updated clean-all to clean new build dirs
- tests/golden/hello/: first golden test (hello world)
- src/sema.bux:
- Fix: import stubs only registered if symbol doesn't already exist
- Improve: error message now includes identifier name
- ast.bux: Decl expanded with field0..field255, variant0..7, param0..8
- parser.bux: add parserParseUnary for correct unary precedence; handle tkDiscard statements; allow var without initializer (matching bootstrap); add diagCount bounds check in parserEmitDiag
- hir.bux: HirParam changed to pointers
- hir_lower.bux: full field chains for struct lowering
- c_backend.bux: hardened -> vs . field access; null checks in CBE_GetExprTypeName
- cli.bux: add -lcrypto to linker
- Fix lirValToC crash on lvkInt in hStore raw C emission
- Add hAlloca handling to lowerExpr (returns &name, avoids unhandled fallback)
- Fix nested comment syntax in unhandled expr fallback
- Rewrite buildLval to handle hIndexPtr and nested hFieldPtr/hArrowField
so assignments like arr[i].field = val emit direct C lvalues
- Make &&/|| temporaries unique (__and_tmp_N/__or_tmp_N) to avoid
duplicate declarations in the same function
- Selfhost null-deref fix in sema.bux (unchained nested conditions)
- hir_lower: add isScope=true to lowerBlock; fix resolveExprType for ekIndex,
ekField on monomorphized structs, and ekTry/ekUnwrap tmpVar typing
- lir_lower: add loop label stack for break/continue; pass null arg to
bux_task_spawn when spawn has no arguments
- lir_c_backend: multi-pass type inference for temps; include params in
varTypes; handle lvkTemp in lirLoad; use inferred type in lirAlloca
- 42 LIR instructions in bootstrap/lir.nim
- HIR→LIR lowering in bootstrap/lir_lower.nim
- LIR→C emission with full struct/enum/vtable support
- All 22 examples + 5 Nim unit tests passing
- Updated README status and backend description
The old findGenericCalls second-pass only looked in non-generic functions
and generated unresolved instances like Array_Get_T when generic funcs
called other generic funcs. Removed it entirely.
lowerExpr for ekCall now invokes generateMethodInstance directly for
both explicit (ekGenericCall) and inferred generic calls. This ensures
concrete instantiations are generated on-demand with correct typeSubst.
Also added guard in resolveTypeExpr/substituteType to skip emitting C
struct definitions for unresolved type parameters (e.g. Array<T> inside
a generic function body before monomorphization).
feat(std): add Std::Iter module
- Array_Iter, Iter_Next, Iter_HasNext, Iter_Peek, Iter_Reset
- Iter_Pos, Iter_Len, Iter_Count, Iter_Skip, Iter_Take
docs: document Std::Iter in Stdlib.md
examples: add iter.bux example
tests: add _test_array regression test
- Fix sema.nim: use objType.name instead of obj.name for algebraic enum
tag/data field types (was generating _Tag instead of EnumName_Tag)
- Fix c_backend.nim: emit enum definitions before struct definitions
to allow structs to reference algebraic enum types
- Add bux_mutex_* and bux_rwlock_* C runtime functions
- Add library/std/Sync.bux with Mutex and RwLock wrappers
- Add examples/sync.bux — threaded counter with Mutex
- Update docs/Stdlib.md with Sync section and example
- Update README.md feature table
- Initialize result to 0 in Channel_RecvInt/RecvFloat64 to handle closed channel
- Add producer/consumer channel example in examples/channel.bux
- Update README.md with Channels syntax preview
- Add isOwn field to Symbol for tracking own T declarations
- Reinitialization after move: assigning to a moved variable removes it from movedVars
- Move tracking in let/var initialization: var b: own Box = a moves a
- Move tracking in assignment: x = y moves y if y is own T
- Move tracking in return: return x moves x if x is own T
- Expand borrow_test.nim to 10 tests (all passing)
- C runtime (OpenSSL): bux_sha256, bux_hmac_sha256, bux_random_bytes,
bux_base64_encode, bux_base64_decode, bux_bytes_to_hex
- library/std/Crypto.bux: Crypto_Sha256, Crypto_HmacSha256,
Crypto_HmacSha256Raw, Crypto_RandomBytes, Crypto_Base64Encode,
Crypto_Base64Decode
- examples/jwt.bux: full JWT creation with HS256 signature
- Link with -lcrypto in C backend
- Lexer (Nim + Bux): resolve escape sequences (\n, \t, \r, etc) instead of
keeping raw source text in token. This was the root cause of \n being
double-escaped to \\n in generated C code.
- Manifest parser (src_bux/manifest.bux): use bux_strlen instead of broken
String_SplitCount(s, "") hack for string length; fix quote stripping.
- CLI (src_bux/cli.bux): --version/--help now recognized alongside version/help.
- Remove ~30+ debug Print statements from cli, parser, lexer, sema, main.
- Clean up unneeded Print/PrintInt extern declarations.
- _selfhost/src/: synced from src_bux/.
- Fix segfault from uninitialized Symbol structs in scope/hir_lower/sema
- Fix null ReadFile crash in Cli_MergeFileInto (missing stdlib files)
- Extend function params from 6 to 9 (bux_str_format needs 9 args)
- Add ExprList/HirArgList linked lists for >2 call arguments
- Add banner image to README
- Update docs: C backend is now primary (not QBE)
Major changes:
- Cli_BuildProject now uses CBackend_Generate instead of QBE SSA generation
- Replaced QBE invocation (vendor/qbe/qbe) with direct cc compilation
- Cli_Build (single-file) now compiles C output with cc including runtime.c/io.c
- Added import-based stdlib merging: only imported Std::* modules are merged,
eliminating unused generic code from Array/Map/Set/Channel in simple programs
C backend fixes:
- Fixed struct typedef redefinition: struct definitions now use 'struct Name {}'
instead of 'typedef struct {} Name' to avoid conflicting with forward typedefs
- Added enum support: HirEnum struct, enum emission in C backend, variant
constants emitted as #define Name_Value
- Added char8 typedef
- Skip generic structs/functions (T/K/V type parameters) in C emission
Sema fixes:
- Fixed Sema_IsNumeric: now correctly recognizes uint, float32, float64
- Fixed return type check: allow pointer compatibility (String <-> *T)
Tested: hello, fibonacci, factorial, enums examples build and run via buxc2