I would like to know how the parsers on old Spectrum adventure games worked

So I’ve played a lot of adventure games on my old ZX Spectrum. Today, many many years later, I would like to know how the Parsers on them worked. Like, you could say, “HIT TROLL WITH AXE”, and it would understand what you wrote, and do it - how did it understand??

Is there any good webpage or hopefully a Youtube video or 2, that explains the basics, starting from 0? :slight_smile: I’m definitely a programmer, but I’ve never studied Computer Science formally, so I really would like to satiate my curiosity.

Thanks everyone :slight_smile:

1 Like

Parsing is a pretty broad area and there are many approaches including a simple 2 word parser, regular expression matching, a CFG parser, and statistical approaches.

In the context of text adventures, you may find the following links informative.



1 Like

If you don’t get a satisfactory answer here (or even if you do), this is the kind of question that the Retrocomputing Stack Exchange site loves to answer.

Just recently I blogged about the text parser in Sierra’s SCI engine, and started it off with its simpler predecessor AGI. It strikes me as roughly simple enough to maybe work on such systems.



After wandering around a bit, I found this:

1 Like

I would wager most of them had a core that worked the same as described in the Usborne 1980s computing books. Even ones not written in BASIC (like the Usborne gamees) were doing largely the same thing in asssembly language (faster) or in their own slightly higher-level scripted language.

You have a database of locations and their connections, a database of objects with flags/variables and descriptions, and a list of verbs. You match verbs to objects and program consequences for each pairing that you care about, and built a standard model here and there for things like TAKE/DROP.

Here’s a link to the freely downloadable books:

Scroll down, especially, to WRITE YOUR OWN ADVENTURE PROGRAMS at the bottom. There are also two book-length adventures there, Island of Secrets and Mystery of Silver Mountain, which also have a lot of description of how they work.

I used these books to write a bunch of my own adventures. If you want to see what kind of planning was involved (lots of writing lists of things on paper…) have a look at my blog where I’ve got up the scanned notes for several adventures:

(sorry, no https there, but it’s safe.)
(years with the most adventure games and their notes are 1988 and 1990)