An OCaml toplevel (terminal) embedded online (Simple version)


Javascript is required!

This web page embeds some small programs written in javascript. This should work in any recent web browser, supporting javascript (and it should not be disabled).

The terminal

Toplevel OCaml 4.00.1

OCaml powered :)

Voir aussi

Try Ocaml

The try-ocaml.en.html page embeds the Try OCaml toplevel, copied from, which has the following advantages over the simple terminal embedded on this page:

  • a few interactive lessons;

  • supports of the « drag and drop » of files;

  • allow to download the historic of the input;

  • and the best of all: it supports the Graphics module !

An example of OCaml program

The terminal above should start with the following lines in its textarea buffer :

let x = 50+10;;
let y = x * 3;;
String.make x 'a';;
sin 1.;;
let rec fact n = if n = 0 then 1. else float n *. fact (n - 1);;
fact 20;;
"abc" < "def";;


Like for the .special.rst file, I use the .. raw:: html Sphinx command to include raw HTML code in the web page produced by Sphinx. It’s simple, it’s clean.


The Javascript scripts used on my web pages are now stored on this git repository : lbesson/web-sphinx-scripts, on