Commit Graph

257 Commits

Author SHA1 Message Date
dimgigov 26631252c0 feat(lsp): hover signatures, go-to-def, document outline
Upgrade bux-lsp to 0.2.0 with a richer lightweight symbol index:
func signatures, typed let/var/const, struct/enum/interface/type/module.
Skip comments and strings while scanning. Hover shows markdown Bux
code fences; definition resolves in-file and across workspace .bux files;
documentSymbol provides outline. Fix responses writing to stdout (stdin
was a broken pipe). didChange refreshes symbols; diagnostics still run
via buxc on open/save.
2026-07-18 01:01:22 +03:00
dimgigov db41ba4d84 feat: pattern bindings, empty closures, match-as-expr, string interp
Sessions 10–12 from QUALITY_PLAN:

- Pattern payload bindings (Some(value) => value) in bootstrap and selfhost
- Empty-param closures via || (tkPipePipe) with loop/return bodies
- Expression-form match: let x = match …; newline before arms
- f"…" string interpolation desugared to String_Concat + conversions
- Lexer preserves \{ \} for literal braces in f-strings
- Bootstrap fix: f"plain" strips the f prefix after escape processing
- Examples: pattern_matching, closure_control, match_let, string_interp

Selfhost-loop remains binary-identical; all examples and error goldens pass.
2026-07-18 00:58:44 +03:00
dimgigov f619316470 feat: full match expressions in bootstrap and selfhost
Lower match to if-else for literals, ranges, enum tags, and wildcards.
Fix bootstrap literal arms that always matched; port real arm AST/parser
and Lcx_LowerMatch to selfhost with last-expression return. Expand
pattern_matching example and add parse/use-after-move/double-mut golden
diagnostics. Selfhost-loop remains binary-identical.
2026-07-16 16:19:43 +03:00
dimgigov 2cbbccc508 docs: complete QUALITY_PLAN session log and next-day backlog
Record Iter HOF session and proposed follow-ups for the next work day.
2026-07-15 16:17:04 +03:00
dimgigov e805af6ef6 docs: sync README and plans with v0.5.x features
Document multi-instance closures, tuples, Iter HOF, diagnostics, and
updated test targets. Refresh QUALITY_PLAN diagnosis and next-day backlog.
2026-07-15 16:16:54 +03:00
dimgigov f1896183f5 feat(stdlib): Iter map/filter/fold with closures
Add int-specialized higher-order Iter helpers that accept fat function
pointers, plus an example using named funcs and capturing closures.
Fix selfhost C backend pointer field access and Array Push indexing.
2026-07-15 16:07:47 +03:00
dimgigov 9efba57b4c feat(selfhost): full tuple type support with .0/.1 field access
Parse (T, U) types and (a, b) expressions, lower to Tuple_* C structs,
and emit common tuple typedefs so buxc2 matches bootstrap tuple codegen.
2026-07-15 16:04:01 +03:00
dimgigov 61ac06ab5f feat: multi-instance closures, richer stdlib, and Rust-style diagnostics
Introduce fat function pointers (BuxFn {code, env}) so capturing closures
are heap-allocated per value in both bootstrap and selfhost. Expand
Array/Map/Set/String/Test/Result APIs, add proper tuple codegen and
error snippets with multi-char underlines, golden diagnostic tests, and
LSP diagnostics via buxc check.
2026-07-15 16:00:21 +03:00
dimgigov 94e6806dda fix(compiler): allow integer coercion in range bounds; use for loops in boko-framework
- sema: range bounds now accept compatible integer types (e.g. int..uint)
  instead of requiring exact type equality.
- hir_lower: derive loop variable type from the common range type.
- boko-framework: replace manual while loops with for loops in Query_Parse,
  Request_Parse, Path_Match and App_Run.
2026-06-17 12:08:36 +03:00
dimgigov 9c632ce389 Rewrite jwt-pitbul and boko-framework with modern Bux constructs
- jwt-pitbul: algebraic enums, Array<String>, methods on JwtAlg,
  string interpolation, structured Result/Option error handling.
- boko-framework: StringMap<String> for headers/query/path params,
  Request/Response methods, StringBuilder, for loops, algebraic enums.
- Update READMEs and bump versions to 0.2.0.
2026-06-16 10:12:52 +03:00
dimgigov aaeb01e518 feat(nexus): production modular HTTP/1.1 server + compiler fixes
- Rewrite apps/nexus with modular architecture:
  Config, Http, Errors, Parser, Router, Handlers, Server, Main
- Use algebraic enums for ParseResult/FileResult/HttpError
- Thread-pool server via Channel<ConnectionTask> and spawn
- Fix C backend type ordering for generic struct instances
  (Array_T, Iter_T) and algebraic enum struct payloads
