Commit Graph

704 Commits

Author SHA1 Message Date
b99e69d1bb Add (param :as type) annotations to all fn/lambda params across SX spec
Extend the type annotation system from defcomp-only to fn/lambda params:
- Infrastructure: sf-lambda, py/js-collect-params-loop, and bootstrap_py.py
  now recognize (name :as type) in param lists, extracting just the name
- bootstrap_py.py: add _extract_param_name() helper, fix _emit_for_each_stmt
- 521 type annotations across 22 .sx spec files (eval, types, adapters,
  transpilers, engine, orchestration, deps, signals, router, prove, etc.)
- Zero behavioral change: annotations are metadata for static analysis only
- All bootstrappers (Python, JS, G1) pass, 81/81 spec tests pass

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 20:27:36 +00:00
c82941d93c Merge main into macros: resolve nav restructure conflicts
Take HEAD's updated typed-sx content (deftype, effect system details)
with main's /etc/plans/ path prefix. Take main's newer sx-browser.js
timestamp.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 19:26:56 +00:00
9b38ef2ce9 Add deftype and static effect system to typed-sx plan
Phase 6 (deftype): type aliases, unions, records (typed dict shapes),
parameterized types. Phase 7: pragmatic static effect checking — io,
dom, async, state annotations with render-mode enforcement, no
algebraic handlers, zero runtime cost. Phases 1-5 marked done.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 19:12:37 +00:00
4d54be6b6b Restructure SX docs nav into 4 top-level sections with nested routing
New hierarchy: Geography (Reactive Islands, Hypermedia Lakes, Marshes,
Isomorphism), Language (Docs, Specs, Bootstrappers, Testing),
Applications (CSSX, Protocols), Etc (Essays, Philosophy, Plans).

