.TH JS_OF_OCAML 1 .SH NAME js_of_ocaml \- OCaml bytecode to Javascript compiler .SH DESCRIPTION .BR js_of_ocaml (1) is a compiler from OCaml bytecode programs to Javascript. It makes it 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. .SH USAGE Your program must be first compiled using the OCaml bytecode compiler .BR ocamlc (1). Javascript bindings, as well as a corresponding syntax extension, are provided by the .B js_of_ocaml package. .PP ocamlfind ocamlc \-package js_of_ocaml \-package js_of_ocaml.syntax \\ \-syntax camlp4o \-linkpkg \-o input_file.byte input_file.ml .PP Then, run the .BR js_of_ocaml (1) compiler to produce Javascript code. .B js_of_ocaml [ .I options ] .I input_file.byte .SH OPTIONS The following command-line options are recognized by .BR js_of_ocaml (1). .TP .BI \-debug \ name debug module .I name .TP .BI \-disable \ name disable optimization .I name .TP .B \-pretty pretty print the output .TP .B \-debuginfo output debug info .TP .B \-noinline disable inlining .TP .B \-noruntime do not include the standard runtime .TP .B \-toplevel compile a toplevel .TP .BI \-I \ dir Add .I dir to the list of include directories .TP .BI \-o \ file set output file name to .I file .TP .B \-help Display the list of options .TP .B \-\-help Display the list of options .SH FEATURES, LIMITATIONS 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 than usual: .IP \[bu] 2 marshalling of floats is not supported (unmarshalling works); .IP \[bu] the polymorphic hash function will not give the same results on data structures containing floats; .IP \[bu] these functions may be more prone to stack overflow, as the Javascript stack is small. .SH SEE ALSO .BR ocamlc (1), \ ocamlfind (1). .br .I http://ocsigen.org/js_of_ocaml/ The js_of_ocaml website .SH AUTHORS .TP .BR "The Ocsigen Team" " <\&dev@ocsigen\&.org\&>" .RB "Wrote the " js_of_ocaml " software\&." .TP .BR "Nicolas Dandrimont" " <\&nicolas\&.dandrimont@crans\&.org\&>" Wrote this manpage for the Debian system\&.