Phase 1 engine step 4 — R7RS compatibility primitives for the CEK evaluator. call/cc: undelimited continuation capture with separate CallccContinuation type (distinct from delimited shift/reset continuations). Escape semantics — invoking k replaces the current continuation entirely. raise/raise-continuable: proper CEK arg evaluation via raise-eval frame. Non-continuable raise uses raise-guard frame that errors on handler return. host-error primitive for safe unhandled exception fallback. Multi-arity map: (map fn list1 list2 ...) zips multiple lists. Single-list path unchanged for performance. New multi-map frame type. cond =>: arrow clause syntax (cond (test => fn)) calls fn with test value. New cond-arrow frame type. R7RS do: shape-detecting dispatch — (do ((var init step) ...) (test result) body) desugars to named let. Existing (do expr1 expr2) sequential form preserved. integer? primitive, host-error alias. Transpiler fixes: match/case routing, wildcard _ support, nested match arm handling. 2522/2524 OCaml tests pass (2 pre-existing scope failures from transpiler match codegen, not related to these changes). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
18 KiB
18 KiB