Module Imandrakit_twine

A data format designed to represent complex OCaml values.

The format is designed for 0-copy parsing (or, not much copy anyway) and reasonable compactness.

https://github.com/imandra-ai/imandrakit/discussions/2

# Overview

The encoding relies on a first byte to disambiguate between values. The first byte is a bitfield kind:4 low:4 where:

kinds:

The toplevel value is written last, and to find it, a valid Twine blob must end with a byte n:u8 that indicates where this last value starts. If the last byte n is at address off, then the actual last value starts at off-n-1. If the last value is too big, it's turned into a pointer and that's what that last byte targets.

An immediate element is, basically, a non-recursive case that is easy to skip over to get to the next element. It includes booleans, integers, floats, strings, pointers, but not arrays or dictionaries (which must be encoded somewhere else and referred to by a pointer).

type offset = int

An offset in the slice

val show_offset : offset -> Ppx_deriving_runtime.string
exception Error of string
module Immediate : sig ... end
module Encode : sig ... end
module Decode : sig ... end
module Dump : sig ... end

Produce a debug dump of the given Twine value

module Util : sig ... end
type immediate = Immediate.t
type 'a encoder = 'a Encode.encoder
type 'a decoder = 'a Decode.decoder