How to debug/execute a Ocaml program step by step? You can step through the code using the debugger ocamldebug, which can be run in emacs.