Skip to content

OCaml Ecosystem Extensions List

Cheng Lou edited this page Jun 14, 2016 · 9 revisions

OCaml/Reason Extension List

The OCaml community frequently uses file extension to distinguish between types of source, artifacts, metadata, etc. This README documents them and is intended to be newcomer-friendly. Feel free to contribute!

Prior Knowledge

Some terms come back often in the following explanations. (TODO: better explanation for all these. Feel free to modify this page directly!)

  • AST: Abstract Syntax Tree. The data structure coming from the source code, that the compiler operates on.
  • Bytecode: interpreter mode (TODO).
  • Linking: the step where the compiler takes many intermediate built result files and assemble them together. E.g. linking A with B, because A's original source file referred to B.
  • Native: runs on bare metal assembly instructions of the platform in question.
  • Object file: TODO.

The List

TODO: every item here needs a fuller explanation.

Official

Ext Description
a See cmxa.
annot Deprecated. See cmt.
cma "Library" file. It's an archive that contains the bytecode compilation result (cmos). Handy for sharing.
cmi The result file compiled from the interface file (mli).
cmo bytecode object (compiled module object-code)
cmt Typed source file output (AST), generated from the compiler's -bin-annot (binary annotation) flag. Tools like Merlin and [ocp-index] (https://github.com/OCamlPro/ocp-index) use these files for code analysis.
cmti cmt, but for interface files.
cmx Contains extra info for linking and cross-modules optimizations.
cmxa like cma, but from native compilation. Holds cmo/o files. Always together with an .a file.
cmxas cmxa, but for native dynamic linking using the Dynlink module.
ml OCaml source file.
mli OCaml interface (aka signature) file, that specifies nothing but the types of some (or all) of the corresponding ml file's values. Usually, during compilation, if foo.ml is provided but foo.mli isn't found, the latter will be automatically generated from the former.
o Compiled native object file of the source file.
out Somewhat conventional name/extension for the final output, produced by ocamlc/ocamlopt (e.g. ocamlc -o myExecutable.out), no special meaning (like C).
s/S Assembly language output if -S compilation flag is specified (TODO).

Ecosystem

Ext Description
atd Atgen files, one of the libraries that helps generate Yojson boilerplate code. Here's an example.
cmj BuckleScript intermediate files.
mldylib Ocaml plugin (cma and cmxs).
mliv Batteries-specific files for some custom preprocessing.
mllib Ocaml library (cma and cmxa).
mlpack Ocaml package (cmo built with the -pack flag).
mlpp Extlib-specific files for some custom preprocessing.
mltop OCamlbuild top-level file, used by OCamlbuild to generate a .top file.
odocl OCaml documentation file.
re Reason source file. The equivalent of ml for Reason.
rei Reason interface file. The equivalent of mli for Reason.

References

Clone this wiki locally