<ulclass="crumbs"><li><ahref="../index.html">Home</a></li><li><ahref="../inform7n.html">Inform7</a></li><li><ahref="index.html">assertions</a></li><li><ahref="index.html#P">Preliminaries</a></li><li><b>What This Module Does</b></li></ul></div>
<ulclass="toc"><li><ahref="P-wtmd.html#SP1">§1. Prerequisites</a></li><li><ahref="P-wtmd.html#SP2">§2. Assertions</a></li><li><ahref="P-wtmd.html#SP4">§4. Special meanings</a></li><li><ahref="P-wtmd.html#SP5">§5. Regular meanings</a></li><li><ahref="P-wtmd.html#SP6">§6. Imperative definitions</a></li><li><ahref="P-wtmd.html#SP7">§7. Other gadgets</a></li><li><ahref="P-wtmd.html#SP8">§8. Making use of the calculus module</a></li></ul><hrclass="tocbar">
<pclass="commentary firstcommentary"><aid="SP1"class="paragraph-anchor"></a><b>§1. Prerequisites. </b>The assertions module is a part of the Inform compiler toolset. It is
presented as a literate program or "web". Before diving in:
full details, but essentially: it's C without predeclarations or header files,
and where functions have names like <spanclass="extract"><spanclass="extract-syntax">Tags::add_by_name</span></span> rather than just <spanclass="extract"><spanclass="extract-syntax">add_by_name</span></span>.
<pclass="commentary firstcommentary"><aid="SP2"class="paragraph-anchor"></a><b>§2. Assertions. </b>This module's task is to read the declarative sentences in the source text,
such as "Mrs Jones is wearing a trilby hat" or "Brightness is a kind of value",
which assert that something is true. These are converted into propositions
in predicate calculus, which are sent in a stream to the <ahref="../knowledge-module/index.html"class="internal">knowledge</a> module.
Those propositions may be mutually inconsistent, or not even be self-consistent
or meaningful: but that is for <ahref="../knowledge-module/index.html"class="internal">knowledge</a> to worry about. Our task is just
to provide a list of supposedly true statements.
</p>
<pclass="commentary">Between the <ahref="../linguistics-module/index.html"class="internal">linguistics</a> and <ahref="../calculus-module/index.html"class="internal">calculus</a> modules we have extensive
equipment for parsing regular sentences already, so it would seem simple
to act on a sentence like "Mr Herries knows Howarth." And so it would be if
people called "Mr Herries" and "Howarth" were already known to exist.
Unfortunately, this may be the first mention of them, and that makes things
much more complicated.
</p>
<pclass="commentary">Even if they do exist, they may be referred to ambiguously. If there are
two different people both called Kassava, who is meant by "Carter knows
Kassava"? This depends on context: see <ahref="4-nr.html"class="internal">Name Resolution</a>.
</p>
<pclass="commentary">Though it is rather under-developed at present, Inform also has minimal
support for "anaphora", that is, for cross-references between sentences using
pronouns such as "it". See <ahref="2-ar.html"class="internal">Anaphoric References</a>, but don't expect much.
</p>
<pclass="commentary firstcommentary"><aid="SP3"class="paragraph-anchor"></a><b>§3. </b>So, then, top-level declarations are dealt with like so:
<ulclass="items"><li>● The tree is subdivided into <ahref="../runtime-module/2-cu.html"class="internal">Compilation Units (in runtime)</a>. The project's own
source text is one unit, as is each extension used.
</li><li>● A minimal set of kinds, such as "number", verbs, such as "to mean", relations,
such as "meaning", and so on, is created. See in particular <ahref="2-bv.html"class="internal">Booting Verbs (in assertions)</a>.
</li><li>● Three passes are made through the "major nodes" of the parse tree, meaning,
assertion sentences and top-level declarations of structures such as tables,
equations and rules. See <ahref="2-ptmn.html"class="internal">Passes through Major Nodes</a>.
<ulclass="items"><li>(0) During the "pre-pass" names of tables and other top-level structures are
recorded, and sentences are classified by <ahref="2-cs.html#SP3"class="internal">Classifying::sentence</a>. This is
done by asking the <ahref="../linguistics-module/index.html"class="internal">linguistics</a> module to diagram them and determine whether
the meaning is "regular" — a typical sentence asserting some relationship,
such as "the ball is on the table" — or "special" — a sentence with some
other purpose, such as "Test ... with ...", often but not always written in
the imperative.
</li><li>(1) During "pass 1", noun phrases in these assertion sentences are understood,
which may involve creating new instances or other values. For example, the
sentence "The fedora hat is on the can of Ubuntu cola" may cause new instances
"fedora hat" and "can of Ubuntu cola" to be created. This process is called
"refinement": see <ahref="4-rpt.html"class="internal">Refine Parse Tree</a>, which calls <ahref="4-tc.html"class="internal">The Creator</a> to bring
things into being.<supid="fnref:1"><ahref="#fn:1"rel="footnote">1</a></sup> The function <ahref="4-ass.html#SP6"class="internal">Assertions::make_coupling</a> is then
called to draw out information from this pairing of values.
</li><li>(2) During "pass 2", <ahref="4-ass.html#SP6"class="internal">Assertions::make_coupling</a> is again called, and this
time is able to draw out relationships between values: for example, that the
<ulclass="footnotetexts"><liclass="footnote"id="fn:1"><pclass="inwebfootnote"><supid="fnref:1"><ahref="#fn:1"rel="footnote">1</a></sup> There really is an Ubuntu cola; it's a fair-trade product which it amuses my
more Linux-aware students to drink.
<ahref="#fnref:1"title="return to text">↩</a></p></li></ul>
<pclass="commentary firstcommentary"><aid="SP4"class="paragraph-anchor"></a><b>§4. Special meanings. </b>In the same way that programming languages have a few "reserved words" which
cue up built-in language features, even though they may look like user-defined
functions or variables, Inform has a few verbs with "special meanings", which
make requests directly to the compiler. These occupy <ahref="3-dlr.html"class="internal">Chapter 3: Requests</a>, which is
really just a catalogue of ways to ask for things.
</p>
<pclass="commentary">All that we do is parse such sentences and then make a call to some
appropriate function, usually in one of the other modules. For example, the
section <ahref="3-nar.html"class="internal">New Activity Requests</a> dismantles sentences like "Counting is an
<pclass="commentary firstcommentary"><aid="SP5"class="paragraph-anchor"></a><b>§5. Regular meanings. </b>As noted above, <ahref="4-ass.html#SP6"class="internal">Assertions::make_coupling</a> is called on each regular
<pclass="commentary firstcommentary"><aid="SP6"class="paragraph-anchor"></a><b>§6. Imperative definitions. </b>At the top level, Inform source text consists of more than just assertion
sentences: other constructions are made with different syntaxes. The most
obvious of these are "imperative definitions", which are lists of instructions
for what to do in different circumstances. They take the form
<pclass="commentary">The preamble is parsed into an <ahref="5-id.html#SP1"class="internal">imperative_defn</a>, which falls into one of
a small range of <ahref="5-idf.html"class="internal">Imperative Definition Families</a>: the most important being
the <ahref="5-rf.html"class="internal">Rule Family</a>, for interactive-fiction-style rules, and <ahref="5-tpf.html"class="internal">To Phrase Family</a>,
for declaring new "To..." phrases. Each definition is eventually joined to an
<pclass="commentary"><ahref="6-rls.html"class="internal">Rules</a> need more infrastructure, since they must live inside <ahref="6-rlb.html"class="internal">Rulebooks</a>
to take effect. Rulebooks contain <ahref="6-bl.html"class="internal">Booking Lists</a> of <ahref="6-rb.html"class="internal">Rule Bookings</a> to
hold these; it all takes some juggling because of the features Inform has to
allow authors to move rules around or customise their applicability. Finally,
we introduce <ahref="6-act.html"class="internal">Activities</a>, which are really just triplets of related rulebooks.
</p>
<pclass="commentary firstcommentary"><aid="SP7"class="paragraph-anchor"></a><b>§7. Other gadgets. </b>And there are a few other constructions, too. Actions are left to <ahref="../if-module/4-ap.html"class="internal">Actions Plugin (in if)</a>,
but even Basic Inform has <ahref="7-tbl.html"class="internal">Tables</a> (and their <ahref="7-tc.html"class="internal">Table Columns</a>), along with
<pclass="commentary firstcommentary"><aid="SP8"class="paragraph-anchor"></a><b>§8. Making use of the calculus module. </b><ahref="8-kpr.html"class="internal">Chapter 8: Predicates</a> simply stocks up our predicate calculus system with some