-
Notifications
You must be signed in to change notification settings - Fork 428
OCaml Ecosystem Extensions List
Louis Roché edited this page Aug 19, 2017
·
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!)
- 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.
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 (cmo s). 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 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. Always together with an .a file. Holds cmx /o files. |
cmxs |
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. |
mll | ocamllex lexical analyzer definition file. |
mly | ocamlyacc parser generator definition file. |
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. |
- 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