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
|
|
@ -50,6 +50,20 @@
|
|||
"fn-file_stdout",
|
||||
"fn-file_stderr"
|
||||
],
|
||||
"collide": [
|
||||
"collide-rects",
|
||||
"collide-point_rect",
|
||||
"collide-circles",
|
||||
"collide-rect_circle"
|
||||
],
|
||||
"color": [
|
||||
"color-rgb",
|
||||
"color-rgba",
|
||||
"color-lerp",
|
||||
"color-darken",
|
||||
"color-lighten",
|
||||
"color-with_alpha"
|
||||
],
|
||||
"control": [
|
||||
"kw-if",
|
||||
"kw-while",
|
||||
|
|
@ -60,6 +74,13 @@
|
|||
"kw-state",
|
||||
"kw-become"
|
||||
],
|
||||
"ease": [
|
||||
"ease-in",
|
||||
"ease-out",
|
||||
"ease-in_out",
|
||||
"ease-back",
|
||||
"ease-bounce"
|
||||
],
|
||||
"ecs": [
|
||||
"kw-spawn",
|
||||
"kw-despawn",
|
||||
|
|
@ -95,11 +116,77 @@
|
|||
"input": [
|
||||
"input-key"
|
||||
],
|
||||
"list": [
|
||||
"list-len",
|
||||
"list-push",
|
||||
"list-clear",
|
||||
"list-first",
|
||||
"list-last",
|
||||
"list-pop",
|
||||
"list-swap",
|
||||
"list-contains",
|
||||
"list-index_of",
|
||||
"list-reverse",
|
||||
"list-insert",
|
||||
"list-remove_at",
|
||||
"list-remove",
|
||||
"list-sort"
|
||||
],
|
||||
"map": [
|
||||
"map-size",
|
||||
"map-row",
|
||||
"map-tile"
|
||||
],
|
||||
"math": [
|
||||
"math-min",
|
||||
"math-max",
|
||||
"math-abs",
|
||||
"math-clamp",
|
||||
"math-sign",
|
||||
"math-floor",
|
||||
"math-ceil",
|
||||
"math-round",
|
||||
"math-lerp",
|
||||
"math-inverse_lerp",
|
||||
"math-remap",
|
||||
"math-sqrt",
|
||||
"math-sin",
|
||||
"math-cos",
|
||||
"math-tan",
|
||||
"math-hypot",
|
||||
"math-dist",
|
||||
"math-dist2",
|
||||
"math-deg_to_rad",
|
||||
"math-rad_to_deg",
|
||||
"math-posmod",
|
||||
"math-wrap",
|
||||
"math-ping_pong",
|
||||
"math-snapped",
|
||||
"math-move_toward",
|
||||
"math-smoothstep",
|
||||
"math-atan2",
|
||||
"math-asin",
|
||||
"math-acos"
|
||||
],
|
||||
"mem": [
|
||||
"mem-bytes",
|
||||
"mem-words",
|
||||
"mem-copy",
|
||||
"mem-fill",
|
||||
"mem-peek",
|
||||
"mem-poke"
|
||||
],
|
||||
"net": [
|
||||
"net-send",
|
||||
"net-poll",
|
||||
"net-serialize",
|
||||
"net-apply",
|
||||
"net-owner",
|
||||
"net-set_owner",
|
||||
"net-is_server",
|
||||
"net-is_owner",
|
||||
"net-local_id"
|
||||
],
|
||||
"networking": [
|
||||
"fn-net_send",
|
||||
"fn-net_poll",
|
||||
|
|
@ -134,7 +221,14 @@
|
|||
"random": [
|
||||
"random-range",
|
||||
"random-chance",
|
||||
"random-seed"
|
||||
"random-seed",
|
||||
"random-value",
|
||||
"random-int",
|
||||
"random-sign"
|
||||
],
|
||||
"save": [
|
||||
"save-write",
|
||||
"save-read"
|
||||
],
|
||||
"scenes": [
|
||||
"kw-scene",
|
||||
|
|
@ -154,7 +248,14 @@
|
|||
"screen-show",
|
||||
"screen-width",
|
||||
"screen-height",
|
||||
"screen-status"
|
||||
"screen-status",
|
||||
"screen-line",
|
||||
"screen-circle",
|
||||
"screen-fill_circle",
|
||||
"screen-triangle",
|
||||
"screen-fill_triangle",
|
||||
"screen-sprite",
|
||||
"screen-sprite_scaled"
|
||||
],
|
||||
"structure": [
|
||||
"kw-program",
|
||||
|
|
@ -172,6 +273,50 @@
|
|||
"kw-ui",
|
||||
"kw-enum"
|
||||
],
|
||||
"sys": [
|
||||
"sys-arg",
|
||||
"sys-arg_count",
|
||||
"sys-exit",
|
||||
"sys-run",
|
||||
"sys-env",
|
||||
"sys-read_char",
|
||||
"sys-file_open",
|
||||
"sys-file_read",
|
||||
"sys-file_write",
|
||||
"sys-file_seek",
|
||||
"sys-file_tell",
|
||||
"sys-file_close",
|
||||
"sys-stdout",
|
||||
"sys-stderr"
|
||||
],
|
||||
"text": [
|
||||
"text-length",
|
||||
"text-char_at",
|
||||
"text-slice",
|
||||
"text-starts_with",
|
||||
"text-ends_with",
|
||||
"text-contains",
|
||||
"text-index_of",
|
||||
"text-equals",
|
||||
"text-concat",
|
||||
"text-to_int",
|
||||
"text-from_int",
|
||||
"text-upper",
|
||||
"text-lower",
|
||||
"text-trim",
|
||||
"text-repeat",
|
||||
"text-pad_left",
|
||||
"text-pad_right",
|
||||
"text-split",
|
||||
"text-join",
|
||||
"text-replace"
|
||||
],
|
||||
"time": [
|
||||
"time-frame",
|
||||
"time-delta",
|
||||
"time-elapsed",
|
||||
"time-now"
|
||||
],
|
||||
"types": [
|
||||
"type-bool",
|
||||
"type-byte",
|
||||
|
|
@ -185,5 +330,23 @@
|
|||
"type-str",
|
||||
"type-void",
|
||||
"type-words"
|
||||
],
|
||||
"world": [
|
||||
"world-get",
|
||||
"world-set",
|
||||
"world-has",
|
||||
"world-count",
|
||||
"world-size",
|
||||
"world-spawn",
|
||||
"world-save",
|
||||
"world-load",
|
||||
"world-prop_id",
|
||||
"world-field_id",
|
||||
"world-model_id",
|
||||
"world-kind",
|
||||
"world-register_prop",
|
||||
"world-attach",
|
||||
"world-detach",
|
||||
"world-query_next"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue