dimgigov
5ec755743d
feat: Phase 8.3 true non-blocking async/await with stackful coroutines
...
- C runtime: ucontext-based coroutines (bux_async_spawn/yield/await/run)
- Round-robin scheduler in bux_async_run() manages ready queue
- spawn Func() without args → bux_async_spawn() creates coroutine
- await → blocks/yields until coroutine completes
- async func → emitted as regular C function, runs on dedicated stack
- Interleaved execution: multiple coroutines yield cooperatively
- Example: examples/async.bux demonstrates WorkA/WorkB interleaving
- All 20 examples pass, selfhost build works
2026-06-01 01:06:46 +03:00
dimgigov
ac8b25935f
feat: Phase 8.3 Concurrency — tasks, channels, spawn
...
- Add async/await/spawn keywords to lexer
- C runtime: pthread wrappers (bux_task_spawn, bux_task_join, bux_task_sleep)
- C runtime: mutex/condvar channel implementation (bux_channel_new/send/recv/close/free)
- Build command adds -pthread flag for C compilation
- Std::Task module: TaskHandle, Task_Spawn, Task_Join, Task_Sleep
- Std::Channel module: generic Channel<T> with Send, Recv, Close, Free
- Parser: spawn Expr() expression
- Sema: ekSpawn returns *void
- HIR: hSpawn node lowered from ekSpawn
- C backend: emit bux_task_spawn(FuncName, arg) for spawn expressions
- Example: examples/concurrency.bux (thread + channel demo)
- Example: examples_pkg/concurrency working project
2026-06-01 00:04:48 +03:00
dimgigov
e251200a2f
fix: null-safe bux_strcmp/bux_strncmp/bux_strcpy, init alloca typeName — project build no longer crashes
2026-05-31 20:49:54 +03:00
dimgigov
74117595d2
Phase 7.10: multi-file project build, module braces, else-if fix, UTF-8 lexer
...
Runtime (stdlib/runtime.c):
- bux_list_dir() — directory listing with extension filter
- bux_run_cc() — invoke C compiler on generated C code
- bux_mkdir_if_needed() — create build directory
- bux_dir_exists() — check if directory exists
- Removed duplicate bux_path_join
Parser (src_bux/parser.bux):
- Module parsing with braces: module X { ... }
- else-if parsing: wraps inner if in synthetic Block
- Infinite-loop safeguards in module body and struct body parsing
Lexer (src_bux/lexer.bux):
- lexPeek: mask with & 255 to handle UTF-8 signed char bytes
CLI (src_bux/cli.bux):
- Cli_BuildProject(): multi-file build from src/ directory
- Lists .bux files, parses each, merges declarations inline
- Runs sema + HIR + C codegen on merged module
- Invokes C compiler to produce binary
- New extern declarations: bux_file_exists, bux_dir_exists, bux_path_join,
bux_mkdir_if_needed, bux_run_cc, bux_list_dir
- FileExists(), DirExists() wrapper functions
- "project" command dispatch
Known issue: else-if chain not fully emitted by buxc2 C backend
(lexSkipWhitespace missing comment handling in generated C).
All 18 examples pass, all unit tests pass.
2026-05-31 18:14:35 +03:00
dimgigov
e8084b2840
Phase 7.10: command-line args + buxc2 check/build working
...
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.
2026-05-31 16:53:03 +03:00
dimgigov
42ebee9fc0
Phase 8: Std::Math module + comprehensive feature showcase demo
2026-05-31 13:51:59 +03:00
dimgigov
5c1a00cbd6
Phase 5-7: generic inference, extend Type<T>, String stdlib, Map<K,V>, self-hosting audit, docs update
2026-05-31 13:06:29 +03:00
dimgigov
7ee6a73ea4
feat: Std::String, Std::Map, Result/Option, ? operator, sizeof fix, docs
...
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)
2026-05-31 10:15:44 +03:00
dimgigov
8e74215378
feat: add HIR, C backend, and end-to-end compilation
...
- Phase 3: High-Level IR (HIR) with lowering from AST
- Method call desugaring (obj.method() → Type_method(obj))
- if/else, while, loop, break, continue lowering
- struct, enum, function lowering
- 8 HIR tests passing
- Phase 5A: C backend code generation
- Type mapping (Bux types → C11 types)
- Expression and statement emission
- Struct, enum, function generation
- C main() wrapper for Bux Main()
- Runtime shim (stdlib/runtime.c)
- bux_alloc, bux_free, bux_print, bux_panic
- BuxString, BuxSlice types
- Bounds checking, division by zero
- Build integration
- bux build: lex → parse → sema → HIR → C → cc
- bux run: build + execute
- bux clean: remove build directory
- Parser fixes
- Newline handling in struct, enum, extend, interface blocks
- self keyword as expression and parameter name
- Sema improvements
- Method resolution (extend blocks)
- Interface conformance checking
- collectGlobals made public
- All 70 tests passing (25 lexer + 16 parser + 21 sema + 8 HIR)
- End-to-end: Bux programs compile to native ELF64 binaries
2026-05-30 22:40:34 +03:00