- 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)
- Iterate function body statements and call Sema_CheckStmt on each
- Add Sema_CheckBlock helper for child scope creation in if/while/for/loop blocks
- Extend Sema_CheckStmt to handle all statement kinds: skIf, skWhile, skDoWhile,
skLoop, skFor, skMatch, skBreak, skContinue, skDecl, skReturn
- Extend Sema_CheckExpr with ekAssign, ekField, ekIndex, ekBlock, ekSelf
- Fix ekCall to resolve return type from function declaration
- Fix ekBinary to handle assignment operators (tkAssign, +=, -=, etc.)
- Add Sema_CollectGlobals handling for dkUse (imports), dkConst, dkEnum variants
- Add tkColonColon path parsing in parser (Color::Red)
- Add decl field to Symbol struct for function/type resolution
- Add Sema_ZeroInitSymbol helper to avoid garbage from uninitialized struct fields
- Fix concurrency.bux missing Task_Join import
All examples now pass buxc2 check. make selfhost succeeds.
The self-hosted compiler crashed with SIGSEGV when processing files
that generated >=256 parser diagnostics (e.g. truncated source files).
The parser allocated a fixed-size diag buffer of 256 entries, but
parserExpect, parserExpectIdentOrKeyword, and parserEmitDiag wrote
into it without checking bounds. Once diagCount exceeded 256, writes
overflowed into adjacent heap objects (Decl structs), corrupting
their kind/childDecl2 fields and causing crashes during AST traversal.
This fix adds bounds checks to all three sites so excess diagnostics
are silently dropped rather than corrupting memory. The file size
threshold (7037 vs 7062 bytes) was a red herring — it determined
how many parser errors were generated before EOF.
Closes: selfhost segfault on 250+ line files
- Parser_Parse: add beforePos safeguard to skip unrecognized tokens
instead of looping forever when parserParseDecl returns null
- Lexer: increase maxTokens 4096 -> 32768; add explicit break on limit
- CLI: null-check ReadFile result before String_Eq
- Nim CLI: add -O2 to cc invocation for faster self-hosted builds
Self-hosted compiler (buxc2):
- Add async/await/spawn tokens, parsing, HIR, lowering, C emission
- Fix pointer type emission (*T -> T*) in C backend
- Fix sizeof(Type) parsing with parentheses
- Fix import ::{...} infinite loop guard
- Fix int64 emission by avoiding else-if chain workaround
- Add debug-free cli and hir_lower
Bootstrap compiler (Nim):
- Fix critical else-if lowering bug in hir_lower.nim:
when both elseIfs and else block exist, elseIfs were dropped
causing all else-if chains to collapse to if+else only
Runtime:
- Fix bux_async_await memory corruption (don't free in run)
- Add bux_remove_from_ready for safe cleanup
- Fix forward declaration and deduplicate bux_now_ms
Docs & examples:
- Update async.bux example with proper int64 params
- Update README, LanguageRef, Stdlib, PLAN for async features
- Mark Phase 7.10 bootstrap loop as completed
All 27 examples pass. buxc2 check/build work on all examples.
Parser (src_bux/parser.bux):
- Increased struct field limit from 8 to 64
- Added field4-field7 slots in struct field assignment
- Safeguard: fields beyond slot 7 are parsed but not stored (counted only)
Known issues:
- buxc2 segfaults on ast.bux (Decl struct has 30+ fields, sizeof mismatch
between Bux parser's Decl and C compiler's Decl)
- Full bootstrap requires Decl struct in ast.bux to match actual Decl layout
All 18 examples pass, all unit tests pass.
Parser (src_bux/parser.bux):
- Block stores statements as linked list (firstStmt/lastStmt/nextStmt)
- Block struct: added firstStmt, lastStmt fields
- Stmt struct: added nextStmt field
HIR Lowering (src_bux/hir_lower.bux):
- Lcx_LowerBlock: iterates statement linked list, chains HirNodes via child3
- hIf: else block stored in extraData (child3 reserved for block chaining)
C Backend (src_bux/c_backend.bux):
- hBlock: emits statements via child3 linked list with proper indentation
- hStore: combines alloca + value into single declaration (int x = value;)
- hIf: full if/else emission with proper newlines
- Function decl: proper return types and parameter types (not just "int")
- int main() wrapper: generated when Main function exists
- No duplicate return 0 when body already has return
Tested:
- buxc2 compiles hello world program → runs correctly
- buxc2 compiles multi-statement program (let, if, function calls) → runs correctly
- All 18 examples still pass, all unit tests pass