moonpool/dev/ocaml/Compile_common/index.html
2023-08-28 17:11:38 +00:00

12 lines
No EOL
9.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Compile_common (ocaml.Compile_common)</title><link rel="stylesheet" href="../../_odoc-theme/odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 2.2.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> <a href="../index.html">ocaml</a> &#x00BB; Compile_common</nav><header class="odoc-preamble"><h1>Module <code><span>Compile_common</span></code></h1><p>Common compilation pipeline between bytecode and native.</p></header><nav class="odoc-toc"><ul><li><a href="#initialization">Initialization</a></li><li><a href="#interfaces">Interfaces</a></li><li><a href="#implementations">Implementations</a></li><li><a href="#build-artifacts">Build artifacts</a></li></ul></nav><div class="odoc-content"><h3 id="initialization"><a href="#initialization" class="anchor"></a>Initialization</h3><div class="odoc-spec"><div class="spec type anchored" id="type-info"><a href="#type-info" class="anchor"></a><code><span><span class="keyword">type</span> info</span><span> = </span><span>{</span></code><ol><li id="type-info.source_file" class="def record field anchored"><a href="#type-info.source_file" class="anchor"></a><code><span>source_file : string;</span></code></li><li id="type-info.module_name" class="def record field anchored"><a href="#type-info.module_name" class="anchor"></a><code><span>module_name : string;</span></code></li><li id="type-info.output_prefix" class="def record field anchored"><a href="#type-info.output_prefix" class="anchor"></a><code><span>output_prefix : string;</span></code></li><li id="type-info.env" class="def record field anchored"><a href="#type-info.env" class="anchor"></a><code><span>env : <a href="../Env/index.html#type-t">Env.t</a>;</span></code></li><li id="type-info.ppf_dump" class="def record field anchored"><a href="#type-info.ppf_dump" class="anchor"></a><code><span>ppf_dump : <a href="../Stdlib/Format/index.html#type-formatter">Stdlib.Format.formatter</a>;</span></code></li><li id="type-info.tool_name" class="def record field anchored"><a href="#type-info.tool_name" class="anchor"></a><code><span>tool_name : string;</span></code></li><li id="type-info.native" class="def record field anchored"><a href="#type-info.native" class="anchor"></a><code><span>native : bool;</span></code></li></ol><code><span>}</span></code></div><div class="spec-doc"><p>Information needed to compile a file.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-with_info"><a href="#val-with_info" class="anchor"></a><code><span><span class="keyword">val</span> with_info :
<span>native:bool <span class="arrow">&#45;&gt;</span></span>
<span>tool_name:string <span class="arrow">&#45;&gt;</span></span>
<span>source_file:string <span class="arrow">&#45;&gt;</span></span>
<span>output_prefix:string <span class="arrow">&#45;&gt;</span></span>
<span>dump_ext:string <span class="arrow">&#45;&gt;</span></span>
<span><span>(<span><a href="#type-info">info</a> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span>
<span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>with_info ~native ~tool_name ~source_file ~output_prefix ~dump_ext k</code> invokes its continuation <code>k</code> with an <code>info</code> structure built from its input, after initializing various global variables. This info structure and the initialized global state are not valid anymore after the continuation returns.</p><p>Due to current implementation limitations in the compiler, it is unsafe to try to compile several distinct compilation units by calling <code>with_info</code> several times.</p></div></div><h3 id="interfaces"><a href="#interfaces" class="anchor"></a>Interfaces</h3><div class="odoc-spec"><div class="spec value anchored" id="val-parse_intf"><a href="#val-parse_intf" class="anchor"></a><code><span><span class="keyword">val</span> parse_intf : <span><a href="#type-info">info</a> <span class="arrow">&#45;&gt;</span></span> <a href="../Parsetree/index.html#type-signature">Parsetree.signature</a></span></code></div><div class="spec-doc"><p><code>parse_intf info</code> parses an interface (usually an <code>.mli</code> file).</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-typecheck_intf"><a href="#val-typecheck_intf" class="anchor"></a><code><span><span class="keyword">val</span> typecheck_intf : <span><a href="#type-info">info</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Parsetree/index.html#type-signature">Parsetree.signature</a> <span class="arrow">&#45;&gt;</span></span> <a href="../Typedtree/index.html#type-signature">Typedtree.signature</a></span></code></div><div class="spec-doc"><p><code>typecheck_intf info parsetree</code> typechecks an interface and returns the typedtree of the associated signature.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-emit_signature"><a href="#val-emit_signature" class="anchor"></a><code><span><span class="keyword">val</span> emit_signature : <span><a href="#type-info">info</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Parsetree/index.html#type-signature">Parsetree.signature</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Typedtree/index.html#type-signature">Typedtree.signature</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>emit_signature info parsetree typedtree</code> emits the <code>.cmi</code> file containing the given signature.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-interface"><a href="#val-interface" class="anchor"></a><code><span><span class="keyword">val</span> interface : <span><a href="#type-info">info</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>The complete compilation pipeline for interfaces.</p></div></div><h3 id="implementations"><a href="#implementations" class="anchor"></a>Implementations</h3><div class="odoc-spec"><div class="spec value anchored" id="val-parse_impl"><a href="#val-parse_impl" class="anchor"></a><code><span><span class="keyword">val</span> parse_impl : <span><a href="#type-info">info</a> <span class="arrow">&#45;&gt;</span></span> <a href="../Parsetree/index.html#type-structure">Parsetree.structure</a></span></code></div><div class="spec-doc"><p><code>parse_impl info</code> parses an implementation (usually an <code>.ml</code> file).</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-typecheck_impl"><a href="#val-typecheck_impl" class="anchor"></a><code><span><span class="keyword">val</span> typecheck_impl : <span><a href="#type-info">info</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Parsetree/index.html#type-structure">Parsetree.structure</a> <span class="arrow">&#45;&gt;</span></span> <a href="../Typedtree/index.html#type-implementation">Typedtree.implementation</a></span></code></div><div class="spec-doc"><p><code>typecheck_impl info parsetree</code> typechecks an implementation and returns the typedtree of the associated module, its public interface, and a coercion against that public interface.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-implementation"><a href="#val-implementation" class="anchor"></a><code><span><span class="keyword">val</span> implementation :
<span><a href="#type-info">info</a> <span class="arrow">&#45;&gt;</span></span>
<span>backend:<span>(<span><a href="#type-info">info</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Typedtree/index.html#type-implementation">Typedtree.implementation</a> <span class="arrow">&#45;&gt;</span></span> unit)</span> <span class="arrow">&#45;&gt;</span></span>
unit</span></code></div><div class="spec-doc"><p>The complete compilation pipeline for implementations.</p></div></div><h3 id="build-artifacts"><a href="#build-artifacts" class="anchor"></a>Build artifacts</h3><div class="odoc-spec"><div class="spec value anchored" id="val-cmo"><a href="#val-cmo" class="anchor"></a><code><span><span class="keyword">val</span> cmo : <span><a href="#type-info">info</a> <span class="arrow">&#45;&gt;</span></span> string</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-cmx"><a href="#val-cmx" class="anchor"></a><code><span><span class="keyword">val</span> cmx : <span><a href="#type-info">info</a> <span class="arrow">&#45;&gt;</span></span> string</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-obj"><a href="#val-obj" class="anchor"></a><code><span><span class="keyword">val</span> obj : <span><a href="#type-info">info</a> <span class="arrow">&#45;&gt;</span></span> string</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-annot"><a href="#val-annot" class="anchor"></a><code><span><span class="keyword">val</span> annot : <span><a href="#type-info">info</a> <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p>Return the filename of some compiler build artifacts associated with the file being compiled.</p></div></div></div></body></html>