Mechanic · input & timing · interactive fiction
Text parser
The part of a text game that reads a typed command and turns it into an action on objects.
On this page
A text parser reads what the player types and turns it into an action. Adventure 2.5, as ported by Open Adventure, refuses more than two words and reads only the first five letters of each1. Zork I’s source takes a verb and up to two noun clauses with prepositions, and runs several commands from one line2.
- Verb and nounColossal Cave Adventure (1976). At most two words, each matched on its first five letters.1
- Clauses with prepositionsZork I (1980). A verb and up to two noun clauses with prepositions; THEN chains commands.2
Games
| Game | Year | How | Note |
|---|---|---|---|
| Colossal Cave Adventure | 1976 | Verb and noun | at most two words, each matched on its first five letters |
| Zork I | 1980 | Clauses with prepositions | a verb and up to two noun clauses with prepositions; THEN chains commands |
Every claim about this mechanic, by game (2)
References
- ^ abOpen Adventure, the C port of Crowther and Woods's Adventure 2.5 (1995), refuses any input of more than two words, answering “Please stick to 1- and 2-word commands.” It matches each word against its vocabulary on the first five letters only, ignoring case, and the instructions it shows a player who asks for them say to type “ne” for northeast, since “northeast” would read as “north”.CodeOpen Adventure 1.22revised
How we know
567 if (word_count(input) > 2) {misc.c lines 567–571 at e616052 · upstream ↗ 2920- TWO_WORDS: 'Please stick to 1- and 2-word commands.'adventure.yaml line 2920 at e616052 · upstream ↗ 22#define TOKLEN 5 // # outputting characters in a token */advent.h line 22 at e616052 · upstream ↗ 401 if (strncasecmp(word, objects[i].words.strs[j], 402 TOKLEN) == 0) {
misc.c lines 401–402 at e616052 · upstream ↗ 384 if (strncasecmp(word, motions[i].words.strs[j], 385 TOKLEN) == 0 &&
misc.c lines 384–385 at e616052 · upstream ↗ 2862 you that I look at only the first five letters of each word, so you'll 2863 have to enter "northeast" as "ne" to distinguish it from "north".
adventure.yaml lines 2861–2863 at e616052 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-22.
Revised after a check by a second AI model, 2026-10-22.
- ^ abZork I's ZIL source (a 1983-headed revision) parses a command into one verb and up to two noun clauses, each of which a preposition can lead, and matches the result against the verb's syntaxes, such as PUT OBJECT IN OBJECT. A third noun clause draws “There were too many nouns in that sentence.” A clause can name several objects only where the syntax allows it, as TAKE's does. THEN or a period ends one command, and the parser keeps the rest of the line for the next.CodeZork I ZIL source
How we know
98<CONSTANT P-NC2 8>gparser.zil lines 90–99 at 97b7b3d · upstream ↗ There were too many nouns in that sentence.
gparser.zil#L326-L333 · upstream ↗ 384<SYNTAX PUT OBJECT (HELD MANY HAVE) IN OBJECT = V-PUT PRE-PUT>gsyntax.zil line 384 at 97b7b3d · upstream ↗ 469<SYNTAX TAKE OBJECT (FIND TAKEBIT) (ON-GROUND IN-ROOM MANY) = V-TAKE PRE-TAKE>gsyntax.zil line 469 at 97b7b3d · upstream ↗ 1302 <TELL "You can't use multiple ">gparser.zil lines 1294–1302 at 97b7b3d · upstream ↗ 273 <SETG P-CONT <+ .PTR ,P-LEXELEN>>>gparser.zil lines 267–275 at 97b7b3d · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-22.
Checked by a second AI model, 2026-10-22.
Sources
Code
- Crowther, Will, Don Woods, Eric S. Raymond, and Jason Ninneman. 2026. “Open Adventure 1.22 source code.” Commit e616052. esr/open-adventure @ e616052 · licence, all uses
- Blank, Marc, Dave Lebling, Bruce Daniels, and Tim Anderson. 2025. “Zork I source code (Infocom ZIL).” Commit 97b7b3d. historicalsource/zork1 @ 97b7b3d · licence, all uses