Rewrites Checker.ml as a defunctionalized stack-based elaborator. The
control flow is expressed via an explicit goal stack: G-frames drive
elaboration, K-frames consume a single produced register from the
preceding frame. Replaces the previous mutually-recursive check / infer
style on the OCaml call stack with a single dispatch loop over an ADT
of typing problems.
- goal: 20 G/K-frame constructors covering check, infer, infer_type,
Pi, Lambda, TypedLambda, App with implicit insertion, Hole, Max,
lift insertion, and top-level Let / Data / Universe_decl - machine: mutable record with goal stack, produced register, ctx,
saved_ctx stack for binder pop/push - dispatch: exhaustive single match; OCaml exhaustiveness gives
compile-time coverage of all frame kinds - Reuses Evaluation, Unification, Meta, Env, Context unchanged
Rewrites Checker.ml as a defunctionalized stack-based elaborator. The
control flow is expressed via an explicit goal stack: G-frames drive
elaboration, K-frames consume a single produced register from the
preceding frame. Replaces the previous mutually-recursive check / infer
style on the OCaml call stack with a single dispatch loop over an ADT
of typing problems.
- goal: 20 G/K-frame constructors covering check, infer, infer_type,
Pi, Lambda, TypedLambda, App with implicit insertion, Hole, Max,
lift insertion, and top-level Let / Data / Universe_decl
- machine: mutable record with goal stack, produced register, ctx,
saved_ctx stack for binder pop/push
- dispatch: exhaustive single match; OCaml exhaustiveness gives
compile-time coverage of all frame kinds
- Reuses Evaluation, Unification, Meta, Env, Context unchanged