This is the command js_of_ocaml that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator
possible to write OCaml programs that run on web browsers.
It comes with bindings for a large part of the browser APIs, and the generated programs
have been measured to typically run faster the OCaml bytecode interpreter.
Your program must be first compiled using the OCaml bytecode compiler ocamlc(1).
ocamlfind ocamlc -package js_of_ocaml -package js_of_ocaml.syntax \
-syntax camlp4o -linkpkg -o input_file.byte input_file.ml
js_of_ocaml [ options ] input_file.byte
The following command-line options are recognized by js_of_ocaml(1).
debug module name
disable optimization name
pretty print the output
output debug info
do not include the standard runtime
compile a toplevel
-I dir Add dir to the list of include directories
set output file name to file
-help Display the list of options
--help Display the list of options
The whole OCaml standard library should be supported, except for input/output channels,
weak references, and most functions of the Sys module. Extra libraries such as Bigarray,
Unix, Thread or Str are not supported.
Tail call is not optimized in general. However, self-recursive functions (when the tail
calls are to the function itself) are compiled into a loop.
Recursive modules are not supported at the moment.
Data representation differs from the usual one, for performance reasons. Most notably,
integers are 32 bit (instead of 31 or 63 bits) and floats are not boxed. As a consequence,
marshalling, polymorphic comparison, and hashing functions can yield results different
· marshalling of floats is not supported (unmarshalling works);
· the polymorphic hash function will not give the same results on data structures
Use js_of_ocaml online using onworks.net services