Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/favonia/ocaml-objdump
- Owner: favonia
- License: apache-2.0
- Created: 2022-05-30T08:15:38.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-05T14:03:43.000Z (over 1 year ago)
- Last Synced: 2025-01-14T02:22:30.705Z (8 days ago)
- Topics: ocaml, ocaml-compiler, ocaml-library
- Language: OCaml
- Homepage:
- Size: 24.4 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE
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, ())
```