Stackless bytecode interpreter using CPS
Go to file
kimmy441 1382f81bc7
Initial
2025-12-19 20:47:49 +00:00
bin Initial 2025-12-19 20:47:49 +00:00
lib Initial 2025-12-19 20:47:49 +00:00
README.md Initial 2025-12-19 20:47:49 +00:00
dune Initial 2025-12-19 20:47:49 +00:00
dune-project Initial 2025-12-19 20:47:49 +00:00

README.md

sequence

A stackless bytecode interpreter implemented in OCaml using CPS.

All control flow is expressed through explicit continuations rather than the OCaml call to ensure stack safety through a trampoline

Continuation Representation

Continuations are represented as a recursive type:

type continuation =
  | Halt
  | Return_to of continuation
  | Apply_to of { func : value; cont : continuation }
  | Eval_to of { expr : instruction; cont : continuation }
  | Pop_to of { n : int; cont : continuation }
  | Exception_to of { handler : continuation; cont : continuation }

Each continuation represents "what to do next" after the current computation completes

Exception continuations enable structured error handling

Building/Running

dune build
dune exec sequence