Commit Graph

1890 Commits

Author SHA1 Message Date
83dbb5958a tcl: Phase 4 env-as-value — current-env/eval-in-env/env-lookup/env-extend (+5 tests, 342/342 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 53s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 19:13:28 +00:00
d21cde336a tcl: Phase 3 OCaml primitives — file-read/write/append/exists?/glob + clock-seconds/milliseconds/format in sx_primitives.ml + unix dep; tcl-cmd-clock/file wired up; 337/337 green
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 50s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 18:10:22 +00:00
f0f339709e tcl: replace eager coroutine pre-execution with true suspension via fibers
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 45s
Rewrote the coroutine implementation to use lib/fiber.sx (make-fiber,
fiber-resume, fiber-done?) instead of eagerly running the proc body and
collecting all yields into a list. Each coroutine is now a live fiber —
calls to the coro command invoke fiber-resume, yield suspends via call/cc.

- make-tcl-interp: remove :coroutines/:in-coro/:coro-yields, add :coro-yield-fn nil
- tcl-cmd-yield: calls :coro-yield-fn (fiber's yield fn) to truly suspend
- tcl-cmd-yieldto: same pattern, yields "" to resumer
- make-coro-cmd: takes fiber (not coro-name), calls fiber-resume on each invoke
- tcl-cmd-coroutine: creates a fiber whose body runs the proc with :coro-yield-fn set
- tcl-call-proc result merge: drop :coro-yields/:coroutines propagation
- test.sh: load lib/fiber.sx before lib/tcl/runtime.sx in epoch 4

All 337/337 tests pass including all 20 coro tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 17:30:47 +00:00
0596376199 tcl: Phase 2 fiber.sx — make-fiber/fiber-resume/fiber-done? via call/cc
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 36s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 16:58:18 +00:00
35511db15b tcl: array get/set/names/size/exists/unset commands (+8 tests, 337 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 45s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 16:29:28 +00:00
40ce4df6b1 tcl: apply command — anonymous proc call reusing tcl-call-proc frame machinery
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 44s
2026-05-06 15:37:26 +00:00
0cc36450c4 tcl: regexp + regsub commands wrapping SX regex primitives
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 43s
regexp: -nocase/-all/-inline flags, optional matchVar + subgroup var args.
regsub: -all/-nocase flags, optional varName (stores result + returns count)
or inline use (returns result string). Both wrap make-regexp/regexp-match/
regexp-match-all/regexp-replace/regexp-replace-all. 329/329 tests green.
2026-05-06 15:31:36 +00:00
21e8e51174 tcl: float expr — tcl-parse-num + float-aware binop/unary/pow/funcs
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 16s
parse-int "2.0" returns nil in SX (strict integer parse); fixed by adding
tcl-num-float? (char scan for ./e/E) and tcl-parse-num (routes to
parse-float when float-shaped). Applied in tcl-apply-binop (all arith +
comparisons), tcl-apply-func (parse-float for all math args), unary minus,
and tcl-expr-parse-power (**). Real sqrt/floor/ceil/round/pow/sin/cos/tan/
exp/log now used instead of integer stubs. Integer division still truncates
when both operands are integer-shaped. 329/329 tests green.
2026-05-06 15:20:10 +00:00
bc45b7abf5 tcl: tick Phase 6 checkboxes, update progress log
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 33s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 11:06:05 +00:00
2c61be39de tcl: Phase 6 coroutines + clock/file stubs + idiom corpus (+40 tests, 329 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
- Coroutines (generator-style): coroutine/yield/yieldto commands; eager yield
  collection during body execution, pop-on-call dispatch via registered command
  closures; coro-yields + coroutines threaded through tcl-call-proc
- info exists varname (plus hostname/script/tclversion stubs)
- clock seconds/milliseconds/format/scan stubs
- File I/O stubs: open/close/read/eof/seek/tell/flush + file subcommands
- format command: full %-specifier parsing with flags, width, zero-pad, left-align
- Fixed dict set/unset/incr/append/update to use tcl-var-get (upvar alias aware)
- Fixed lappend and append to use tcl-var-get for reading (upvar alias aware)
- 20 coroutine tests (coro.sx) + 20 idiom corpus tests (idioms.sx)
- event-loop.tcl program: cooperative scheduler demo using coroutines
- Note: coroutines eagerly collect yields (generator-style, not true suspension)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 11:05:28 +00:00
ea064346e1 tcl: tick Phase 5 checkboxes, update progress log
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 45s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 10:21:47 +00:00
23c44cf6cf tcl: Phase 5 namespaces + ensembles (+22 tests, 289 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Implements namespace eval, current, which, exists, delete, export,
import, forget, path, and ensemble create (auto-map + -map). Procs
defined inside namespace eval are stored as fully-qualified names
(::ns::proc), resolved relative to the calling namespace at lookup
time. Proc bodies execute in their defining namespace so sibling
calls work without qualification.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 10:21:21 +00:00
5e0fcb9316 tcl: tick Phase 4 checkboxes, update progress log
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 49s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 09:59:09 +00:00
d295ab8463 tcl: Phase 4 error handling — catch/try/throw/return-code (+39 tests, 267 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Implements catch, throw, try, return -code options, and error with
errorinfo/errorcode fields. catch runs sub-script isolated, captures
result and exit code (0-4); try dispatches on/finally clauses;
throw sets code 1 with errorcode; return -code parses flag options.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 09:58:32 +00:00
afddc92c70 tcl: update progress log with conformance/classic programs entry
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 38s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 09:45:07 +00:00
95f96efb78 tcl: conformance.sh + scoreboard, annotate classic programs
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Adds lib/tcl/conformance.sh: runs .tcl programs through the epoch
protocol, compares against # expected: annotations, writes
scoreboard.json and scoreboard.md. All 3 classic programs pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 09:44:44 +00:00
95b22a648d tcl: classic programs — for-each-line, assert, with-temp-var (+3 tests, 228 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 42s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 09:34:26 +00:00
cffd3bec83 tcl: tick Phase 3 core checkboxes, update progress log
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 45s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 09:31:17 +00:00
eb5babaf99 tcl: proc + uplevel + upvar + global + variable + info (+19 tests, 225 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 48s
Phase 3 headline feature: everything falls out of SX's first-class env chain.
- make-tcl-interp extended with :frame-stack and :procs fields
- proc: user-defined commands with param binding, rest args, isolated scope
- uplevel: run script in ancestor frame with correct frame propagation
- upvar: alias local name to remote frame variable (get/set follow alias)
- global/variable: sugar for upvar #0
- info: level, vars, locals, globals, commands, procs, args, body
- tcl-call-proc propagates updated frames back to caller after proc returns
- test.sh timeout bumped to 90s for larger runtime

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 09:30:28 +00:00
a49b1a9f79 tcl: tick dict/60+ tests checkboxes, update progress log
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 38s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 09:00:39 +00:00
263d9aae68 tcl: dict commands — 13 subcommands (+24 tests, 206 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 13s
Implements tcl-cmd-dict with create/get/set/unset/exists/keys/values/
size/for/update/merge/incr/append subcommands, plus helpers
tcl-dict-to-pairs, tcl-dict-from-pairs, tcl-dict-get, tcl-dict-set-pair,
tcl-dict-unset-key. Registers "dict" in make-default-tcl-interp.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 09:00:13 +00:00
0dbf9b9f73 tcl: tick list commands checkbox, update progress log
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 44s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 08:54:47 +00:00
7b11f3d44a tcl: list commands — 12 commands (+26 tests, 182 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 08:54:24 +00:00
a26be0bfd0 tcl: tick string commands checkbox, update progress log
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 34s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 08:49:17 +00:00
9ed3e4faaf tcl: string command — 16 subcommands + 29 tests (156 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Implements tcl-cmd-string covering length, index, range, compare, match
(glob * and ?), toupper, tolower, trim/trimleft/trimright, map, repeat,
first, last, is (integer/double/alpha/alnum/digit/space/upper/lower/boolean),
and cat. All 156 tcl tests pass (parse: 67, eval: 89).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 08:48:43 +00:00
ac013c9381 tcl: expr mini-language — recursive descent parser (+20 tests, 127 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 42s
Replaces 3-token flat evaluator with full recursive descent parser:
operator precedence, parentheses, unary ops, ** power, function calls
(abs/sqrt/pow/max/min/int/double), expression tokenizer for dense syntax.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 08:43:02 +00:00
72ccaf4565 briefing: push to origin/loops/tcl after each commit
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 44s
2026-05-06 06:47:36 +00:00
c8d7fdd59a tcl: Phase 2 core commands — if/while/for/foreach/switch/break/continue/return/error/expr (+20 tests, 107 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 16s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 14:40:48 +00:00
82da16e4bb tcl: Phase 2 eval engine — tcl-eval-script + set/puts/incr/append (+20 tests, 87 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 17s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 14:02:52 +00:00
35aa998fcc tcl: tick Phase 1 parser checkboxes, update progress log
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 11s
2026-04-25 18:47:45 +00:00
6ee052593c tcl: Phase 1 parser — word-simple? + word-literal helpers (+15 tests, 67 total) 2026-04-25 18:47:34 +00:00
1a17d8d232 tcl: tick Phase 1 tokenizer, add progress log entry
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
2026-04-25 18:22:25 +00:00
666e29d5f0 tcl: Phase 1 tokenizer — Dodekalogue (52 tests green) 2026-04-25 18:22:10 +00:00
3316d402fd HS: null-safety piece 1 — eval-hs-error recognizer + helper (+18 tests unlocked)
Add recognizer for expect(await error("HS")).toBe("MSG") pattern in
generate-sx-tests.py, plus eval-hs-error SX helper in the generated
test file. All 18 runtimeErrors tests now generate real test cases
instead of SKIP stubs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 12:10:19 +00:00
fb72c4ab9c sx-loops: add common-lisp, apl, ruby, tcl (12 slots)
Plans + briefings for four new language loops, each with a delcc/JIT
showcase that the runtime already supports natively:

- common-lisp — conditions + restarts on delimited continuations
- apl — rank-polymorphic primitives + 6 operators on the JIT
- ruby — fibers as delcc, blocks/yield as escape continuations
- tcl — uplevel/upvar via first-class env chain, the Dodekalogue

Launcher scripts now spawn 12 windows (was 8).
2026-04-25 09:25:30 +00:00
e52c209c3d hs: drain plan for blockers + Bucket E + F
Tracks the path from 1277/1496 (85.4%) to 100%. Records each blocker's
fix sketch, files in scope, and order of attack. Cluster #31 spec'd in
detail for the next focused sit-down.
2026-04-25 08:54:00 +00:00
6a00df2609 smalltalk: plan + briefing + sx-loops 8th slot
Showcase: blocks with non-local return on captured method-return
continuation. ANSI-ish Smalltalk-80 subset, SUnit + Pharo Kernel-Tests
slice, 7 phases. Worktree: /root/rose-ash-loops/smalltalk on
branch loops/smalltalk.
2026-04-25 00:05:31 +00:00
30d76537d1 sx-loops: each language runs in its own git worktree
Previous version ran all 7 claude sessions in the main working tree on
branch 'architecture'. That would race on git operations and cross-
contaminate commits between languages even though their file scopes
don't overlap. Now each session runs in /root/rose-ash-loops/<lang> on
branch loops/<lang>, created from the current architecture HEAD.

sx-loops-down.sh gains --clean to remove the worktrees; loops/<lang>
branches stay unless explicitly deleted.

Also: second Enter keystroke after the /loop command, since Claude's
input box sometimes interprets the first newline as a soft break.
2026-04-24 16:50:27 +00:00
d7070ee901 Local sx-loops tmux launcher: 7 claude sessions, one per language
sx-loops-up.sh spawns a tmux session 'sx-loops' with 7 windows (lua,
prolog, forth, erlang, haskell, js, hs). Each window runs 'claude'
and then /loop against its briefing at plans/agent-briefings/<x>-loop.md.
Optional arg is the interval (e.g. 15m); omit for model-self-paced.

Each loop does ONE iteration per fire: pick the first unchecked [ ] item,
implement, test, commit, tick, log — then stop. Commits push to
origin/loops/<lang> (safe; not main).

sx-loops-down.sh sends /exit to each window and kills the session.

Attach with: tmux a -t sx-loops
2026-04-24 16:43:40 +00:00
e67852ca96 Scheduled-loop infra: lockfile guard + release + fire log
- scripts/loop-guard.sh — atomic claim with 30-min staleness overtake,
  appends NDJSON event to .loop-logs/<lang>.ndjson. Exit 0 = go ahead,
  exit 1 = another run is live, skip.
- scripts/loop-release.sh — clear lock, log release with exit status.

Intended for 7 per-language /schedule routines firing every 15 minutes.
Lock detects overlap so tight cadences are safe; stale lock (>30 min)
overtaken automatically if an agent dies mid-run.
2026-04-24 16:39:17 +00:00
99753580b4 Recover agent-loop progress: lua/prolog/forth/erlang/haskell phases 1-2
Salvaged from worktree-agent-* branches killed during sx-tree MCP outage:
- lua: tokenizer + parser + phase-2 transpile (~157 tests)
- prolog: tokenizer + parser + unification (72 tests, plan update lost to WIP)
- forth: phase-1 reader/interpreter + phase-2 colon/VARIABLE (134 tests)
- erlang: tokenizer + parser (114 tests)
- haskell: tokenizer + parse tests (43 tests)

Cherry-picked file contents only, not branch history, to avoid pulling in
unrelated ocaml-vm merge commits that were in those branches' bases.
2026-04-24 16:03:00 +00:00
e274878052 HS-plan: log cluster 29 blocked
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 15:50:22 +00:00
a3d1c37c95 HS-plan: scoreboard — cluster 29 blocked, C=4 done + 1 blocked
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 15:47:25 +00:00
2b486976a6 HS-plan: mark cluster 29 blocked
sx-tree MCP file ops broken this session (Yojson Type_error "Expected
string, got null" on every file-based call — sx_read_subtree,
sx_find_all, sx_replace_by_pattern, sx_summarise, sx_pretty_print, even
sx_load_check on existing files works but summarise fails). Can't edit
integration.sx to add before:init/after:init dispatch. Additionally 4
of the 6 tests fundamentally require stricter parser error-rejection
(add - to currently parses to (set! nil ...); on click blargh end
accepts blargh as symbol expression) — out of single-cluster budget.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 15:46:55 +00:00
6e92a5ad66 HS-plan: claim cluster 29 hyperscript:before:init events
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 15:31:52 +00:00
2cd8e57694 HS-plan: log cluster 19 (pick regex + indices) done +13
Cluster 19 was implemented in 4be90bf2 but the plan/scoreboard rows
still marked it pending. Sync the plan state: mark done, add log entry,
bump merged total 1264 → 1277.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 15:31:11 +00:00
0f67021aa3 plans: briefings + roadmaps for lua, prolog, forth, erlang, haskell
Five new guest-language plans mirroring the js-on-sx / hs-loop pattern, each
with a phased roadmap (Progress log + Blockers), a self-contained agent
briefing for respawning a long-lived loop, and a shared restore-all.sh that
snapshots state across all seven language loops.

Briefings bake in the lessons from today's stall debugging: never call
sx_build (600s watchdog), only touch lib/<lang>/** + own plan file, commit
every feature, update Progress log on each commit, route shared-file
issues to Blockers rather than fixing them.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 15:16:45 +00:00
81022784bc sx primitives: add regex-* (Re + Re.Pcre backed)
Adds regex-compile/test/exec/match-all/replace/replace-fn/split/source/flags.
Opaque dict handle {:__regex__ true :id :source :flags}; compiled Re.re
cached in a primitives-local table. Replacement supports $&, $1-$9, $$.
Flags: i (CASELESS), m (MULTILINE), s (DOTALL). g is a runtime flag handled
in replace. u (unicode) skipped for now.

Unblocks js-on-sx's regex-platform-override! hook — the JS RegExp shim can
now delegate to real regex instead of the substring stub.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 15:12:13 +00:00
4be90bf21f HS: pick regex + indices (+13 tests)
Implements cluster 19 — pick command extensions for hs-upstream-pick suite
(11/24 → 24/24, +13):

- Parser:
  - pick items/item EXPR to EXPR supports `start` and `end` keywords
  - pick match / pick matches accept `| <flag>` syntax after regex
  - pick item N without `to` still works (single-item slice)
- Runtime:
  - hs-pick-items / hs-pick-first / hs-pick-last now handle strings
    (not just lists) via slice
  - hs-pick-items resolves `start`/`end` sentinel strings and negative
    indices (len + N) at runtime
  - hs-pick-matches added (wraps regex-find-all, each match as a list)
  - hs-pick-regex-pattern handles (list pat flags) form; `i` flag
    transforms pattern to case-insensitive by replacing alpha chars with
    [aA] character classes (Re.Pcre has no inline-flag support)
- Generator:
  - extract_hs_expr now decodes JS string escape sequences (\" -> ",
    \\ -> \) instead of stripping all backslashes, then re-escapes for
    SX. Preserves regex escapes (\d, \s), CSS escapes, and lambda `\`
    syntax for String.raw template literals while still producing
    correct output for regular JS strings.

Smoke (0-195): 170/195 unchanged (no regressions).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 15:10:34 +00:00
b45a69b7a4 sx: format_number helper — defuse int_of_float overflow on huge floats
Shared formatter in sx_types.ml. Small integer-valued floats still print
as plain ints; floats outside safe-int range (|n| >= 1e16) now print as
%.17g (full precision) instead of silently wrapping to negative or 0.
Non-integer values keep %g 6-digit behavior — no existing SX tests regress.

Unblocks Number.MAX_VALUE / Math.pow(2,N) style tests in js-on-sx where
iterative float loops were collapsing to 0 at ~2^63.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 15:09:11 +00:00