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.
- runtime: bux_async_return(value, size) copies result to task->result
- runtime: bux_async_await returns void* result pointer
- runtime: bux_async_result(handle) to retrieve result
- sema: ekAwait returns *void
- HIR: await lowered to bux_async_await returning *void
- Example: async Compute() -> int with interleaved execution and result await
Runtime:
- bux_argc()/bux_argv() — command-line arg access from Bux programs
- g_argc/g_argv globals — set by C main() wrapper
Compiler:
- C backend generates extern g_argc/g_argv + int main(argc,argv) wrapper
- main.bux reads args via bux_argc/bux_argv and passes to Cli_Run
buxc2 verified:
- buxc2 version — reads CLI args correctly
- buxc2 check <file.bux> — lexes, parses, type-checks, generates C
- buxc2 build <file.bux> <output.c> — writes C output
PLAN.md updated with Phase 7.10 status and remaining work.
All 18 examples pass, all unit tests pass.
- Rewrite Std::Array as fully generic struct Array<T> with generic methods
- Use sizeof(T) for allocation/reallocation instead of hardcoded 8
- Fix method call lowering to lookup receiver type specifically instead of
iterating all methodTable entries (prevents Array_Get matching for Box type)
- Add resolveTypeExpr typeSubst check for unknown named types
- Rename Array method parameters from 'arr' to 'self' for auto-registration
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)
- Create stdlib/Std/Io.bux with extern func declarations
- Rename C shim functions to short names (PrintLine, PrintInt, etc.)
- Update all 9 examples to use import Std::Io::{PrintLine, PrintInt};
- Remove manual extern func Std_Io_* declarations from examples
- Parse module paths in stdlib (module Std::Array { ... })
- Collect stdlib declarations and inject into user modules before sema
- Add dkExternFunc support throughout pipeline (parser, sema, hir, c backend)
- Auto-dereference pointer types for field access (arr->field)
- Add hArrowField HIR node for cleaner C emission
- Fix resolveTypeExpr for pointer and cast types
- Fix struct field lowering to use resolveTypeExpr
- Allow int <-> uint implicit conversion for bootstrap convenience
- Add stdlib/Std/Array.bux with dynamic array primitives
- Add stdlib_test demonstrating Array usage via import Std::Array::{Array};
- Add stdlib/io.c with PrintLine, Print, PrintInt, PrintFloat, PrintBool, ReadLine
- Support extern function declarations (functions without body)
- Generate C forward declarations for extern functions
- Map Bux type names (String, int, etc.) to C types in codegen
- Update build system to copy all stdlib files
- Hello World example works: prints 'Hello, Bux!'