Add sexp.js: client-side s-expression parser, evaluator, and DOM renderer
Vanilla JS (no build tools) counterpart to shared/sexp/ Python modules. Parses s-expression text, evaluates special forms, and renders to DOM nodes or HTML strings. Full component system with defcomp/~name. Includes: - Parser: tokenizer + parse/parseAll matching Python parser exactly - Evaluator: all special forms (if, when, cond, let, and, or, lambda, defcomp, define, ->, set!), higher-order forms (map, filter, reduce) - DOM renderer: createElement for HTML tags, SVG namespace support, component invocation, raw! for pre-rendered HTML, <> fragments - String renderer: matches Python html.render output for SSR parity - ~50 built-in primitives (arithmetic, string, collection, predicates) - 35 parity tests verifying JS output matches Python output via Node.js Also fixes Python raw! handler to properly unwrap _RawHTML objects. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1153
shared/static/scripts/sexp.js
Normal file
1153
shared/static/scripts/sexp.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user