sx-tools: WASM kernel updates, TW/CSSX rework, content refresh, new debugging tools
Build tooling: updated OCaml bootstrapper, compile-modules, bundle.sh, sx-build-all. WASM browser: rebuilt sx_browser.bc.js/wasm, sx-platform-2.js, .sxbc bytecode files. CSSX/Tailwind: reworked cssx.sx templates and tw-layout, added tw-type support. Content: refreshed essays, plans, geography, reactive islands, docs, demos, handlers. New tools: bisect_sxbc.sh, test-spa.js, render-trace.sx, morph playwright spec. Tests: added test-match.sx, test-examples.sx, updated test-tw.sx and web tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,14 +10,14 @@
|
||||
;; Status banner
|
||||
;; -----------------------------------------------------------------------
|
||||
|
||||
(div :class "rounded-lg bg-green-50 border border-green-200 p-4 mb-8"
|
||||
(div :class "flex items-center gap-3"
|
||||
(span :class "inline-flex items-center rounded-full bg-green-100 px-3 py-1 text-sm font-semibold text-green-800"
|
||||
(div (~tw :tokens "rounded-lg bg-green-50 border border-green-200 p-4 mb-8")
|
||||
(div (~tw :tokens "flex items-center gap-3")
|
||||
(span (~tw :tokens "inline-flex items-center rounded-full bg-green-100 px-3 py-1 text-sm font-semibold text-green-800")
|
||||
"Complete")
|
||||
(p :class "text-green-700 text-sm"
|
||||
(p (~tw :tokens "text-green-700 text-sm")
|
||||
(code "py.sx") " is implemented and verified. G0 == G1: 128/128 defines match, "
|
||||
"1490 lines, 88,955 bytes — byte-for-byte identical. "
|
||||
(a :href "/sx/(language.(bootstrapper.self-hosting))" :class "underline text-green-600 font-medium"
|
||||
(a :href "/sx/(language.(bootstrapper.self-hosting))" (~tw :tokens "underline text-green-600 font-medium")
|
||||
"See live verification."))))
|
||||
|
||||
;; -----------------------------------------------------------------------
|
||||
@@ -43,31 +43,31 @@
|
||||
;; -----------------------------------------------------------------------
|
||||
|
||||
(~docs/section :title "Results" :id "results"
|
||||
(div :class "overflow-x-auto rounded border border-stone-200 my-4"
|
||||
(table :class "w-full text-sm"
|
||||
(thead :class "bg-stone-50"
|
||||
(div (~tw :tokens "overflow-x-auto rounded border border-stone-200 my-4")
|
||||
(table (~tw :tokens "w-full text-sm")
|
||||
(thead (~tw :tokens "bg-stone-50")
|
||||
(tr
|
||||
(th :class "px-4 py-2 text-left font-semibold text-stone-700" "Metric")
|
||||
(th :class "px-4 py-2 text-left font-semibold text-stone-700" "Value")))
|
||||
(th (~tw :tokens "px-4 py-2 text-left font-semibold text-stone-700") "Metric")
|
||||
(th (~tw :tokens "px-4 py-2 text-left font-semibold text-stone-700") "Value")))
|
||||
(tbody
|
||||
(tr :class "border-t border-stone-100"
|
||||
(td :class "px-4 py-2 text-stone-600" "py.sx size")
|
||||
(td :class "px-4 py-2 font-mono" "1,182 lines"))
|
||||
(tr :class "border-t border-stone-100"
|
||||
(td :class "px-4 py-2 text-stone-600" "bootstrap_py.py size (replaced)")
|
||||
(td :class "px-4 py-2 font-mono" "902 lines (PyEmitter class)"))
|
||||
(tr :class "border-t border-stone-100"
|
||||
(td :class "px-4 py-2 text-stone-600" "Defines translated")
|
||||
(td :class "px-4 py-2 font-mono" "128/128 exact match"))
|
||||
(tr :class "border-t border-stone-100"
|
||||
(td :class "px-4 py-2 text-stone-600" "Spec files processed")
|
||||
(td :class "px-4 py-2 font-mono" "7 (eval, forms, render, adapter-html, adapter-sx, deps, signals)"))
|
||||
(tr :class "border-t border-stone-100"
|
||||
(td :class "px-4 py-2 text-stone-600" "Output size")
|
||||
(td :class "px-4 py-2 font-mono" "1,490 lines / 88,955 bytes"))
|
||||
(tr :class "border-t border-stone-100 bg-green-50"
|
||||
(td :class "px-4 py-2 font-semibold text-green-700" "G0 == G1")
|
||||
(td :class "px-4 py-2 font-semibold text-green-700" "Identical (diff is empty)"))))))
|
||||
(tr (~tw :tokens "border-t border-stone-100")
|
||||
(td (~tw :tokens "px-4 py-2 text-stone-600") "py.sx size")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "1,182 lines"))
|
||||
(tr (~tw :tokens "border-t border-stone-100")
|
||||
(td (~tw :tokens "px-4 py-2 text-stone-600") "bootstrap_py.py size (replaced)")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "902 lines (PyEmitter class)"))
|
||||
(tr (~tw :tokens "border-t border-stone-100")
|
||||
(td (~tw :tokens "px-4 py-2 text-stone-600") "Defines translated")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "128/128 exact match"))
|
||||
(tr (~tw :tokens "border-t border-stone-100")
|
||||
(td (~tw :tokens "px-4 py-2 text-stone-600") "Spec files processed")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "7 (eval, forms, render, adapter-html, adapter-sx, deps, signals)"))
|
||||
(tr (~tw :tokens "border-t border-stone-100")
|
||||
(td (~tw :tokens "px-4 py-2 text-stone-600") "Output size")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "1,490 lines / 88,955 bytes"))
|
||||
(tr (~tw :tokens "border-t border-stone-100 bg-green-50")
|
||||
(td (~tw :tokens "px-4 py-2 font-semibold text-green-700") "G0 == G1")
|
||||
(td (~tw :tokens "px-4 py-2 font-semibold text-green-700") "Identical (diff is empty)"))))))
|
||||
|
||||
;; -----------------------------------------------------------------------
|
||||
;; Architecture
|
||||
@@ -75,34 +75,34 @@
|
||||
|
||||
(~docs/section :title "Architecture" :id "architecture"
|
||||
(p "Three bootstrapper generations:")
|
||||
(div :class "overflow-x-auto rounded border border-stone-200 my-4"
|
||||
(table :class "w-full text-sm"
|
||||
(thead :class "bg-stone-50"
|
||||
(div (~tw :tokens "overflow-x-auto rounded border border-stone-200 my-4")
|
||||
(table (~tw :tokens "w-full text-sm")
|
||||
(thead (~tw :tokens "bg-stone-50")
|
||||
(tr
|
||||
(th :class "px-4 py-2 text-left font-semibold text-stone-700" "Gen")
|
||||
(th :class "px-4 py-2 text-left font-semibold text-stone-700" "Source")
|
||||
(th :class "px-4 py-2 text-left font-semibold text-stone-700" "Runs on")
|
||||
(th :class "px-4 py-2 text-left font-semibold text-stone-700" "Reads")
|
||||
(th :class "px-4 py-2 text-left font-semibold text-stone-700" "Produces")))
|
||||
(th (~tw :tokens "px-4 py-2 text-left font-semibold text-stone-700") "Gen")
|
||||
(th (~tw :tokens "px-4 py-2 text-left font-semibold text-stone-700") "Source")
|
||||
(th (~tw :tokens "px-4 py-2 text-left font-semibold text-stone-700") "Runs on")
|
||||
(th (~tw :tokens "px-4 py-2 text-left font-semibold text-stone-700") "Reads")
|
||||
(th (~tw :tokens "px-4 py-2 text-left font-semibold text-stone-700") "Produces")))
|
||||
(tbody
|
||||
(tr :class "border-t border-stone-100"
|
||||
(td :class "px-4 py-2 font-mono text-stone-600" "G0")
|
||||
(td :class "px-4 py-2" (code "bootstrap_py.py"))
|
||||
(td :class "px-4 py-2" "Python (manual)")
|
||||
(td :class "px-4 py-2" (code "eval.sx") ", " (code "render.sx") ", ...")
|
||||
(td :class "px-4 py-2" (code "sx_ref.py")))
|
||||
(tr :class "border-t border-stone-100 bg-green-50"
|
||||
(td :class "px-4 py-2 font-mono text-green-700" "G1")
|
||||
(td :class "px-4 py-2" (code "py.sx"))
|
||||
(td :class "px-4 py-2" "Python evaluator + SX")
|
||||
(td :class "px-4 py-2" (code "eval.sx") ", " (code "render.sx") ", ...")
|
||||
(td :class "px-4 py-2 font-semibold text-green-700" (code "sx_ref.py") " (identical)"))
|
||||
(tr :class "border-t border-stone-100"
|
||||
(td :class "px-4 py-2 font-mono text-stone-600" "G2")
|
||||
(td :class "px-4 py-2" (code "py.sx"))
|
||||
(td :class "px-4 py-2" (code "sx_ref.py") " from G1 + SX")
|
||||
(td :class "px-4 py-2" (code "eval.sx") ", " (code "render.sx") ", ...")
|
||||
(td :class "px-4 py-2" (code "sx_ref.py") " (fixed-point)")))))
|
||||
(tr (~tw :tokens "border-t border-stone-100")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono text-stone-600") "G0")
|
||||
(td (~tw :tokens "px-4 py-2") (code "bootstrap_py.py"))
|
||||
(td (~tw :tokens "px-4 py-2") "Python (manual)")
|
||||
(td (~tw :tokens "px-4 py-2") (code "eval.sx") ", " (code "render.sx") ", ...")
|
||||
(td (~tw :tokens "px-4 py-2") (code "sx_ref.py")))
|
||||
(tr (~tw :tokens "border-t border-stone-100 bg-green-50")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono text-green-700") "G1")
|
||||
(td (~tw :tokens "px-4 py-2") (code "py.sx"))
|
||||
(td (~tw :tokens "px-4 py-2") "Python evaluator + SX")
|
||||
(td (~tw :tokens "px-4 py-2") (code "eval.sx") ", " (code "render.sx") ", ...")
|
||||
(td (~tw :tokens "px-4 py-2 font-semibold text-green-700") (code "sx_ref.py") " (identical)"))
|
||||
(tr (~tw :tokens "border-t border-stone-100")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono text-stone-600") "G2")
|
||||
(td (~tw :tokens "px-4 py-2") (code "py.sx"))
|
||||
(td (~tw :tokens "px-4 py-2") (code "sx_ref.py") " from G1 + SX")
|
||||
(td (~tw :tokens "px-4 py-2") (code "eval.sx") ", " (code "render.sx") ", ...")
|
||||
(td (~tw :tokens "px-4 py-2") (code "sx_ref.py") " (fixed-point)")))))
|
||||
|
||||
(p "G0 is the hand-written compiler. G1 replaces it with SX. "
|
||||
"G2 proves the fixed-point: " (code "py.sx") " compiled by its own output "
|
||||
@@ -118,59 +118,59 @@
|
||||
(p "SX identifiers become valid Python identifiers. "
|
||||
"The RENAMES dict (200+ entries) handles explicit mappings; "
|
||||
"general rules handle the rest:")
|
||||
(div :class "overflow-x-auto rounded border border-stone-200 my-4"
|
||||
(table :class "w-full text-sm"
|
||||
(thead :class "bg-stone-50"
|
||||
(div (~tw :tokens "overflow-x-auto rounded border border-stone-200 my-4")
|
||||
(table (~tw :tokens "w-full text-sm")
|
||||
(thead (~tw :tokens "bg-stone-50")
|
||||
(tr
|
||||
(th :class "px-4 py-2 text-left font-semibold text-stone-700" "SX")
|
||||
(th :class "px-4 py-2 text-left font-semibold text-stone-700" "Python")
|
||||
(th :class "px-4 py-2 text-left font-semibold text-stone-700" "Rule")))
|
||||
(th (~tw :tokens "px-4 py-2 text-left font-semibold text-stone-700") "SX")
|
||||
(th (~tw :tokens "px-4 py-2 text-left font-semibold text-stone-700") "Python")
|
||||
(th (~tw :tokens "px-4 py-2 text-left font-semibold text-stone-700") "Rule")))
|
||||
(tbody
|
||||
(tr :class "border-t border-stone-100"
|
||||
(td :class "px-4 py-2 font-mono" "eval-expr")
|
||||
(td :class "px-4 py-2 font-mono" "eval_expr")
|
||||
(td :class "px-4 py-2" "kebab → snake"))
|
||||
(tr :class "border-t border-stone-100"
|
||||
(td :class "px-4 py-2 font-mono" "nil?")
|
||||
(td :class "px-4 py-2 font-mono" "is_nil")
|
||||
(td :class "px-4 py-2" "predicate rename"))
|
||||
(tr :class "border-t border-stone-100"
|
||||
(td :class "px-4 py-2 font-mono" "empty?")
|
||||
(td :class "px-4 py-2 font-mono" "empty_p")
|
||||
(td :class "px-4 py-2" "? → _p (general)"))
|
||||
(tr :class "border-t border-stone-100"
|
||||
(td :class "px-4 py-2 font-mono" "set!")
|
||||
(td :class "px-4 py-2 font-mono" "set_b")
|
||||
(td :class "px-4 py-2" "! → _b"))
|
||||
(tr :class "border-t border-stone-100"
|
||||
(td :class "px-4 py-2 font-mono" "type")
|
||||
(td :class "px-4 py-2 font-mono" "type_")
|
||||
(td :class "px-4 py-2" "Python reserved word escape"))))))
|
||||
(tr (~tw :tokens "border-t border-stone-100")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "eval-expr")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "eval_expr")
|
||||
(td (~tw :tokens "px-4 py-2") "kebab → snake"))
|
||||
(tr (~tw :tokens "border-t border-stone-100")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "nil?")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "is_nil")
|
||||
(td (~tw :tokens "px-4 py-2") "predicate rename"))
|
||||
(tr (~tw :tokens "border-t border-stone-100")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "empty?")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "empty_p")
|
||||
(td (~tw :tokens "px-4 py-2") "? → _p (general)"))
|
||||
(tr (~tw :tokens "border-t border-stone-100")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "set!")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "set_b")
|
||||
(td (~tw :tokens "px-4 py-2") "! → _b"))
|
||||
(tr (~tw :tokens "border-t border-stone-100")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "type")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "type_")
|
||||
(td (~tw :tokens "px-4 py-2") "Python reserved word escape"))))))
|
||||
|
||||
(~docs/subsection :title "Special Forms"
|
||||
(p "Each SX special form maps to a Python expression pattern:")
|
||||
(div :class "overflow-x-auto rounded border border-stone-200 my-4"
|
||||
(table :class "w-full text-sm"
|
||||
(thead :class "bg-stone-50"
|
||||
(div (~tw :tokens "overflow-x-auto rounded border border-stone-200 my-4")
|
||||
(table (~tw :tokens "w-full text-sm")
|
||||
(thead (~tw :tokens "bg-stone-50")
|
||||
(tr
|
||||
(th :class "px-4 py-2 text-left font-semibold text-stone-700" "SX")
|
||||
(th :class "px-4 py-2 text-left font-semibold text-stone-700" "Python")))
|
||||
(th (~tw :tokens "px-4 py-2 text-left font-semibold text-stone-700") "SX")
|
||||
(th (~tw :tokens "px-4 py-2 text-left font-semibold text-stone-700") "Python")))
|
||||
(tbody
|
||||
(tr :class "border-t border-stone-100"
|
||||
(td :class "px-4 py-2 font-mono" "(if c t e)")
|
||||
(td :class "px-4 py-2 font-mono" "(t if sx_truthy(c) else e)"))
|
||||
(tr :class "border-t border-stone-100"
|
||||
(td :class "px-4 py-2 font-mono" "(let ((a 1)) body)")
|
||||
(td :class "px-4 py-2 font-mono" "(lambda a: body)(1)"))
|
||||
(tr :class "border-t border-stone-100"
|
||||
(td :class "px-4 py-2 font-mono" "(fn (x) body)")
|
||||
(td :class "px-4 py-2 font-mono" "lambda x: body"))
|
||||
(tr :class "border-t border-stone-100"
|
||||
(td :class "px-4 py-2 font-mono" "(and a b c)")
|
||||
(td :class "px-4 py-2 font-mono" "(a if not sx_truthy(a) else ...)"))
|
||||
(tr :class "border-t border-stone-100"
|
||||
(td :class "px-4 py-2 font-mono" "(case x \"a\" 1)")
|
||||
(td :class "px-4 py-2 font-mono" "_sx_case(x, [(\"a\", lambda: 1)])"))))))
|
||||
(tr (~tw :tokens "border-t border-stone-100")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "(if c t e)")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "(t if sx_truthy(c) else e)"))
|
||||
(tr (~tw :tokens "border-t border-stone-100")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "(let ((a 1)) body)")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "(lambda a: body)(1)"))
|
||||
(tr (~tw :tokens "border-t border-stone-100")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "(fn (x) body)")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "lambda x: body"))
|
||||
(tr (~tw :tokens "border-t border-stone-100")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "(and a b c)")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "(a if not sx_truthy(a) else ...)"))
|
||||
(tr (~tw :tokens "border-t border-stone-100")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "(case x \"a\" 1)")
|
||||
(td (~tw :tokens "px-4 py-2 font-mono") "_sx_case(x, [(\"a\", lambda: 1)])"))))))
|
||||
|
||||
(~docs/subsection :title "Mutation: set! and Cell Variables"
|
||||
(p "Python closures can read but not rebind outer variables. "
|
||||
@@ -201,7 +201,7 @@
|
||||
"it translates SX syntax, not SX semantics. Every SX form has a "
|
||||
"straightforward Python equivalent.")
|
||||
(p "The roadmap:")
|
||||
(ul :class "list-disc pl-6 space-y-1 text-stone-700"
|
||||
(ul (~tw :tokens "list-disc pl-6 space-y-1 text-stone-700")
|
||||
(li (code "py.sx") " → Python — " (strong "done"))
|
||||
(li (code "js.sx") " → JavaScript (replaces " (code "bootstrap_js.py") ")")
|
||||
(li (code "go.sx") " → Go (new host)")
|
||||
|
||||
Reference in New Issue
Block a user