1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-17 06:24:24 +03:00
inform7/docs/imperative-module/index.html
2020-08-27 15:50:24 +01:00

267 lines
14 KiB
HTML

<html>
<head>
<title>imperative</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">
</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><span class="unlink">imperative</span></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="../codegen-module/index.html">codegen</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">
<ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../compiler.html">Inform7 Modules</a></li><li><b>imperative</b></li></ul>
<p class="purpose">Compiling imperative code inside phrase or rule definitions. This is version 1.</p>
<hr>
<div class="contentspage">
<ul class="chapterlist">
<li>
<p class="chapterentry"><a name="P"></a>
<span class="chaptertitle">Preliminaries</span></p>
<ul class="sectionlist">
<li>
<p class="sectionentry"><a href="P-wtmd.html">
<spon class="sectiontitle">What This Module Does</span></a> -
<span class="sectionpurpose">An overview of the imperative module's role and abilities.</span></p>
</li>
</ul>
</li>
<li>
<p class="chapterentry"><a name="1"></a>
<span class="chaptertitle">Chapter 1: Configuration and Control</span></p>
<ul class="sectionlist">
<li>
<p class="sectionentry"><a href="1-im.html">
<spon class="sectiontitle">Imperative Module</span></a> -
<span class="sectionpurpose">Setting up the use of this module.</span></p>
</li>
</ul>
</li>
<li>
<p class="chapterentry"><a name="2"></a>
<span class="chaptertitle">Chapter 2: Compiling from Propositions</span></p>
<ul class="sectionlist">
<li>
<p class="sectionentry"><a href="2-cfs.html">
<spon class="sectiontitle">Compiling from Specifications</span></a> -
<span class="sectionpurpose">To compile specifications into Inform 6 values, conditions or void expressions.</span></p>
</li>
<li>
<p class="sectionentry"><a href="2-ca.html">
<spon class="sectiontitle">Compile Atoms</span></a> -
<span class="sectionpurpose">In this section, given an atom of a proposition we compile I6 code as required for any of three possible outcomes: (i) to test whether it is true, (ii) to make it henceforth true, or (iii) to make it henceforth false.</span></p>
</li>
<li>
<p class="sectionentry"><a href="2-dtd.html">
<spon class="sectiontitle">Deciding to Defer</span></a> -
<span class="sectionpurpose">To decide whether a proposition can be compiled immediately, in the body of the current routine, or whether it must be deferred to a routine of its own, which is called from the current routine.</span></p>
</li>
<li>
<p class="sectionentry"><a href="2-cad.html">
<spon class="sectiontitle">Cinders and Deferrals</span></a> -
<span class="sectionpurpose">To compile terms, having carefully preserved any constants which might have been lost in the process of deferring a proposition (such tricky constants being called "cinders").</span></p>
</li>
<li>
<p class="sectionentry"><a href="2-cdp.html">
<spon class="sectiontitle">Compile Deferred Propositions</span></a> -
<span class="sectionpurpose">To compile the I6 routines needed to perform the tests or tasks deferred as being too difficult in their original contexts.</span></p>
</li>
</ul>
</li>
<li>
<p class="chapterentry"><a name="3"></a>
<span class="chaptertitle">Chapter 3: Phrases</span></p>
<p class="chapterpurpose">In which rules, To... phrases (and similar explicit instructions to do with specific changes in the world) have their preambles parsed and their premisses worked out, and are then collected together into rulebooks, before being compiled as a great mass of Inform 6 routines and arrays.</p>
<ul class="sectionlist">
<li>
<p class="sectionentry"><a href="3-itp.html">
<spon class="sectiontitle">Introduction to Phrases</span></a> -
<span class="sectionpurpose">An exposition of the data structures used inside Inform to hold phrases, rules and rulebooks.</span></p>
</li>
<li>
<p class="sectionentry"><a href="3-rs.html">
<spon class="sectiontitle">Rule Subtrees</span></a> -
<span class="sectionpurpose">To tidy up invocation nodes into a list of children under the relevant rule node, and so turn each rule definition into a single subtree.</span></p>
</li>
<li>
<p class="sectionentry"><a href="3-cs.html">
<spon class="sectiontitle">Construction Sequence</span></a> -
<span class="sectionpurpose">To deal with all the |.i6t| interpreted commands which bring about the compilation of phrases, and to ensure that they are used in the correct order.</span></p>
</li>
<li>
<p class="sectionentry"><a href="3-phr.html">
<spon class="sectiontitle">Phrases</span></a> -
<span class="sectionpurpose">To create one |phrase| object for each phrase declaration in the source text.</span></p>
</li>
<li>
<p class="sectionentry"><a href="3-pu.html">
<spon class="sectiontitle">Phrase Usage</span></a> -
<span class="sectionpurpose">To parse the preamble of a phrase declaration to a phrase usage (PHUD) structure containing a mostly textual representation of the conditions for its usage.</span></p>
</li>
<li>
<p class="sectionentry"><a href="3-prcd.html">
<spon class="sectiontitle">Phrase Runtime Context Data</span></a> -
<span class="sectionpurpose">To store the circumstances in which a rule phrase should fire.</span></p>
</li>
<li>
<p class="sectionentry"><a href="3-ptd.html">
<spon class="sectiontitle">Phrase Type Data</span></a> -
<span class="sectionpurpose">To create, manage, compare the logical specificity of, and assist excerpt parsing concerning, the type of a To phrase. This involves whether it is void, determines a condition or returns a value (and if so, what kind of value); and also what parameters it takes (possibly values, possible other types used by inline definitions) and their types in turn.</span></p>
</li>
<li>
<p class="sectionentry"><a href="3-dptd.html">
<spon class="sectiontitle">Describing Phrase Type Data</span></a> -
<span class="sectionpurpose">To convert phrase type data to and from text.</span></p>
</li>
<li>
<p class="sectionentry"><a href="3-po.html">
<spon class="sectiontitle">Phrase Options</span></a> -
<span class="sectionpurpose">To create and subsequently parse against the list of phrase options with which the user can choose to invoke a To phrase.</span></p>
</li>
<li>
<p class="sectionentry"><a href="3-pav.html">
<spon class="sectiontitle">Phrases as Values</span></a> -
<span class="sectionpurpose">To provide the names of phrases as first-class values.</span></p>
</li>
<li>
<p class="sectionentry"><a href="3-tph.html">
<spon class="sectiontitle">To Phrases</span></a> -
<span class="sectionpurpose">To manage the sorting of To... phrases in logical precedence order, and keep track of which kinds they are being applied to.</span></p>
</li>
<li>
<p class="sectionentry"><a href="3-tp.html">
<spon class="sectiontitle">Timed Phrases</span></a> -
<span class="sectionpurpose">Another way phrases can be invoked is as timed events, which need no special Inform data structure and are simply compiled into a pair of timetable I6 arrays to be processed at run-time.</span></p>
</li>
<li>
<p class="sectionentry"><a href="3-pi.html">
<spon class="sectiontitle">Phrasebook Index</span></a> -
<span class="sectionpurpose">To compile most of the HTML page for the Phrasebook index.</span></p>
</li>
</ul>
</li>
<li>
<p class="chapterentry"><a name="4"></a>
<span class="chaptertitle">Chapter 4: Compilation Context</span></p>
<p class="chapterpurpose">Preparing a context at run-time in which code can be executed: creating local variables, and so on.</p>
<ul class="sectionlist">
<li>
<p class="sectionentry"><a href="4-lv.html">
<spon class="sectiontitle">Local Variables</span></a> -
<span class="sectionpurpose">Local variables are used for call parameters, temporary values, and other ephemeral workspace.</span></p>
</li>
<li>
<p class="sectionentry"><a href="4-pb.html">
<spon class="sectiontitle">Phrase Blocks</span></a> -
<span class="sectionpurpose">Blocks of code are used to give conditionals and loops greater scope, as in more traditional programming languages.</span></p>
</li>
<li>
<p class="sectionentry"><a href="4-sf.html">
<spon class="sectiontitle">Stack Frames</span></a> -
<span class="sectionpurpose">When Inform compiles phrase invocations, or implied forms of these such as text substitutions, it does so in the context of a "stack frame". This provides for local "let" values, manages loop blocks, and in general looks after any information shared between a whole sequence of invocations.</span></p>
</li>
<li>
<p class="sectionentry"><a href="4-chr.html">
<spon class="sectiontitle">Chronology</span></a> -
<span class="sectionpurpose">To keep track of the state of things so that it will be possible in future to ask questions concerning the past.</span></p>
</li>
</ul>
</li>
<li>
<p class="chapterentry"><a name="5"></a>
<span class="chaptertitle">Chapter 5: Compilation</span></p>
<p class="chapterpurpose">Generating code to perform individual phrases.</p>
<ul class="sectionlist">
<li>
<p class="sectionentry"><a href="5-inv.html">
<spon class="sectiontitle">Invocations</span></a> -
<span class="sectionpurpose">Specifications which ask to use a phrase (which are "phrasal") indicate which phrase they intend by means of a list of "invocations". This list goes on to record the outcome of type-checking and provides instructions for code generation, as we see here.</span></p>
</li>
<li>
<p class="sectionentry"><a href="5-pi.html">
<spon class="sectiontitle">Parse Invocations</span></a> -
<span class="sectionpurpose">To register phrases with the excerpt parser, and to provide the excerpt parser with help in putting invocations together.</span></p>
</li>
<li>
<p class="sectionentry"><a href="5-ci.html">
<spon class="sectiontitle">Compile Invocations</span></a> -
<span class="sectionpurpose">Here we generate Inform 6 code to execute the phrase(s) called for by an invocation list.</span></p>
</li>
<li>
<p class="sectionentry"><a href="5-ciac.html">
<spon class="sectiontitle">Compile Invocations As Calls</span></a> -
<span class="sectionpurpose">Here we generate Inform 6 code to execute the phrase(s) called for by an invocation list.</span></p>
</li>
<li>
<p class="sectionentry"><a href="5-cii.html">
<spon class="sectiontitle">Compile Invocations Inline</span></a> -
<span class="sectionpurpose">Here we generate Inform 6 code to execute the phrase(s) called for by an invocation list.</span></p>
</li>
<li>
<p class="sectionentry"><a href="5-cp.html">
<spon class="sectiontitle">Compile Phrases</span></a> -
<span class="sectionpurpose">Phrases defined with a list of invocations, rather than inline, have to be compiled to I6 routines, and this is where we organise that.</span></p>
</li>
<li>
<p class="sectionentry"><a href="5-ca.html">
<spon class="sectiontitle">Compile Arithmetic</span></a> -
<span class="sectionpurpose">To compile code performing an arithmetic operation.</span></p>
</li>
</ul>
</li>
</ul>
</div>
<hr>
<p class="purpose">Powered by <a href="https://github.com/ganelson/inweb">Inweb</a>.</p>
</main>
</body>
</html>