Inform 7 Home Page / Documentation


§27.23. Inform 6 Understand tokens

The parser which deciphers the player's typed commands is written in I6, and many of the basic tokens of Understand grammar are implemented as "general parsing routines" (GPRs), the specification of which is described fully in the Inform 6 Designer's Manual. I7 translates much of the source text's Understand grammar into GPRs, and once again we can bypass this process and supply an Understand token directly as an I6 GPR. For example:

The Understand token squiggle translates into I6 as "SQUIGGLE_TOKEN".

We then have to include a routine of that name into I7's output using the "Include" instruction, on which more later.

This creates a token "[squiggle]"; so for instance if the source text contains:

Understand "copy [squiggle]" as ...

then Inform would parse the command COPY FIGURE EIGHT by calling the SQUIGGLE_TOKEN routine as a GPR with the word marker at 2, that is, at the word FIGURE.

As always, this should be done only where there seems no better way, or where speed is very important. For any fairly simple range of possibilities, it's better to use the techniques in the Understand chapter, or to use unit specifications.


arrow-up.png Start of Chapter 27: Extensions
arrow-left.png Back to §27.22. Inform 6 variables, properties, actions, and attributes
arrow-right.png Onward to §27.24. Inform 6 adjectives