Contents
Back
Forward

A11. What order the program should be in

This section summarises Inform's "this has to be defined before that can be'' rules.

1. -- The three library files, Parser, Verblib and Grammar must be included in that order.

-- (a) -- Before inclusion of Parser: you must define the constants Story and Headline; the constant DEBUG must be defined here, if anywhere; similarly for Replace directives; but you may not yet define global variables, objects or routines. If you are linking in the library (using USE_MODULES) then you may not use the Attribute or Property directive in this part of the program.

-- (b) -- Between Parser and Verblib: if a 'sack object' is to be included, it should be defined here, and the constant SACK_OBJECT set to it; the LibraryMessages object should be defined here, if at all; likewise the task_scores array.

-- (c) -- Before inclusion of Verblib: the constants

MAX_CARRIED, MAX_SCORE, NUMBER_TASKS, OBJECT_SCORE,
ROOM_SCORE, AMUSING_PROVIDED and TASKS_PROVIDED
must be defined before this (if ever).

-- (d) -- Before inclusion of Grammar: Verb and Extend directives cannot be used.

-- (e) -- After inclusion of Grammar: It's too late to define any entry point routines.

2. -- Any Switches directive must come before the definition of any constants.

3. -- If an object begins inside another, it must be defined after its parent.

4. -- Global variables must be declared earlier in the program than the first reference to them.

5. -- Attributes and classes must be declared earlier than their first usage in an object definition.

6. -- General parsing and scope routines must be defined before being quoted in grammar tokens.

7. -- Nothing can be defined after the End directive.


Contents / Back / Forward
Chapter I / Chapter II / Chapter III / Chapter IV / Chapter V / Chapter VI / Appendix
Mechanically translated to HTML from third edition as revised 16 May 1997. Copyright © Graham Nelson 1993, 1994, 1995, 1996, 1997: all rights reserved.