OCaml-Top

The OCaml interactive editor for education

ocaml-top screenshot

OCaml-Top is designed for beginners and students, and specially tailored for exercises, practicals and simple projects


Features

Syntax coloring
Automatic, state-of-the-art code indentation

structure screenshot

Makes understanding the program structure easier

easy mistake screenshot

Naturally avoids most beginner's syntactic mistakes

Intuitive code execution

Play button screenshot

"Run" button runs just what you would expect: the expression under cursor, and what is above if needed

Error location screenshot

Locate your errors directly in your code

Automatic type display

Play button screenshot

Put your cursor on the name of a standard library function, and the type shows up in the status bar. Non-intrusive, but here just when you need it.

Fully compatible with Microsoft Windows XP, Vista, 7 and 8, OSX and Linux.

Documentation

Installation

On Linux or OSX, we recommend you use the OPAM package manager:

First install opam and some gtk dependancies. For example, with Ubuntu:

add-apt-repository ppa:avsm/ppa
apt-get update
apt-get install m4 libgtksourceview2.0-dev opam

Then you need to install OCaml:

opam init default 4.01.0+ocp-bin

Finally install ocaml-top

opam install ocaml-top

On Microsoft Windows, download and run our binary installer. You will also need a working installation of OCaml itself, for which we recommend the installer by Jonathan Protzenko. You need no extra options besides OCaml itself.

Usage

The left pane is the code editor, while the right pane contains the OCaml process that will execute the code.

The green mark in the left margin of the editor is the evaluation mark, showing that the code has been successfully executed up to that point. When pressing the PLAY button (or Ctrl e), the expression under the cursor is sent to the OCaml pane, and the answer from OCaml is displayed there. In case of an error, the relevant part of the code in the editor is highlighted.

Since programs are usually written in order, the evaluation mark always progresses from top to bottom, and everything in-between the current mark position and the expression to run will be sent to OCaml first. If you happen to need execution of an expression directly, select it before pressing PLAY.

The FAST-FORWARD button runs the whole program. In case you get confused, the REWIND button restarts a fresh OCaml, rewinds the evaluation mark, and clears the right pane. And in case you got yourself in a loop, or your program just takes too long, the STOP button can interrupt the current computation.

Keyboard shortcuts

File management
Ctrl n Start with a new (blank) file
Ctrl oLoad a file
Ctrl sSave the current file
Edition
Ctrl cCopy
Ctrl xCut
Ctrl vPaste
Ctrl zUndo
Ctrl Shift zRedo
Execution
Ctrl e Execute the current expression
Escape Stop ongoing execution
General
Ctrl +Zoom in
Ctrl -Zoom out
F4Select font
F5Switch colors
F11Switch fullscreen
Ctrl qQuit

Resources

OCaml-Top on Github Latest sources in the official GIT repository
Version 1.1.2 Download for Linux, OSX and Windows