- Collect Slice_T types from struct fields and enum payloads
- Fix match lowering for simple enums (direct value compare)
- Resolve match expression return type from first arm
- Infer element type for for-in over Array<UserStruct>
- Preserve generic type args in field access resolution
- Add fflush to PrintLine/Print for immediate server logs
- Add modern_features golden regression test
- Regenerate golden expected.c files
2026-06-15 00:54:03 +03:00
dimgigov fc0a560e60 docs(roadmap): mark concurrency done in selfhost
Green threads (lib/Task.bux) and channels (lib/Channel.bux) already work.

Verified by _test_green_threads and _test_forin_channel.
2026-06-14 17:50:40 +03:00
dimgigov e11dce56d2 docs(roadmap): mark slice bounds checking done in selfhost
Slice<T> bounds-checked indexing already works via lib/Slice.bux
2026-06-14 17:48:45 +03:00
dimgigov e5e490605a feat(selfhost): auto-drop for interface-based Drop implementations
- Extend Lcx_BuildAutoDropFree to detect TypeName_Drop methods

  registered by sema for extend Type for Drop impl blocks.

- Preserve existing @[Drop] attribute path and move semantics.

- Add design doc and implementation plan.

- Mark Destructors/Drop roadmap item done in selfhost.
2026-06-14 17:44:35 +03:00
dimgigov 2c8223f94e fix(bootstrap): avoid emitting malformed Slice_T* typedefs
- Strip pointer suffix when scanning for slice types in C backend
- Skip slice typedefs already emitted from module.structs

Fixes _test_slice
2026-06-14 17:23:58 +03:00
dimgigov 44bac83471 fix(bootstrap): implement collection for-in lowering
- Export typeToTypeExpr from sema and preserve generic type args
- Derive loop variable type from collection element type in sema
- Substitute generic struct type params on field access
- Add getCollectionElementTypeExpr helper in hir_lower
- Replace placeholder collection for-in lowering
- Add Array/Iter lowering: Array_Iter_T / Iter_HasNext_T / Iter_Next_T
- Add Channel lowering: Channel_Recv_Ok_T loop
- Register loop variable in varTypeExprs before body lowering

Fixes _test_forin_stdlib, _test_forin_channel, _test_generic_trait, _test_import, _test_mono
2026-06-14 17:17:56 +03:00
dimgigov 06db4926a7 fix(bootstrap): substitute generic type args in operator [] resolution
- Preserve type args on tkNamed in resolveType
- Resolve explicit generic call return types with concrete substitutions
- Substitute method type params when looking up operator_index_get
- Skip strict arg checks for generic function calls (deferred to inference)
- Fix generic struct monomorphization when no caller substitution map exists
- Fix parameter varTypeExprs ordering so pointer params are visible in bodies