All routes updated to match: /reactive/* → /geography/reactive/*,
/docs/* → /language/docs/*, /essays/* → /etc/essays/*, etc.
Updates nav-data.sx, all defpage routes, API endpoints, internal links
across 43 files. Enhanced find-nav-match for nested group resolution.

Also includes: page-helpers-demo sf-total fix (reduce instead of set!),
rebootstrapped sx-browser.js and sx_ref.py, defensive slice/rest guards.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 18:50:31 +00:00
5d5512e74a Add typed params to 67 primitives, implement check-primitive-call
Annotate all primitives in primitives.sx with (:as type) param types
where meaningful (67/80 — 13 polymorphic ops stay untyped). Add
parse_primitive_param_types() to boundary_parser.py for extraction.
Implement check-primitive-call in types.sx with full positional + rest
param validation, thread prim-param-types through check-body-walk,
check-component, and check-all. 10 new tests (438 total, all pass).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 18:39:20 +00:00
8a530569a2 Add (name :as type) annotation syntax for defcomp params
parse-comp-params now recognizes (name :as type) — a 3-element list
with :as keyword separator. Type annotations are stored on the
Component via component-param-types and used by types.sx for call-site
checking. Unannotated params default to any. 428/428 tests pass (50
types tests including 6 annotation tests).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 17:12:54 +00:00
b82fd7822d Merge branch 'main' into worktree-typed-sx
# Conflicts:
#	shared/sx/ref/platform_py.py
#	shared/sx/ref/sx_ref.py
2026-03-11 17:06:30 +00:00
e5dbe9f3da Add types.sx gradual type system spec module with 44 tests
Implements subtype checking, type inference, type narrowing, and
component call-site checking. All type logic is in types.sx (spec),
bootstrapped to every host. Adds test-types.sx with full coverage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 17:06:09 +00:00
0174fbfea3 Regenerate sx-browser.js — file was accidentally emptied in previous commit
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 16:56:51 +00:00
cd7653d8c3 Fix cond ambiguity: check ALL clauses with cond-scheme?, not just first
The cond special form misclassified Clojure-style as scheme-style when
the first test was a 2-element list like (nil? x) — treating it as a
scheme clause ((test body)) instead of a function call. Define
cond-scheme? using every? to check ALL clauses, fix eval.sx sf-cond and
render.sx eval-cond, rewrite engine.sx parse-time/filter-params as
nested if to avoid the ambiguity, add regression tests across eval/
render/aser specs. 378/378 tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 16:51:41 +00:00
ff6c1fab71 Fix process-bindings scope loss and async-invoke arity, bootstrap async adapter
Two bugs fixed:
1. process-bindings used merge(env) which returns {} for Env objects
   (Env is not a dict subclass). Changed to env-extend in render.sx
   and adapter-async.sx. This caused "Undefined symbol: theme" etc.
2. async-aser-eval-call passed evaled-args list to async-invoke(&rest),
   double-wrapping it. Changed to inline apply + coroutine check.

Also: bootstrap define-async into sx_ref.py (Phase 6), replace ~1000 LOC
hand-written async_eval_ref.py with 24-line thin re-export shim.

Test runner now uses Env (not flat dict) for render envs to catch scope bugs.
8 new regression tests (4 scope chain, 2 native callable arity, 2 render).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 16:38:47 +00:00
e843602ac9 Fix aser list flattening bug, add wire format test suite (41 tests)
The sync aser-call in adapter-sx.sx didn't flatten list results from
map/filter in positional children — serialize(list) wrapped in parens
creating ((div ...) ...) which re-parses as an invalid call. Rewrote
aser-call from reduce to for-each (bootstrapper can't nest for-each
inside reduce lambdas) and added list flattening in both aser-call
and aser-fragment.

Also adds test-aser.sx (41 tests), render-sx platform function,
expanded test-render.sx (+7 map/filter children tests), and specs
async-eval-slot-inner in adapter-async.sx.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 14:59:31 +00:00
c95e19dcf2 Page helpers demo: defisland, map-in-children fix, _eval_slot ref evaluator
- Add page-helpers-demo page with defisland ~demo-client-runner (pure SX,
  zero JS files) showing spec functions running on both server and client
- Fix _aser_component children serialization: flatten list results from map
  instead of serialize(list) which wraps in parens creating ((div ...) ...)
  that re-parses as invalid function call. Fixed in adapter-async.sx spec
  and async_eval_ref.py
- Switch _eval_slot to use async_eval_ref.py when SX_USE_REF=1 (was
  hardcoded to async_eval.py)
- Add Island type support to async_eval_ref.py: import, SSR rendering,
  aser dispatch, thread-first, defisland in _ASER_FORMS
- Add server affinity check: components with :affinity :server expand
  even when _expand_components is False
- Add diagnostic _aser_stack context to EvalError messages
- New spec files: adapter-async.sx, page-helpers.sx, platform_js.py
- Bootstrappers: page-helpers module support, performance.now() timing
- 0-arity lambda event handler fix in adapter-dom.sx

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 14:30:12 +00:00
29c90a625b Delete evaluator.py shim: all imports go directly to bootstrapped sx_ref.py
EvalError moved to types.py. All 27 files updated to import eval_expr,
trampoline, call_lambda, etc. directly from shared.sx.ref.sx_ref instead
of through the evaluator.py indirection layer. 320/320 spec tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 11:15:48 +00:00
4c4806c8dd Fix all 9 spec test failures: Env scope chain, IO detection, offline mutation
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 4m11s
- env.py: Add MergedEnv with dual-parent lookup (primary for set!,
  secondary for reads), add dict-compat methods to Env
- platform_py.py: make_lambda stores env reference (no copy), env_merge
  uses MergedEnv for proper set! propagation, ancestor detection prevents
  unbounded chains in TCO recursion, sf_set_bang walks scope chain
- types.py: Component/Island io_refs defaults to None (not computed)
  instead of empty set, so component-pure? falls through to scan
- run.py: Test env uses Env class, mock execute-action calls SX lambdas
  via _call_sx instead of direct Python call

Spec tests: 320/320 (was 311/320)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 09:42:04 +00:00
d8cddbd971 Replace hand-written evaluator with bootstrapped spec, emit flat Python
- evaluator.py: replace 1200 lines of hand-written eval with thin shim
  that re-exports from bootstrapped sx_ref.py
- bootstrap_py.py: emit all fn-bodied defines as `def` (not `lambda`),
  flatten tail-position if/cond/case/when to if/elif with returns,
  fix &rest handling in _emit_define_as_def
- platform_py.py: EvalError imports from evaluator.py so catches work
- __init__.py: remove SX_USE_REF conditional, always use bootstrapped
- tests/run.py: reset render_active after render tests for isolation
- Removes setrecursionlimit(5000) hack — no longer needed with flat code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 09:18:17 +00:00
3906ab3558 Fix quasiquote flattening bug, decouple relations from evaluator
- Fix qq-expand in eval.sx: use concat+list instead of append to prevent
  nested lists from being flattened during quasiquote expansion
- Update append primitive to match spec ("if x is list, concatenate")
- Rebuild sx_ref.py with quasiquote fix
- Make relations.py self-contained: parse defrelation AST directly
  without depending on the evaluator (25/25 tests pass)
- Replace hand-written JSEmitter with js.sx self-hosting bootstrapper
- Guard server-only tests in test-eval.sx with runtime check

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 04:53:34 +00:00
46cd179703 Fix multi-body lambda in evaluator, rebuild sx_ref.py with router module
evaluator.py _sf_lambda used only expr[2] (first body expression) instead
of collecting all body expressions and wrapping in (begin ...) when multiple.
This caused multi-body lambdas to silently discard all but the first expression.

Rebuilt sx_ref.py with --spec-modules deps,router,engine,signals so the
router functions are available from the bootstrapped code. The test runner
already had _load_router_from_bootstrap() but it was falling back to the
hand-written evaluator (which has set! scoping issues) because the router
functions weren't in sx_ref.py. Now 134/134 eval+router tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 04:34:17 +00:00
5d3676d751 Register component-affinity as JS primitive for runtime SX access
Fixes 4 test-eval.sx failures (component affinity tests).
Remaining 24 failures are server-only features (defpage, stream-*)
that don't belong in the browser evaluator.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 03:56:18 +00:00
86363d9f34 Fix browser: set render-active in DOM adapter + on adapter init
Browser always evaluates in render context — _renderMode must be true
when DOM adapter is loaded, and render-to-dom must call set-render-active!.
Fixes 'Undefined symbol: <>' error in browser.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 03:51:59 +00:00
8586f54dcb Add render-active? gate to JS platform, fix parity test for &rest
- JS platform: add renderActiveP/setRenderActiveB + RENAMES for
  render-active?/set-render-active! so eval-list gate works in browser
- Rebuild sx-browser.js from updated spec
- Fix test_rest_params: &rest not supported in bare lambda (spec-correct)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 03:50:13 +00:00
f54ebf26f8 Separate eval from render: render-active? gate in eval-list
eval-list only dispatches to the render adapter when render-active? is true.
render-to-html and aser set render-active! on entry. Pure evaluate() calls
no longer stringify component results through the render adapter.

Fixes component children parity: (defcomp ~wrap (&key &rest children) children)
now returns [1,2,3] in eval mode, renders to "123" only in render mode.

Parity: 112/116 pass (remaining 4 are hand-written evaluator.py bugs).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 03:42:04 +00:00
0a7a9aa5ae Add parity test suite: 116 tests comparing hand-written vs bootstrapped evaluator
110 pass, 6 known gaps identified (multi-body lambda, &rest in bare lambda,
component body evaluation, void element self-closing style).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 03:20:33 +00:00
f1e0e0d0a3 Extract platform_py.py: single source of truth for bootstrapper platform sections
bootstrap_py.py (G0) and run_py_sx.py (G1) now both import static
platform sections from platform_py.py instead of duplicating them.
bootstrap_py.py shrinks from 2287 to 1176 lines — only the PyEmitter
transpiler and build orchestration remain.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 03:11:33 +00:00
1341c144da URL restructure, 404 page, trailing slash normalization, layout fixes
- Rename /reactive-islands/ → /reactive/, /reference/ → /hypermedia/reference/,
  /examples/ → /hypermedia/examples/ across all .sx and .py files
- Add 404 error page (not-found.sx) working on both server refresh and
  client-side SX navigation via orchestration.sx error response handling
- Add trailing slash redirect (GET only, excludes /api/, /static/, /internal/)
- Remove blue sky-500 header bar from SX docs layout (conditional on header-rows)
- Fix 405 on API endpoints from trailing slash redirect hitting POST/PUT/DELETE
- Fix client-side 404: orchestration.sx now swaps error response content
  instead of silently dropping it
- Add new plan files and home page component

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 21:30:18 +00:00
e149dfe968 Fix island hydration double-render bug, add marshes plan
Client-rendered islands were re-hydrated by boot.sx because
renderDomIsland didn't mark them as processed. Hydration read
empty data-sx-state, overwriting kwargs (e.g. path) with NIL.
Fix: mark-processed! in adapter-dom.sx so boot skips them.

New plan: marshes — where reactivity and hypermedia interpenetrate.
Three patterns: server writes to signals, reactive marsh zones with
transforms, and signal-bound hypermedia interpretation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 15:53:44 +00:00
b8c5426093 Lake demo: page path in copyright updates across navigation morphs
The ~sx-header island now shows the current page path (faded, after
the copyright) inside the copyright lake. Navigate between pages:
the path text updates via server-driven lake morph while the reactive
colour-cycling signal persists. Subtle visible proof of L2-3.

Also fixes Island &key param serialization in component-source helper.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 15:05:19 +00:00
9b9fc6b6a5 Level 2-3: lake morphing — server content flows through reactive islands
Lake tag (lake :id "name" children...) creates server-morphable slots
within islands. During morph, the engine enters hydrated islands and
updates data-sx-lake elements by ID while preserving surrounding
reactive DOM (signals, effects, event listeners).

Specced in .sx, bootstrapped to JS and Python:
- adapter-dom.sx: render-dom-lake, reactive-attr marks data-sx-reactive-attrs
- adapter-html.sx: render-html-lake SSR output
- adapter-sx.sx: lake serialized in wire format
- engine.sx: morph-island-children (lake-by-ID matching),
  sync-attrs skips reactive attributes
- ~sx-header uses lakes for logo and copyright
- Hegelian essay updated with lake code example

Also includes: lambda nil-padding for missing args, page env ordering fix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 14:29:54 +00:00
d5e416e478 Reactive island preservation across server-driven morphs
Islands survive hypermedia swaps: morph-node skips hydrated
data-sx-island elements when the same island exists in new content.
dispose-islands-in skips hydrated islands to prevent premature cleanup.

- @client directive: .sx files marked ;; @client send define forms to browser
- CSSX client-side: cssxgroup renamed (no hyphen) to avoid isRenderExpr
  matching it as a custom element — was producing [object HTMLElement]
- Island wrappers: div→span to avoid block-in-inline HTML parse breakage
- ~sx-header is now a defisland with inline reactive colour cycling
- bootstrap_js.py defaults output to shared/static/scripts/sx-browser.js
- Deleted stale sx-ref.js (sx-browser.js is the canonical browser build)
- Hegelian Synthesis essay: dialectic of hypertext and reactivity
- component-source helper handles Island types for docs pretty-printing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 14:10:35 +00:00
8a5c115557 SX docs: configurable shell, SX-native event handlers, nav fixes
- Configurable page shell (~sx-page-shell kwargs + SX_SHELL app config)
  so each app controls its own assets — sx docs loads only sx-browser.js
- SX-evaluated sx-on:* handlers (eval-expr instead of new Function)
  with DOM primitives registered in PRIMITIVES table
- data-init boot mode for pure SX initialization scripts
- Jiggle animation on links while fetching
- Nav: 3-column grid for centered alignment, is-leaf sizing,
  fix map-indexed param order (index, item), guard mod-by-zero
- Async route eval failure now falls back to server fetch
  instead of silently rendering nothing
- Remove duplicate h1 title from ~doc-page
- Re-bootstrap sx-ref.js + sx-browser.js

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 11:00:59 +00:00
31a6e708fc more plans
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 12m0s
2026-03-09 18:07:23 +00:00
ec1093d372 Nav redesign: embedded breadcrumb navigation with recursive depth
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 5m25s
Replace menu bar navigation with in-page nav embedded in content area.
Each page shows logo/tagline/copyright, then a sibling row per trail
level (← prev | Current | next →), then children as button links.

- resolve-nav-path: recursive walk with no depth limit
- find-nav-index: rewritten with recursion (set! broken across closures)
- Walk stops on exact href match (prevents /cssx/ drilling into Overview)
- Unicode chars (©, ←, →) inline instead of \u escapes (SX parser doesn't support them)
- All 38 defpages wrapped in (~sx-doc :path ...) for in-page nav
- Layout returns only root header (nav moved out of blue menu bar)
- Standalone layout variants for sx-web.org (return nil)
- New plans: environment-images, runtime-slicing, typed-sx, nav-redesign, sx-web-platform

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 14:37:37 +00:00
cad65bcdf1 Add js.sx bootstrapper docs page with G0 bug discovery writeup
Documents the self-hosting process for js.sx including the G0 bug
where Python's `if fn_expr` treated 0/False/"" as falsy, emitting
NIL instead of the correct value. Adds live verification page,
translation differences table, and nav entry.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 01:44:02 +00:00
e6ca1a5f44 Implement js.sx: self-hosting SX-to-JavaScript bootstrapper
SX-to-JavaScript translator written in SX itself. When executed by the
Python evaluator against the spec files, produces output identical to
the hand-written bootstrap_js.py JSEmitter.

- 1,382 lines, 61 defines
- 431/431 defines match across all 22 spec files (G0 == G1)
- 267 defines in the standard compilation, 151,763 bytes identical
- camelCase mangling, var declarations, function(){} syntax
- Self-tail-recursive optimization (zero-arg → while loops)
- JS-native statement patterns: d[k]=v, arr.push(x), f.name=x

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 01:36:12 +00:00
fd4f13e571 Fix ref_dir UnboundLocalError in self-hosting bootstrapper page
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 01:24:03 +00:00
e5acfdcd3c Add live self-hosting bootstrapper page to bootstrappers section
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m15s
- Update plan page with completion status and results
- Add ~bootstrapper-self-hosting-content component with live G0/G1 verification
- Add _self_hosting_data() helper: loads py.sx, runs it, diffs against G0
- Add "Self-Hosting (py.sx)" to bootstrappers nav and index table
- Wire /bootstrappers/self-hosting route

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 01:18:20 +00:00
b4944aa2b6 Implement py.sx: self-hosting SX-to-Python bootstrapper
py.sx is an SX-to-Python translator written in SX. Running it on the
Python evaluator against the spec files produces byte-for-byte identical
output to the hand-written bootstrap_py.py (128/128 defines match,
1490 lines, 88955 bytes).

The bootstrapper bootstraps itself: G0 (Python) == G1 (SX).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 01:12:50 +00:00
e4e8b45cb4 Update py.sx scope: general SX-to-Python translator, not spec-only
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m37s
The translation rules are mechanical and apply to all SX forms — HTML tags,
components, macros, islands, page forms. Bootstrapping the spec is the first
test case (fixed-point proof); phases 6-9 extend to full SX compilation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:54:20 +00:00
db1691d8f5 Add JS bootstrapper plan: js.sx design document
js.sx — SX-to-JavaScript translator + ahead-of-time component compiler.
Two modes: spec bootstrapper (replacing bootstrap_js.py) and component
compiler (server-evaluated SX trees → standalone JS DOM construction).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:52:35 +00:00
192d48d0e3 Add self-hosting bootstrapper plan: py.sx design document
Plan for py.sx — an SX-to-Python translator written in SX that
replaces bootstrap_py.py. Covers translation rules, statement vs
expression modes, mutation/cell variables, five implementation
phases, fixed-point verification, and implications for multi-host
bootstrapping.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:45:07 +00:00
c0ced8a40f Fix production blank page: SxExpr page_sx was being parsed as AST
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 7m33s
_build_component_ast parsed SxExpr values back into AST, which
_arender then evaluated as HTML instead of passing through as raw
content for the script tag. Dev mode was unaffected because the
pretty-printer converted page_sx to a plain str first.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:17:01 +00:00
ff41fa2238 Declare prove-data page helper in boundary.sx
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 9m58s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 23:20:11 +00:00
00e7ba4650 Add theorem prover docs page with Phase 2 constraint solving
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
- prove.sx Phase 2: bounded model checking with 34 algebraic properties
  (commutativity, associativity, distributivity, inverses, bounds, transitivity)
- prove.sx generates SMT-LIB for unbounded Z3 verification via z3-expr
- New docs page /plans/theorem-prover with live results (91/91 sat, 34/34 verified)
- Page helper runs both proof phases and returns structured data
- Parser: re-add ' quote syntax (removed by prior edit)
- Load prove.sx alongside z3.sx at startup

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 23:17:09 +00:00
7b8ae473a5 Merge macros: z3.sx, prove.sx, parser unicode, auto reader macros
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 9m50s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:48:10 +00:00
3ca89ef765 Self-hosted z3.sx translator, prove.sx prover, parser unicode, auto reader macros
- z3.sx: SX-to-SMT-LIB translator written in SX (359 lines), replaces Python translation logic
- prove.sx: SMT-LIB satisfiability checker in SX — proves all 91 primitives sat by construction
- Parser: support unicode characters (em-dash, accented letters) in symbols
- Auto-resolve reader macros: #name finds name-translate in component env, no Python registration
- Platform primitives: type-of, symbol-name, keyword-name, sx-parse registered in primitives.py
- Cond heuristic: predicates ending in ? recognized as Clojure-style tests
- Library loading: z3.sx loaded at startup with reload callbacks for hot-reload ordering
- reader_z3.py: rewritten as thin shell delegating to z3.sx
- Split monolithic .sx files: essays (22), plans (13), reactive-islands (6) into separate files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:47:53 +00:00
8b1333de96 Fix unterminated list in plans.sx causing sx_docs crash
Added 9 missing closing parens — sections/subsections weren't closing
before siblings opened, accumulating unclosed depth through the file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:34:09 +00:00
f9939a660c Fix unterminated list in plans.sx causing sx_docs crash
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 3m3s
Added 9 missing closing parens — sections/subsections weren't closing
before siblings opened, accumulating unclosed depth through the file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 20:59:03 +00:00
8be8926155 Fix z3 demo code blocks: use (highlight ... "lisp") not :lang
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 16m21s
~doc-code only accepts :code — the :lang param was silently ignored.
All code blocks now use (highlight "..." "lang") like the rest of the site.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 20:39:41 +00:00
03ba8e58e5 Implement reader macros (#;, #|...|, #', #name) and #z3 demo
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 11m13s
Reader macros in parser.sx spec, Python parser.py, and hand-written sx.js:
- #; datum comment: read and discard next expression
- #|...|  raw string: no escape processing
- #' quote shorthand: (quote expr)
- #name extensible dispatch: registered handler transforms next expression

#z3 reader macro demo (reader_z3.py): translates define-primitive
declarations from primitives.sx into SMT-LIB verification conditions.
Same source, two interpretations — bootstrappers compile to executable
code, #z3 extracts proof obligations.

48 parser tests (SX spec + Python), all passing. Rebootstrapped JS+Python.
Demo page at /plans/reader-macro-demo with side-by-side examples.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 20:21:40 +00:00
56589a81b2 Fix lambda multi-body, reactive island demos, and add React is Hypermedia essay
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
Lambda multi-body fix: sf-lambda used (nth args 1), dropping all but the first
body expression. Fixed to collect all body expressions and wrap in (begin ...).
This was foundational — every multi-expression lambda in every island silently
dropped expressions after the first.

Reactive islands: fix dom-parent marker timing (first effect run before marker
is in DOM), fix :key eager evaluation, fix error boundary scope isolation,
fix resource/suspense reactive cond tracking, fix inc not available as JS var.

New essay: "React is Hypermedia" — argues that reactive islands are hypermedia
controls whose behavior is specified in SX, not a departure from hypermedia.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 20:00:44 +00:00