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

Avertissement

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).


Voir aussi

I recommend the following, more modern and comprehensive tools!

  • BetterOCaml.ml is a good little OCaml editor (with the code on the left, the output of its execution on the right), developed by a CPGE MP* student in 2020) ;

  • TryOCaml.OCamlPro.com is another good environment to use the basic OCaml system online, without installing anything!It’s done by OCamlPro and the « official » solution ;

  • Learn-OCaml is a heavier and more complete environment. Not sure if it works entirely offline.

Voir aussi

Locally use an OCaml editor and interpreter? It is possible on this site! Without having to install anything!

BetterOCaml is a simple OCaml console and editor, but one that works online without the need for a server that computes your code behind: everything is interpreted in javascript in your browser!I host a local copy here: BetterOCaml. It is also on ocaml.besson.link.

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 try.ocamlpro.com, 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";;

About

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.

Hosting

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

Copyrights

Acknowledgements