bootstrap_js.py reads the reference .sx specification (eval.sx, render.sx) and transpiles the defined evaluator functions into standalone JavaScript. The output sx-ref.js is a fully functional SX evaluator bootstrapped from the s-expression spec, comparable against the hand-written sx.js. Key features: - JSEmitter class transpiles SX AST → JS (fn→function, let→IIFE, cond→ternary, etc.) - Platform interface (types, env ops, primitives) implemented as native JS - Post-transpilation fixup wraps callLambda to handle both Lambda objects and primitives - 93/93 tests passing: arithmetic, strings, control flow, closures, HO forms, components, macros, threading, dict ops, predicates Fixed during development: - Bool before int isinstance check (Python bool is subclass of int) - SX NIL sentinel detection (not Python None) - Cond style detection (determine Scheme vs Clojure once, not per-pair) - Predicate null safety (x != null instead of x && to avoid 0-as-falsy in SX) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
42 KiB
42 KiB