Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/favonia/ocaml-objdump

🖨️ Printing OCaml Runtime Representations
https://github.com/favonia/ocaml-objdump

ocaml ocaml-compiler ocaml-library

Last synced: 1 day ago
JSON representation

🖨️ Printing OCaml Runtime Representations

Awesome Lists containing this project

README

        

# 🖨️ Printing OCaml Runtime Representations

A small library I wrote when hacking the OCaml compiler. Caveats: the parsing of `infix` and `closure` blocks is incomplete, and the code might only work for OCaml 5.0.

## API and Example Code

This library only exposes an ugly printer [pp] that dumps the runtime representation of any OCaml value.

```ocaml
(* This line prints out [(42, ()) is represented as variant0(int(42),int(0))] *)
let () = Format.printf "@[(42, ())@ is@ represented@ as@ %a@]@." Objdump.pp (42, ())
```