Close

Help & About

Show Tutorial

Code Editor: Syntax

Code must be a single OCaml statement (i.e. excludes the trailing ";;" )

OCaml statement (i.e. ) Pattern matching is not supported

supported Physical equality is not implemented

Strings are supported only for use with failwith; they cannot be manipulated

The tool does not use static typing: therefore where OCaml would throw an error, it is possible to step through such a program, although undefined behaviour may occur

Code Editor: Functions

Arithmetic + : int -> int -> int - : int -> int -> int / : int -> int -> int * : int -> int -> int mod : int -> int -> int

Boolean && : bool -> bool -> bool || : bool -> bool -> bool not : bool -> bool

Comparisons <= : int -> int -> bool >= : int -> int -> bool < : int -> int -> bool > : int -> int -> bool = : 'a -> 'a -> bool <> : int -> int -> bool == : 'a -> 'a -> bool != : 'a -> 'a -> bool min : int -> int -> int max : int -> int -> int

Integers succ : int -> int pred : int -> int abs : int -> int ~- : int -> int ~+ : int -> int

Lists :: (infix): 'a -> 'a list -> 'a list empty: 'a list -> bool hd: 'a list -> 'a tl: 'a list -> 'a list fold_left: ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a fold_right: ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b

Pairs fst: 'a * 'b -> 'a snd: 'a * 'b -> 'b

failwith: string -> 'a

Graph: Interactive Mode

Orange subgraphs are used to hide functions. When clicked, these can be opened/closed. The token is the red arrow; this moves around the graph to perform evaluation. Purple rounded rectangle nodes are for constants. Contraction nodes are used where terms are referenced by multiple nodes. When clicked, they can be broken/restored.

Graph: Breakpoint Toggle Mode

A node where the breakpoint has been set Once a breakpoint is reached, play stops and the play button turns green

The input code is a subset of OCaml, with the following key points:Built in functions include:In the default interactive mode,In the breakpoint toggle mode,

Note: breakpoints may become inactive after stepping backwards, and can be enabled using the "Reactivate Breakpoints" button.

Graph: Navigation & Tool Buttons

Redraw graph : redraws the current graph

: redraws the current graph Backwards, play/pause, forwards : these can be used to move in both directions through evaluation

: these can be used to move in both directions through evaluation Go to state n : this jumps to the given state (or the last possible state, whichever is first).

: this jumps to the given state (or the last possible state, whichever is first). Interactive Mode : the default mode, in which subgraphs can be expanded, contraction nodes split, and other nodes can be selected for more information.

: the default mode, in which subgraphs can be expanded, contraction nodes split, and other nodes can be selected for more information. Breakpoint Toggle Mode : selecting this option will enter breakpoint mode, to set breakpoints on nodes

: selecting this option will enter breakpoint mode, to set breakpoints on nodes Reactivate breakpoints : this button will become active if the user steps backwards (as the current graph no longer represents the state of the abstract machine). Reactivating breakpoints will require recomputing all states up to and including the current state

: this button will become active if the user steps backwards (as the current graph no longer represents the state of the abstract machine). Reactivating breakpoints will require recomputing all states up to and including the current state Download : provides options to download a single or collection of states, either as SVG or DOT (or GIF for multiple states).

: provides options to download a single or collection of states, either as SVG or DOT (or GIF for multiple states). Stats: provides charts to show the size of the program (number of nodes) and number of operations changing during evaluation

About

Below the graph are a number of buttons. These include:

This is a visual debugger tool for a subset of OCaml (including patterns and lists), using a GoI-style abstract machine for evaluation.



The OCaml visual debugger was implemented by Jack Hughes, using the GoI-style abstraction machine implementation by Steven Cheung.



Attributions