<spanclass="sectionpurpose">Rules contain imperative code which is executed when certain actions, activities or other processes are being followed.</span></p>
<spanclass="sectionpurpose">To permit variables to have scopes intermediate between local and global: for example, to be shared by all rules in a given rulebook.</span></p>
<spanclass="sectionpurpose">To create and manage activities, which are action-like bundles of rules controlling how the I6 runtime code carries out tasks such as "printing the name of something". Each has its own page in the I7 documentation. An activity list is a disjunction of actitivies.</span></p>
<pclass="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>
<ulclass="sectionlist">
<li>
<pclass="sectionentry"><ahref="3-itp.html">
<sponclass="sectiontitle">Introduction to Phrases</span></a> -
<spanclass="sectionpurpose">An exposition of the data structures used inside Inform to hold phrases, rules and rulebooks.</span></p>
<spanclass="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>
<spanclass="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>
<pclass="sectionentry"><ahref="3-phr.html">
<sponclass="sectiontitle">Phrases</span></a> -
<spanclass="sectionpurpose">To create one |phrase| object for each phrase declaration in the source text.</span></p>
<spanclass="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>
<spanclass="sectionpurpose">To store the circumstances in which a rule phrase should fire.</span></p>
</li>
<li>
<pclass="sectionentry"><ahref="3-ptd.html">
<sponclass="sectiontitle">Phrase Type Data</span></a> -
<spanclass="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>
<pclass="sectionentry"><ahref="3-dptd.html">
<sponclass="sectiontitle">Describing Phrase Type Data</span></a> -
<spanclass="sectionpurpose">To convert phrase type data to and from text.</span></p>
<spanclass="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>
<pclass="sectionentry"><ahref="3-pav.html">
<sponclass="sectiontitle">Phrases as Values</span></a> -
<spanclass="sectionpurpose">To provide the names of phrases as first-class values.</span></p>
</li>
<li>
<pclass="sectionentry"><ahref="3-tph.html">
<sponclass="sectiontitle">To Phrases</span></a> -
<spanclass="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>
<spanclass="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>
<spanclass="sectionpurpose">Blocks of code are used to give conditionals and loops greater scope, as in more traditional programming languages.</span></p>
<spanclass="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>
<pclass="sectionentry"><ahref="4-chr.html">
<sponclass="sectiontitle">Chronology</span></a> -
<spanclass="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>
<spanclass="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>
<pclass="sectionentry"><ahref="5-dtd.html">
<sponclass="sectiontitle">Deciding to Defer</span></a> -
<spanclass="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>
<pclass="sectionentry"><ahref="5-cad.html">
<sponclass="sectiontitle">Cinders and Deferrals</span></a> -
<spanclass="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>
<spanclass="sectionpurpose">To compile the I6 routines needed to perform the tests or tasks deferred as being too difficult in their original contexts.</span></p>
<spanclass="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>
<spanclass="sectionpurpose">To register phrases with the excerpt parser, and to provide the excerpt parser with help in putting invocations together.</span></p>
<spanclass="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>