mirror of
https://github.com/ganelson/inform.git
synced 2024-07-05 08:34:22 +03:00
203 lines
14 KiB
HTML
203 lines
14 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<head>
|
|
<title>Using Inter</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">
|
|
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
|
|
<link href="../docs-assets/ConsoleText-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="index.html"><span class="selectedlink">inter</span></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="../building-module/index.html">building</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 'Using Inter' generated by Inweb-->
|
|
<div class="breadcrumbs">
|
|
<ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../compiler.html">Compiler Tools</a></li><li><a href="index.html">inter</a></li><li><a href="index.html#M">Manual</a></li><li><b>Using Inter</b></li></ul></div>
|
|
<p class="purpose">Using Inter at the command line.</p>
|
|
|
|
<ul class="toc"><li><a href="M-ui.html#SP1">§1. What Inter does</a></li><li><a href="M-ui.html#SP2">§2. Command-line usage</a></li><li><a href="M-ui.html#SP5">§5. Assimilation</a></li></ul><hr class="tocbar">
|
|
|
|
<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>§1. What Inter does. </b>The command-line executable Inter packages up the back end of the Inform 7
|
|
compiler into a stand-alone tool, and enables that back end to be used more
|
|
flexibly. For example, it can read or write either textual or binary inter
|
|
code, and can convert between them. It can also perform any of the numerous
|
|
code-generation stages on the code it reads, in any sequence. In short, it
|
|
aims to be a Swiss Army knife for inter code.
|
|
</p>
|
|
|
|
<p class="commentary">Because of that, it's possible to test code-generation stages individually:
|
|
we can read in some inter code from a text file, perform a single stage on
|
|
it, and write it out as text again. This gives us a very helpful window into
|
|
what Inform is doing; it also provides a test-bed for future optimisation,
|
|
or for future applications of inter code.
|
|
</p>
|
|
|
|
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>§2. Command-line usage. </b>If you have compiled the standard distribution of the command-line tools
|
|
for Inform then the Inter executable will be at <span class="extract"><span class="extract-syntax">inter/Tangled/inter</span></span>.
|
|
</p>
|
|
|
|
<p class="commentary">Inter has three basic modes. In the first, the command line specifies only
|
|
a single file:
|
|
</p>
|
|
|
|
<pre class="ConsoleText-displayed-code all-displayed-code code-font">
|
|
<span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-element-syntax">$</span><span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-function-syntax">inter/Tangled/inter</span><span class="ConsoleText-plain-syntax"> INTERFILE</span>
|
|
</pre>
|
|
<p class="commentary">Inter simply verifies this file for correctness: that is, to see if the inter
|
|
code supplied conforms to the inter specification. It returns the exit code 0
|
|
if all is well, and issues error messages and returns 1 if not.
|
|
</p>
|
|
|
|
<p class="commentary">Such files can be in either textual or binary form, and Inter automatically
|
|
detects which by looking at their contents. (Conventionally, such files
|
|
have the filename extension <span class="extract"><span class="ConsoleText-extract-syntax">.intert</span></span> or <span class="extract"><span class="ConsoleText-extract-syntax">.interb</span></span> respectively, but that's
|
|
not how Inter decides.)
|
|
</p>
|
|
|
|
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>§3. </b>In the second mode, Inter converts from textual to binary form or vice
|
|
versa. The option <span class="extract"><span class="ConsoleText-extract-syntax">-binary X</span></span> writes a binary form of the inter to file <span class="extract"><span class="ConsoleText-extract-syntax">X</span></span>,
|
|
and <span class="extract"><span class="ConsoleText-extract-syntax">-textual X</span></span> writes a text form. So, for example,
|
|
</p>
|
|
|
|
<pre class="ConsoleText-displayed-code all-displayed-code code-font">
|
|
<span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-element-syntax">$</span><span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-function-syntax">inter/Tangled/inter</span><span class="ConsoleText-plain-syntax"> my.intert</span><span class="ConsoleText-identifier-syntax"> -binary</span><span class="ConsoleText-plain-syntax"> my.interb</span>
|
|
</pre>
|
|
<p class="commentary">converts <span class="extract"><span class="ConsoleText-extract-syntax">my.intert</span></span> (a textual inter file) to its binary equivalent
|
|
<span class="extract"><span class="ConsoleText-extract-syntax">my.interb</span></span>, and conversely:
|
|
</p>
|
|
|
|
<pre class="ConsoleText-displayed-code all-displayed-code code-font">
|
|
<span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-element-syntax">$</span><span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-function-syntax">inter/Tangled/inter</span><span class="ConsoleText-plain-syntax"> my.interb</span><span class="ConsoleText-identifier-syntax"> -textual</span><span class="ConsoleText-plain-syntax"> my.intert</span>
|
|
</pre>
|
|
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>§4. </b>In the third and most flexible mode, Inter runs the supplied code through
|
|
a pipeline of processing stages. The pipeline, which must contain at least
|
|
one stage, can be quite elaborate (see later), but for example:
|
|
</p>
|
|
|
|
<pre class="displayed-code all-displayed-code code-font">
|
|
<span class="plain-syntax"> read </span><span class="reserved-syntax"><-</span><span class="plain-syntax"> myfile.inter, resolve-conditional-compilation, generate inform6 </span><span class="reserved-syntax">-></span><span class="plain-syntax"> myfile.i6</span>
|
|
</pre>
|
|
<p class="commentary">is a valid three-stage pipeline. The command to do this is then:
|
|
</p>
|
|
|
|
<pre class="ConsoleText-displayed-code all-displayed-code code-font">
|
|
<span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-element-syntax">$</span><span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-function-syntax">inter/Tangled/inter</span><span class="ConsoleText-identifier-syntax"> -pipeline-text</span><span class="ConsoleText-plain-syntax"> 'PIPELINE'</span>
|
|
</pre>
|
|
<p class="commentary">where <span class="extract"><span class="ConsoleText-extract-syntax">PIPELINE</span></span> is a textual description like the one above. In practice,
|
|
it may not be convenient to spell the pipeline out on the command line, so
|
|
one can also put it into a text file:
|
|
</p>
|
|
|
|
<pre class="ConsoleText-displayed-code all-displayed-code code-font">
|
|
<span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-element-syntax">$</span><span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-function-syntax">inter/Tangled/inter</span><span class="ConsoleText-identifier-syntax"> -pipeline-file</span><span class="ConsoleText-plain-syntax"> mypl.interpipeline</span>
|
|
</pre>
|
|
<p class="commentary">Pipelines can contain variables, and their values can be set at the command
|
|
line with e.g.:
|
|
</p>
|
|
|
|
<pre class="displayed-code all-displayed-code code-font">
|
|
<span class="plain-syntax"> -variable '*out=myfile.i6'</span>
|
|
</pre>
|
|
<p class="commentary">It is also possible to set the default directory for reading and writing files:
|
|
</p>
|
|
|
|
<pre class="displayed-code all-displayed-code code-font">
|
|
<span class="plain-syntax"> -domain D</span>
|
|
</pre>
|
|
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>§5. Assimilation. </b>Inform makes use of what are called "kits" of pre-compiled Inter code:
|
|
for example, <span class="extract"><span class="extract-syntax">CommandParserKit</span></span> contains code for the traditional interactive
|
|
fiction command parser. For speed, Inter loads these as binary Inter, but
|
|
that means they have to be compiled from time to time. This is called
|
|
"assimilation".
|
|
</p>
|
|
|
|
<p class="commentary">The source code for these could in priniple be textual Inter, but that's too
|
|
verbose to write comfortably. In practice we use Inform 6 code as a notation,
|
|
and therefore assimilation is really a cross-compilation from I6 to Inter.
|
|
</p>
|
|
|
|
<p class="commentary">Kits are like so-called "fat binaries", in that they contain binary Inter
|
|
for each different architecture with which they are compatible. Inter can
|
|
build kits for only one architecture at a time, so a command must specify
|
|
which is wanted. For example:
|
|
</p>
|
|
|
|
<pre class="ConsoleText-displayed-code all-displayed-code code-font">
|
|
<span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-element-syntax">$</span><span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-function-syntax">inter/Tangled/inter</span><span class="ConsoleText-identifier-syntax"> -architecture</span><span class="ConsoleText-plain-syntax"> 16</span><span class="ConsoleText-identifier-syntax"> -build-kit</span><span class="ConsoleText-plain-syntax"> K</span>
|
|
<span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-element-syntax">$</span><span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-function-syntax">inter/Tangled/inter</span><span class="ConsoleText-identifier-syntax"> -architecture</span><span class="ConsoleText-plain-syntax"> 32d</span><span class="ConsoleText-identifier-syntax"> -build-kit</span><span class="ConsoleText-plain-syntax"> K</span>
|
|
</pre>
|
|
<p class="commentary">Incrementally building kits as needed could be done with something like
|
|
the Unix tool <span class="extract"><span class="ConsoleText-extract-syntax">make</span></span>, but in fact Inbuild has this ability: the command
|
|
</p>
|
|
|
|
<pre class="ConsoleText-displayed-code all-displayed-code code-font">
|
|
<span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-element-syntax">$</span><span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-function-syntax">inbuild/Tangled/inbuild</span><span class="ConsoleText-identifier-syntax"> -build</span><span class="ConsoleText-plain-syntax"> K</span>
|
|
</pre>
|
|
<p class="commentary">looks at the kit, works out which architectures need rebuilding, and
|
|
then issues commands like the above to instruct <span class="extract"><span class="ConsoleText-extract-syntax">inter</span></span> to do so. Indeed,
|
|
multiple kits can be managed with a single command:
|
|
</p>
|
|
|
|
<pre class="ConsoleText-displayed-code all-displayed-code code-font">
|
|
<span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-element-syntax">$</span><span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-function-syntax">inbuild/Tangled/inbuild</span><span class="ConsoleText-identifier-syntax"> -build -contents-of</span><span class="ConsoleText-plain-syntax"> inform7/Internal/Inter</span>
|
|
</pre>
|
|
<nav role="progress"><div class="progresscontainer">
|
|
<ul class="progressbar"><li class="progressprevoff">❮</li><li class="progresscurrentchapter">M</li><li class="progresscurrent">ui</li><li class="progresssection"><a href="M-ti.html">ti</a></li><li class="progresssection"><a href="M-dpiti.html">dpiti</a></li><li class="progresssection"><a href="M-cpiti.html">cpiti</a></li><li class="progresssection"><a href="M-ip.html">ip</a></li><li class="progresssection"><a href="M-ia.html">ia</a></li><li class="progresssection"><a href="M-io.html">io</a></li><li class="progresssection"><a href="M-pas.html">pas</a></li><li class="progresssection"><a href="M-rc.html">rc</a></li><li class="progresschapter"><a href="1-mn.html">1</a></li><li class="progressnext"><a href="M-ti.html">❯</a></li></ul></div>
|
|
</nav><!--End of weave-->
|
|
|
|
</main>
|
|
</body>
|
|
</html>
|
|
|