sequence/README.md

30 lines
834 B
Markdown

# 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:
```ocaml
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
```bash
dune build
dune exec sequence
```