OCaml Phrases Extraction

I would like to extract complete PHRASES from several *.ml source files.
(e.g. all type definitions or all function definitions).

Are there program(s)/script(s) allowing such extractions available somewhere?

Thank you.

I would suggest to look into OCamlformat and to modify it. It parses OCaml code into an abstract syntax tree and emits it. I am not aware of any tool that directly supports what you are looking for.