I’d like a function that takes OCaml code like 2+3
in the form of a string, runs the code through a fresh top-level and returns the string that the top-level responded with. Does that already exist and, if not, how might I write it?
mdx seems to expose the mdx.top library which seems to have a simple enough interface: mdx 2.4.1 (latest) · OCaml Package.
Underneath it builds on the compiler-libs.toplevel library which is a lot less user-friendly.