mirror of
https://github.com/ganelson/inform.git
synced 2024-07-08 10:04:21 +03:00
209 lines
15 KiB
HTML
209 lines
15 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<head>
|
|
<title>What This Module Does</title>
|
|
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
|
|
<meta name="viewport" content="width=device-width initial-scale=1">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<meta http-equiv="Content-Language" content="en-gb">
|
|
|
|
<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
|
|
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
|
|
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
|
|
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
|
|
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
|
|
<script src="http://code.jquery.com/jquery-1.12.4.min.js"
|
|
integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
|
|
|
|
<script src="../docs-assets/Bigfoot.js"></script>
|
|
<link href="../docs-assets/Bigfoot.css" rel="stylesheet" rev="stylesheet" type="text/css">
|
|
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
|
|
|
|
</head>
|
|
<body class="commentary-font">
|
|
<nav role="navigation">
|
|
<h1><a href="../index.html">
|
|
<img src="../docs-assets/Inform.png" height=72">
|
|
</a></h1>
|
|
<ul><li><a href="../compiler.html">compiler tools</a></li>
|
|
<li><a href="../other.html">other tools</a></li>
|
|
<li><a href="../extensions.html">extensions and kits</a></li>
|
|
<li><a href="../units.html">unit test tools</a></li>
|
|
</ul><h2>Compiler Webs</h2><ul>
|
|
<li><a href="../inbuild/index.html">inbuild</a></li>
|
|
<li><a href="../inform7/index.html">inform7</a></li>
|
|
<li><a href="../inter/index.html">inter</a></li>
|
|
</ul><h2>Inbuild Modules</h2><ul>
|
|
<li><a href="../supervisor-module/index.html">supervisor</a></li>
|
|
</ul><h2>Inform7 Modules</h2><ul>
|
|
<li><a href="../core-module/index.html">core</a></li>
|
|
<li><a href="../assertions-module/index.html">assertions</a></li>
|
|
<li><a href="../values-module/index.html">values</a></li>
|
|
<li><a href="../knowledge-module/index.html">knowledge</a></li>
|
|
<li><a href="../imperative-module/index.html">imperative</a></li>
|
|
<li><a href="../runtime-module/index.html">runtime</a></li>
|
|
<li><a href="../if-module/index.html">if</a></li>
|
|
<li><a href="../multimedia-module/index.html">multimedia</a></li>
|
|
<li><a href="../index-module/index.html">index</a></li>
|
|
</ul><h2>Inter Modules</h2><ul>
|
|
<li><a href="../bytecode-module/index.html">bytecode</a></li>
|
|
<li><a href="index.html"><span class="selectedlink">building</span></a></li>
|
|
<li><a href="../pipeline-module/index.html">pipeline</a></li>
|
|
<li><a href="../final-module/index.html">final</a></li>
|
|
</ul><h2>Services</h2><ul>
|
|
<li><a href="../arch-module/index.html">arch</a></li>
|
|
<li><a href="../calculus-module/index.html">calculus</a></li>
|
|
<li><a href="../html-module/index.html">html</a></li>
|
|
<li><a href="../inflections-module/index.html">inflections</a></li>
|
|
<li><a href="../kinds-module/index.html">kinds</a></li>
|
|
<li><a href="../linguistics-module/index.html">linguistics</a></li>
|
|
<li><a href="../problems-module/index.html">problems</a></li>
|
|
<li><a href="../syntax-module/index.html">syntax</a></li>
|
|
<li><a href="../words-module/index.html">words</a></li>
|
|
<li><a href="../../../inweb/docs/foundation-module/index.html">foundation</a></li>
|
|
|
|
</ul>
|
|
</nav>
|
|
<main role="main">
|
|
<!--Weave of 'What This Module Does' generated by Inweb-->
|
|
<div class="breadcrumbs">
|
|
<ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../compiler.html">Inter Modules</a></li><li><a href="index.html">building</a></li><li><a href="index.html#P">Preliminaries</a></li><li><b>What This Module Does</b></li></ul></div>
|
|
<p class="purpose">An overview of the building module's role and abilities.</p>
|
|
|
|
<ul class="toc"><li><a href="P-wtmd.html#SP1">§1. Prerequisites</a></li><li><a href="P-wtmd.html#SP2">§2. Services for builders</a></li><li><a href="P-wtmd.html#SP3">§3. Structural conventions</a></li></ul><hr class="tocbar">
|
|
|
|
<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>§1. Prerequisites. </b>The building module is a part of the Inform compiler toolset. It is
|
|
presented as a literate program or "web". Before diving in:
|
|
</p>
|
|
|
|
<ul class="items"><li>(a) It helps to have some experience of reading webs: see <a href="../../../inweb/docs/index.html" class="internal">inweb</a> for more.
|
|
</li><li>(b) The module is written in C, in fact ANSI C99, but this is disguised by the
|
|
fact that it uses some extension syntaxes provided by the <a href="../../../inweb/docs/index.html" class="internal">inweb</a> literate
|
|
programming tool, making it a dialect of C called InC. See <a href="../../../inweb/docs/index.html" class="internal">inweb</a> for
|
|
full details, but essentially: it's C without predeclarations or header files,
|
|
and where functions have names like <span class="extract"><span class="extract-syntax">Tags::add_by_name</span></span> rather than just <span class="extract"><span class="extract-syntax">add_by_name</span></span>.
|
|
</li><li>(c) This module uses other modules drawn from the <a href="../compiler.html" class="internal">compiler</a>, and also
|
|
uses a module of utility functions called <a href="../../../inweb/docs/foundation-module/index.html" class="internal">foundation</a>.
|
|
For more, see <a href="../../../inweb/docs/foundation-module/P-abgtf.html" class="internal">A Brief Guide to Foundation (in foundation)</a>.
|
|
</li></ul>
|
|
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>§2. Services for builders. </b>This module is essentially middleware. It acts as a bridge to the low-level
|
|
functions in the <a href="../bytecode-module/index.html" class="internal">bytecode</a> module, allowing them to be used with much
|
|
greater ease and consistency.
|
|
</p>
|
|
|
|
<p class="commentary">In particular, the functions here enforce a number of conventions about how an
|
|
Inter tree is laid out. Indiscriminate use of <a href="../bytecode-module/index.html" class="internal">bytecode</a> functions would allow
|
|
other layouts to be made, but we want to be systematic.
|
|
</p>
|
|
|
|
<p class="commentary">This module needs plenty of working data, and stashes that data inside the
|
|
<span class="extract"><span class="extract-syntax">inter_tree</span></span> structure it is working on: in a compoment of that structure called
|
|
a <a href="1-bm.html#SP4" class="internal">building_site</a>. Whereas the main data ih an <span class="extract"><span class="extract-syntax">inter_tree</span></span> affects the meaning
|
|
of the tree, i.e., makes a difference as to what program the tree represents,
|
|
the contents of the <a href="1-bm.html#SP4" class="internal">building_site</a> component are only used to make it, and
|
|
are ignored by the <a href="../final-module/index.html" class="internal">final</a> code-generator.
|
|
</p>
|
|
|
|
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>§3. Structural conventions. </b>An inter tree is fundamentally a set of resources stored in a nested set of
|
|
<span class="extract"><span class="extract-syntax">inter_package</span></span> boxes.
|
|
</p>
|
|
|
|
<ul class="items"><li>● The following resources are stored at the root level (i.e., not inside of
|
|
any package) and nowhere else:
|
|
<ul class="items"><li>● Package type declarations. Inter can support a nearly arbitrary set of
|
|
different package types, and the <a href="../bytecode-module/index.html" class="internal">bytecode</a> functions make no assumptions.
|
|
In <a href="1-pt.html" class="internal">Package Types</a>, however, we //present a single standard set of package
|
|
types used by Inform code.
|
|
</li><li>● Primitive declarations. See <a href="1-ip.html" class="internal">Inter Primitives</a>. Again, Inter can in
|
|
principle support a variety of different "instruction sets", but this module
|
|
presents a single standardised instruction set.
|
|
</li><li>● Compiler pragmas. These are marginal tweaks on a platform-by-platform basis
|
|
and use of them is minimal, but see <a href="1-ls.html#SP15" class="internal">LargeScale::emit_pragma</a>.
|
|
</li></ul>
|
|
<li>● Everything else is inside a single top-level package called <span class="extract"><span class="extract-syntax">main</span></span>, which
|
|
has package type <span class="extract"><span class="extract-syntax">_plain</span></span>.
|
|
</li><li>● <span class="extract"><span class="extract-syntax">main</span></span> contains only packages, and of only two types:
|
|
<ul class="items"><li>● "Modules", which are packages of type <span class="extract"><span class="extract-syntax">_module</span></span>. These occur nowhere else
|
|
in the tree.
|
|
</li><li>● "Linkages", which are packages of type <span class="extract"><span class="extract-syntax">_linkage</span></span>. These occur nowhere else
|
|
in the tree.
|
|
</li></ul>
|
|
<li>● <a href="../inform7/index.html" class="internal">inform7</a> compiles the material in each compilation unit to a module
|
|
named for that unit. That is:
|
|
<ul class="items"><li>● The module <span class="extract"><span class="extract-syntax">source_text</span></span> contains material from the main source text.
|
|
</li><li>● Each extension included produces a module, named, for example,
|
|
<span class="extract"><span class="extract-syntax">locksmith_by_emily_short</span></span>.
|
|
</li></ul>
|
|
<li>● Each kit produces a module, named after it. Any Inter tree produced by
|
|
<a href="../inform7/index.html" class="internal">inform7</a> will always contain the module <span class="extract"><span class="extract-syntax">BasicInformKit</span></span>, for example.
|
|
</li><li>● <a href="../inform7/index.html" class="internal">inform7</a> generates an additional module called <span class="extract"><span class="extract-syntax">generic</span></span>, holding
|
|
generic definitions — material which is the same regardless of what is
|
|
being compiled.
|
|
</li><li>● <a href="../inform7/index.html" class="internal">inform7</a> generates an additional module called <span class="extract"><span class="extract-syntax">completion</span></span>, holding
|
|
resources put together from across different compilation units.<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup>
|
|
</li><li>● <a href="../inter/index.html" class="internal">inter</a> generates an additional module called <span class="extract"><span class="extract-syntax">synoptic</span></span>, made during
|
|
linking, which contains resources collated from or cross-referencing
|
|
everything else.
|
|
</li><li>● Modules contain only further packages, called "submodules" and with the
|
|
package type <span class="extract"><span class="extract-syntax">_submodule</span></span>. The Inform tools use a standard set of names for
|
|
such submodules: for example, in any module the resources defining its
|
|
global variables are in a submodule called <span class="extract"><span class="extract-syntax">variables</span></span>. (If it defines no
|
|
variables, the submodule will not be present.)
|
|
</li><li>● There are just two different linkages — packages with special contents
|
|
and which the linking steps of <a href="../pipeline-module/index.html" class="internal">pipeline</a> treat differently from modules.
|
|
<ul class="items"><li>● <span class="extract"><span class="extract-syntax">architecture</span></span> has no subpackages, and contains only constant definitions,
|
|
drawn from a fixed and limited set. These definitions depend on, and indeed
|
|
express, the target architecture: for example, <span class="extract"><span class="extract-syntax">WORDSIZE</span></span>, the number of
|
|
bytes per word, is defined here. Symbols here behave uniquely in linking:
|
|
when two trees are linked together, they will each have an <span class="extract"><span class="extract-syntax">architecture</span></span>
|
|
package, and symbols in them will simply be identified with each other.
|
|
Thus the <span class="extract"><span class="extract-syntax">WORDSIZE</span></span> defined in the main Inform 7 tree will be considered
|
|
the same symbol as the <span class="extract"><span class="extract-syntax">WORDSIZE</span></span> defined in the tree for BasicInformKit.
|
|
</li><li>● <span class="extract"><span class="extract-syntax">connectors</span></span> has no subpackages and no resources other than symbols.
|
|
It holds plugs and sockets enabling the Inter tree to be linked with other
|
|
Inter trees; during linking, these are removed when their purposes has been
|
|
served, so that after a successful link, <span class="extract"><span class="extract-syntax">connectors</span></span> will always be empty.
|
|
</li></ul>
|
|
</li></ul>
|
|
<p class="commentary">See <a href="1-ls.html" class="internal">Large-Scale Structure</a> for the code which builds all of the above
|
|
packages (though not their contents).
|
|
</p>
|
|
|
|
<ul class="footnotetexts"><li class="footnote" id="fn:1"><p class="inwebfootnote"><sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> Ideally <span class="extract"><span class="extract-syntax">completion</span></span> would not exist, and everything in it would be made
|
|
as part of <span class="extract"><span class="extract-syntax">synoptic</span></span> during linking, but at present this is too difficult.
|
|
<a href="#fnref:1" title="return to text"> ↩</a></p></li></ul>
|
|
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>§4. </b>In particular, Inter code is fundamentally a mass of <span class="extract"><span class="extract-syntax">inter_package</span></span>s, which
|
|
cross-reference each other using <span class="extract"><span class="extract-syntax">inter_symbol</span></span>s. But of course it cannot all
|
|
be made simultaneously. What we need is a more flexible way to describe things
|
|
in the Inter tree: both those which have already been made, and also those
|
|
which are yet to be made. So:
|
|
</p>
|
|
|
|
<pre class="displayed-code all-displayed-code code-font">
|
|
<span class="plain-syntax"> DEFINITELY MADE PERHAPS NOT YET MADE</span>
|
|
<span class="plain-syntax"> PACKAGE inter_package package_request</span>
|
|
<span class="plain-syntax"> SYMBOL inter_symbol inter_name</span>
|
|
</pre>
|
|
<p class="commentary">So, for example, a <a href="1-pck.html#SP2" class="internal">package_request</a> can represent <span class="extract"><span class="extract-syntax">/main/synoptic/kinds</span></span>
|
|
either before or after that package has been built. At some point the package
|
|
ceases to be virtual and comes into being: this is called "incarnation".
|
|
</p>
|
|
|
|
<p class="commentary">And similarly for <a href="1-in.html#SP2" class="internal">inter_name</a>, which it would perhaps be more consistent
|
|
to call a <span class="extract"><span class="extract-syntax">symbol_request</span></span>.
|
|
</p>
|
|
|
|
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>§5. </b>Since what is built by the code in this module is Inter code, which forms up
|
|
into trees, the metaphor should perhaps be "garden", but in fact we call a
|
|
context for making Inter a <a href="1-bm.html#SP4" class="internal">building_site</a>.
|
|
</p>
|
|
|
|
<nav role="progress"><div class="progresscontainer">
|
|
<ul class="progressbar"><li class="progressprevoff">❮</li><li class="progresscurrentchapter">P</li><li class="progresscurrent">wtmd</li><li class="progresschapter"><a href="1-bm.html">1</a></li><li class="progresschapter"><a href="2-is.html">2</a></li><li class="progresschapter"><a href="3-prd.html">3</a></li><li class="progressnext"><a href="1-bm.html">❯</a></li></ul></div>
|
|
</nav><!--End of weave-->
|
|
|
|
</main>
|
|
</body>
|
|
</html>
|
|
|