kestrel/lib/Machine.mli

22 lines
590 B
OCaml

type stack = Stack of { data : bytes; mutable sp : int }
type mode = Mode of { short : bool; keep : bool; mutable temp : int }
val stack_create : unit -> stack
val peek : mode -> stack -> int
val pop : mode -> stack -> int
val push : mode -> stack -> int -> unit
type machine
val ram : machine -> bytes
val dev : machine -> bytes
val wst : machine -> stack
val rst : machine -> stack
type _ Effect.t +=
| BRK : int Effect.t
| DEI : ([ `Byte | `Short ] * int) -> int Effect.t
| DEO : (int * int) -> unit Effect.t
val create : string -> machine
val dispatch : machine -> int -> 'a