Add Scheme forms: named let, letrec, dynamic-wind, three-tier equality

Spec (eval.sx, primitives.sx):
- Named let: (let loop ((i 0)) body) — self-recursive lambda with TCO
- letrec: mutually recursive local bindings with closure patching
- dynamic-wind: entry/exit guards with wind stack for future continuations
- eq?/eqv?/equal?: identity, atom-value, and deep structural equality

Implementation (evaluator.py, async_eval.py, primitives.py):
- Both sync and async evaluators implement all four forms
- 33 new tests covering all forms including TCO at 10k depth

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 01:11:31 +00:00
parent 9cde15c3ce
commit f34e55aa9b
7 changed files with 785 additions and 26 deletions

View File

@@ -165,6 +165,12 @@ class JSEmitter:
"sf-and": "sfAnd",
"sf-or": "sfOr",
"sf-let": "sfLet",
"sf-named-let": "sfNamedLet",
"sf-letrec": "sfLetrec",
"sf-dynamic-wind": "sfDynamicWind",
"push-wind!": "pushWind",
"pop-wind!": "popWind",
"call-thunk": "callThunk",
"sf-lambda": "sfLambda",
"sf-define": "sfDefine",
"sf-defcomp": "sfDefcomp",