I am implementing a ISO/IEC 13211-1:1995 compliant Prolog system in OCaml.
For the code generation (a.k.a. JIT) part I ...
- ... generate actual ".ml" code, ...
- ... compile it with
ocamlopt, ... - ... and use dynamic linking.
The approach is somewhat crude but good enough as a proof-of-concept.
Lately, it occurred to me that compiling to OCaml bytecode could be an alternative1.
So my actual question is two-fold:
How can I compile OCaml bytecode to native code?
Are there OCaml libraries for emitting/handling bytecode?
1 And a nice one, too, as this would allow using js_of_ocaml.