What is Oug ?

Oug is a code analysis tool building reference graphs from OCaml code, that is graphs representing which elements (value, module, class, ...) reference which elements. We will also call these graphs dependency graphs, each edge of the graph being annotated by a dependency kind.

It comes with the Oug library to be able to embed the analyzer in other OCaml applications.

From the graph, various outputs can be obtained: list of elements not referenced anywhere (useless elements and potential dead code), various Graphiz graphs, ...

Oug does not compute the call graph of the given OCaml code; this would require data flow analysis. For this reason, the "useless elements" dump always consider that every method is referenced.


See the downloads section to get and install Oug.


First read the usage section about how Oug works.

Have a look at some examples:

A quick guide to start using Oug on your code: Getting started.

The Filters section describe the filter language, used to find elements in the graph, with lots of examples.

The Oug library can be used to embed the analyzer in other OCaml applications. The reference documentation is here. The main module (oug.ml) of the oug tool uses this library and can be taken as example to use the library.

Maxence Guesdon: Fouille au code OCaml par analyse de dépendances
Journées Francophones des Langages Applicatifs 2009. [in french]

Oug is distributed under the GPL license.

Todo list

Work still remains, including:

  • handling of recursive modules,
  • handling of objects and classes.