Compiling imperative code inside phrase or rule definitions. This is version 1.
-
-
What This Module Does - An overview of the imperative module's role and abilities.
-
-
Chapter 1: Configuration and Control
-
Imperative Module - Setting up the use of this module.
-
-
Chapter 2: Rules, Rulebooks and Activities
Rules are named phrases which are invoked in a particular way, and rulebooks a way to organise lists of them.
-
Rules - Rules contain imperative code which is executed when certain actions, activities or other processes are being followed. -
Rule Bookings - Bookings are assignments of rules to rulebooks. -
Booking Lists - Booking lists are linked lists of rule bookings. The content of a rulebook is a booking list. -
Rulebooks - Rulebooks collate rules and provide an organised way for them to collaborate on a larger task. -
Focus and Outcome - What a rulebook works on, and what it produces. -
Activities - To create and manage activities, which are bundles of rules for carrying out tasks.
-
-
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.
-
Introduction to Phrases - An exposition of the data structures used inside Inform to hold phrases, rules and rulebooks. -
Phrase Runtime Context Data - To store the circumstances in which a rule phrase should fire.
-
-
Chapter 4: Compilation Context
Preparing a context at run-time in which code can be executed.
-
Local Variables - Local variables are used for call parameters, temporary values, and other ephemeral workspace. -
Stacked Variables - To permit variables to have scopes intermediate between local and global: for example, to be shared by all rules in a given rulebook. -
Phrase Blocks - Blocks of code are used to give conditionals and loops greater scope, as in more traditional programming languages. -
Stack Frames - 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. -
Chronology - To keep track of the state of things so that it will be possible in future to ask questions concerning the past.
-
-
Chapter 5: Compiling Propositions
Generating code to test or assert propositions from predicate calculus.
-
Compiling from Specifications - To compile specifications into Inform 6 values, conditions or void expressions. -
Emitting from Schemas - Here we emit code from an I6 schema. -
Compile Atoms - 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. -
Deciding to Defer - 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. -
Cinders and Deferrals - 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"). -
Compile Deferred Propositions - To compile the I6 routines needed to perform the tests or tasks deferred as being too difficult in their original contexts.
-
-
Chapter 6: Compiling Invocations
Generating code to perform individual phrases.
-
Invocations - 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. -
Parse Invocations - To register phrases with the excerpt parser, and to provide the excerpt parser with help in putting invocations together. -
Compile Invocations - Here we generate Inform 6 code to execute the phrase(s) called for by an invocation list. -
Compile Invocations As Calls - Here we generate Inform 6 code to execute the phrase(s) called for by an invocation list. -
Compile Invocations Inline - Here we generate Inform 6 code to execute the phrase(s) called for by an invocation list. -
Compile Phrases - Phrases defined with a list of invocations, rather than inline, have to be compiled to I6 routines, and this is where we organise that. -
Compile Arithmetic - To compile code performing an arithmetic operation. -
Compile Solutions to Equations - To compile code to solve an equation involving numerical quantities.
-
Powered by Inweb.