-
Notifications
You must be signed in to change notification settings - Fork 428
OCaml Ecosystem Extensions List
Yunxing Dai edited this page Jun 14, 2016
·
9 revisions
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!
Some terms come back often in the following explanations. (TODO: better explanation for all these. Feel free to modify this page directly!)
- Bytecode: interpreter mode.
- Native: runs on bare metal assembly instructions of the platform in question.
- 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.
- AST: Abstract Syntax Tree. The data structure coming from the source code, that the compiler operates on.
- Object file: TODO.
Every single one of these needs better explanations.
Official
Ext | Description |
---|---|
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. |
cmo | bytecode object (compiled module object-code) |
cmi | The result file compiled from the interface file (mli ). |
cma | "Library" file. It's an archive that contains the bytecode compilation result (cmo s). Handy for sharing. |
cmxa | like cma , but from native compilation. Holds cmo /o files. |
cmxas |
cmxa , but for native dynamic linking using the Dynlink module. |
cmx | Contains extra info for linking and cross-modules optimizations. |
out | Somewhat conventional name/extension for the final output, produced by ocamlc/ocamlopt (e.g. ocamlc -o myExecutable.out ), no special meaning (like C). |
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. |
annot | Deprecated. See cmt . |
o | |
a | |
S |
Ecosystem
Ext | Description |
---|---|
re |
Reason source file. The equivalent of ml for Reason. |
rei |
Reason interface file. The equivalent of mli for Reason. |
mliv | Batteries-specific files for some custom preprocessing. |
mllib | Ocaml library (cma and cmxa ). |
mlpack | Ocaml package (cmo built with the -pack flag). |
odocl | OCaml documentation. |
mldylib | Ocaml plugin (cma and cmxs). |
mltop |
OCamlbuild top-level file, used by OCamlbuild to generate a .top file. |
atd | Atgen files, one of the libraries that helps generate Yojson boilerplate code. Here's an example. |
mlpp | Extlib-specific files for some custom preprocessing. |
cmj | BuckleScript intermediate files. |
mly | Merhir/ocamlyacc's grammar files. |
- http://stackoverflow.com/questions/25422560/what-are-all-these-cma-z-files-and-when-we-need-them
- https://realworldocaml.org/v1/en/html/the-compiler-backend-byte-code-and-native-code.html#summarizing-the-file-extensions
- https://ocaml.org/learn/tutorials/ocamlbuild/Special_files.html
- http://stackoverflow.com/questions/8630599/is-there-a-reason-to-retain-cmo-or-only-cma