Fixes _test_drop_trait and _test_checked_index
2026-06-14 13:15:13 +03:00
dimgigov 84df4bba9d feat: bux test runner, bitwise-not parsing, stdlib discovery hardening\n\n- Add 'bux test' runner: discovers tests/*.bux, builds each in a temp package, runs and reports PASS/FAIL.\n- Fix unary ~ parsing and C emission in self-hosted compiler.\n- Harden stdlib discovery (require Fs.bux, avoid system /lib) and lstat in directory traversal.\n- Selfhost loop passes: buxc2 builds src/ and produces identical C output + stripped binary.\n- Update PLAN.md with completed milestones. 2026-06-12 22:19:13 +03:00
dimgigov a668127721 docs: update README and PLAN for v0.5.0
- README: add @[Release], green threads, drop trait, --release flag
- README: fix Task_Join → Task_Wait, update project structure
- README: add make selfhost-loop to build instructions
- PLAN: mark selfhost loop, borrow checker, release mode as done
- PLAN: update milestones summary
2026-06-11 10:05:10 +03:00
dimgigov 9bbeb4fd1d feat(selfhost): achieve binary-identical selfhost loop
- Add -Wl,--build-id=none to C compilation flags (removes non-deterministic build ID)
- Update Makefile selfhost-loop to strip debug info before ELF comparison
- Bootstrap compiler and selfhost compiler both deterministic
2026-06-11 10:00:14 +03:00
dimgigov 0e93ea911c feat(diag): format lexer errors with Diagnostic_Print in Cli_Check and Cli_BuildProject 2026-06-11 09:51:50 +03:00
dimgigov 290cbc8f98 feat(release): add @[Release] attribute and --release CLI flag
- @[Release] disables borrow checking and bounds checking in the function
- --release passes -O3 -flto to the C compiler for optimized builds
- Selfhost loop still deterministic
2026-06-11 09:39:11 +03:00
dimgigov 224542df7f fix(examples): Task_Join -> Task_Wait to match stdlib API 2026-06-11 09:21:06 +03:00
dimgigov a619247f06 test(slice): add operator indexing test for Array and Slice 2026-06-11 01:29:09 +03:00
dimgigov a4f25bc737 feat(operator): add operator_index_get/set to Array and Slice with generic monomorphization 2026-06-11 01:28:59 +03:00
dimgigov aa2d6f9632 test(drop): verify auto-drop works without @[Checked] 2026-06-11 01:09:23 +03:00
dimgigov b549e09a3b feat(drop): remove checkedFunc gate from auto-drop 2026-06-11 01:08:57 +03:00
dimgigov 2259567ac2 docs: add Drop trait implementation plan 2026-06-11 01:08:27 +03:00
dimgigov f4f09602c6 docs: add Drop trait / destructors design document 2026-06-11 01:07:34 +03:00
dimgigov ef4aa42b0b feat: add web playground with Docker sandbox
- playground/backend/main.go — Go HTTP server with /compile endpoint
- playground/frontend/index.html — Monaco Editor with 8 code examples
- playground/sandbox/Dockerfile — isolated Docker container with buxc2
- playground/docker-compose.yml — orchestrates backend + sandbox
- playground/Makefile — build and run targets
- playground/README.md — deployment guide for VPS with nginx + SSL
2026-06-10 20:33:26 +03:00
dimgigov 8f68a9da1a docs: document --target cross-compilation flag
- Add cross-compilation to README.md features and quick start
- Add cross-compilation section to docs/BuildAndTest.md
2026-06-10 20:26:31 +03:00
dimgigov e4e4e0d8ef feat: add --target <triple> cross-compilation flag
- Parse --target flag in Cli_Run before command dispatch
- Pass targetTriple through Cli_Build, Cli_BuildProject, Cli_RunProject
- Use clang with -target when cross-compiling, cc otherwise
- Selfhost loop: C output identical
2026-06-10 20:24:46 +03:00
dimgigov 18aa232b1c docs: add cross-compilation design document 2026-06-10 20:19:17 +03:00
dimgigov c6bae8b9ee feat(diag): add parser severity filtering and source map heuristic for bux build 2026-06-10 20:15:57 +03:00
dimgigov aef0cd7936 docs: add source location error fixes design 2026-06-10 20:12:20 +03:00
dimgigov 62d92b0aa6 test: add error snippet formatting test 2026-06-10 20:08:24 +03:00
dimgigov 9a63dcca11 fix(diag): remove parser diag printing, fix String_CharAt and sourceName issues 2026-06-10 20:08:20 +03:00
dimgigov 10a2b64ac4 feat(diag): print parser diagnostics in Parser_Parse 2026-06-10 20:04:31 +03:00
dimgigov 92962fa1b0 feat(diag): format all lexer and sema errors with Diagnostic_Print 2026-06-10 20:03:56 +03:00
dimgigov b971775baf feat(diag): add Diagnostic struct and Rust-style formatter 2026-06-10 20:02:33 +03:00
dimgigov 85d15cd16d docs: add source location error messages implementation plan 2026-06-10 20:00:09 +03:00
dimgigov de3ac76581 docs: add source location error messages design document 2026-06-10 19:56:55 +03:00
dimgigov 2824d25369 test: add green thread integration test
Also fix runtime scheduler bugs:
- g_task_creating was thread-local but set on main thread and read on worker
- g_scheduler_context was global shared by all workers instead of per-thread
2026-06-10 19:48:47 +03:00
dimgigov 9cd0580832 feat(task): add full green thread API (Init, Wait, Yield, CurrentId, Shutdown) 2026-06-10 19:45:24 +03:00
dimgigov 9e547f123a fix(scheduler): make Task_Sleep yield instead of block (MVP) 2026-06-10 19:44:55 +03:00
dimgigov 211a811f32 feat(scheduler): implement green thread scheduler with work-stealing 2026-06-10 19:43:31 +03:00
dimgigov 4456bb00af docs: add green threads implementation plan 2026-06-10 19:38:24 +03:00
dimgigov 6a0a0425dd docs: add green threads / task scheduler design document 2026-06-10 19:33:53 +03:00
dimgigov 9e515c157d feat(pkg): add basic package manager (add, remove, fetch, build deps)
- manifest.bux: parse [dependencies] section with up to 8 deps
- manifest.bux: Manifest_AddDep, Manifest_RemoveDep, Manifest_ToString
- cli.bux: bux add <name> <url> — adds dependency to bux.toml
- cli.bux: bux remove <name> — removes dependency from bux.toml
- cli.bux: bux fetch — git clone/pull dependencies into deps/
- cli.bux: Cli_BuildProject now merges deps/<name>/src/*.bux before user code
- Selfhost bootstrap loop verified: C output deterministic ✓
2026-06-10 19:18:36 +03:00
dimgigov 8f8708c5df feat(drop): enforce @[Drop] attribute and add basic move semantics
- Auto-drop now only triggers for user-defined types explicitly marked
  with @[Drop] on the struct declaration.
- Added move tracking in C backend to skip auto-drop for variables
  that have been moved (via let y = x, return x, or assignment).
- Prevents double-free when ownership is transferred.
- Selfhost bootstrap loop verified: C output is deterministic.
2026-06-10 19:08:15 +03:00