Language : English | Français
An efficient, intuitive and cross-platform web IDE for the OCaml language (recent: v5.1.0), with your code interpreted and running in your browser! (no server is needed!)
The IDE is hosted here, https://jbdoderlein.github.io/BetterOCaml, but you can host your own version by simply copying the files from the src/
directory on your host (on a folder of your laptop, or a folder of your web-server, see http://ocaml.besson.link/ for an example).
It is a purely static website: once your browser downloads the files from the server (about 7 MB), it will run the OCaml code in its javascript engine, without sending anything to a distant server! Your data is secure, and this website does not use any third party service cookie :no_good_man: :cookie:.
Without installing any software on your laptop or smartphone, use this web-based editor to access to a complete OCaml REPL and text editor, with syntax highlighting, autocompletion, a full support of recent OCaml syntax and the entire standard library (except for Graphics
, Unix
modules and Sys.command
function), and multiple-files that you can save to or load from your computer.
The editor is made of 3 parts, as seen in this screenshot:
Ctrl+Enter
. Each OCaml statement must be finished with ;;
, and toplevel directives are not supported;sdtout
, you can also type command here (after the #
sign), and type Enter
.You can choose the theme in the settings, in the top right corner. Your preference should be used the next time you come back on the editor. There are currently three themes (two dark themes, "default" and "Monokai", and a light one, "MDN").
If you have any suggestion for a new theme, open an issue :+1: !
If you visit the editor webpage using your favorite browser, and if it works fine, you can add the link to your :star: "favorites", and then later on, if you open the direct link, it should work and load back BetterOCaml... even if your browser is offline!
This can only work if you don't clean-up or delete the cache of your browser, but it should work even if you turn-off and turn-on again your laptop!
We recently added support for an app manifest and service workers, so this web app is now a Progressive Web App (PWA), which can be installed on your laptop and used later on, even if you're offline! After being intalled, the app should appear in your global application menu (it works on Chromium on both Windows and Ubuntu).
If you can't install it as a PWA, @Naereen recommends trying WebCatalog, a multi-platform desktop app (for *NIX, Windows and Mac OS), and you can then use it to "install" the BetterOCaml editor, along with its integrated OCaml interpreter (of course), as a "native" desktop app. It then appears in the menu of your system, and it works offline! See this 1:30min tutorial in video.
BetterOCaml is a fully installable Progressive Web App
You can change the OCaml version with the url : https://link-to-betterocaml/?version=4.11.0
https://jbdoderlein.github.io/BetterOCaml offers 5.1.1
, 5.1.0
and 4.14.0
You can also compile the toplevel with any version you want using the compilation script.
Available version : 4.06.0
,4.06.1
,4.07.0
,4.07.1
,4.08.0
,4.08.0
,4.08.1
,4.09.0
,4.09.1
,4.10.0
,4.10.1
,4.10.2
,4.11.0
,4.11.1
,4.11.2
,4.12.0
,4.12.1
,4.13.0
,4.13.1
,4.14.0
, 4.14.1
, 5.1.0
, 5.1.1
The dune configuration is now modified to work with Dune>3.0 and Ocaml 5.0, to compile for OCaml<5.0, use this commit
BetterOCaml is made with these open-source tools:
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
If something is wrong or if you encounter any issue when using BetterOCaml, please open an issue first (you have to create a GitHub account first).
This project is released publicly under the terms of the Apache 2.0 license.
This project was initiated and is maintained by @jbdoderlein, with help and contributions from a few other people.