feat(stdlib): namespaced standard library (issue #2)
Implement the bulk of the namespaced-stdlib proposal (workshopsoft/ludic#2): 156 namespace methods across Math, Text, List, Ease, Collide, World, Net, Sys, Save, Mem, extended Screen, Color functions, extended Random, and Time. All deterministic fixed-point; self-hosting (C-free bootstrap fixpoint holds). Compiler (selfhost/): - Math.*: sqrt/sin/cos/tan/atan2/asin/acos (fixed-point runtime prelude — bit-by-bit isqrt, 256-entry interpolated sine table, Ross atan2), plus hypot/dist/dist2/deg_to_rad/rad_to_deg/posmod/wrap/ping_pong/snapped/ move_toward/smoothstep/lerp/remap/sign/floor/ceil/round. - Text.* (complete): upper/lower/trim/repeat/pad, split/join/replace, and the libc-backed queries. - List.* (complete): insert/remove_at/remove/sort plus the earlier ops. - Ease.* (in/out/in_out/back/bounce) and Collide.* (rects/point_rect/ circles/rect_circle). - Phase 3: World/Net/Sys/Save namespaced over the bare builtins (byte- identical IR) and Mem.* (bytes/words/copy/fill/peek/poke). - Screen.* extended (line/circle/fill_circle/triangle/fill_triangle via new runtime primitives; sprite/sprite_scaled aliases), Color.* functions, Random.* (value/int/sign), Time.* (frame/delta/elapsed/now — new game-loop frame counter). - Fix a lexer bug: fixed-point literals with >4 fractional digits overflowed. Docs & tooling: - 129 new per-symbol doc pages; gen.py made data-driven (namespaces discovered from the docs, no hardcoded list); new check-impl.py enforces that every implemented namespace method / keyword / type / phase has a doc page, wired into `x test-tools`. Document the previously-undocumented keywords (break/continue/where/entry/new/public + and/or/not tokens). - LSP: namespaced signature help (ns_method_sig) covering every namespace. Tests: 12 new self-host/regression tests + a golden render for the drawing primitives. All suites green (selfhost 21, regression 45, tools 29). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
ff15c4e01d
commit
a38195128f
235 changed files with 24676 additions and 7762 deletions
|
|
@ -3,7 +3,7 @@
|
|||
> **Status: S0 shipped; S1–S6 are design.** The base construct — `scene` /
|
||||
> `layer` / `on enter` / `on exit` / `become`, lowered to the implicit machine of
|
||||
> §3 and §9 — is implemented and tested ([`examples/scenes.ludic`](examples/scenes.ludic),
|
||||
> a `test.sh` check). The extensions in §4–§8 (scene-owned entities, richer
|
||||
> a `bin/x test` check). The extensions in §4–§8 (scene-owned entities, richer
|
||||
> layers, the overlay stack, scene-local state, transition parameters) are still
|
||||
> design targets. This document reaches deliberately past the thin sketch so we
|
||||
> can decide the shape before building each one. §11 lists the open decisions.
|
||||
|
|
@ -310,7 +310,7 @@ Each is independently shippable and testable, matching how the repo phases work.
|
|||
exit`/`become` lowered to the implicit `machine`; the active scene is
|
||||
snapshotted per phase so exactly one scene's layers dispatch in any phase.
|
||||
[`examples/scenes.ludic`](examples/scenes.ludic) compiles, runs, and is checked
|
||||
by `test.sh`. This is the floor everything else builds on.
|
||||
by `bin/x test`. This is the floor everything else builds on.
|
||||
- **S1 — `@OnEnter`/`@OnExit` annotation form** (E5, cheap once S0 exists).
|
||||
- **S2 — layer toggle & pause** (E2) on top of the existing `enable`/`disable`.
|
||||
✅ *Toggle shipped* (via EVENTS-DESIGN EV1 layers): `enable layer L` / `disable
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue