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>
This commit is contained in:
2026-03-11 09:18:17 +00:00
parent 3906ab3558
commit d8cddbd971
6 changed files with 1684 additions and 1350 deletions

View File

@@ -578,8 +578,11 @@ def sx_expr_source(x):
return x.source if isinstance(x, SxExpr) else str(x)
class EvalError(Exception):
pass
try:
from shared.sx.evaluator import EvalError
except ImportError:
class EvalError(Exception):
pass
def _sx_append(lst, item):