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 Ouglib 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 Oug.
Then, follow the instructions in the INSTALL file coming with the distribution archive.
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 Ouglib 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.
Here are some things to add:
module A = B