Natural Language Programming for Interactive Fiction

After years of effort, Graham Nelson has released version 7 of the Inform language. Inform is the language created by Infocom for the construction of interactive fiction games, such as the legendary Zork series. This latest edition of the language is notable in that it is based on a subset of English, and reads like natural-language descriptions. For example:

The LNER Mallard is a steam locomotive. The Mallard is 4-6-2.
A steam locomotive can be watered or unwatered. A locomotive is usually watered.
A man called Peter is in the Atrium. North of the Atrium is the Hall of Greek Vases.
Brightness is a kind of value. The brightnesses are guttering, weak, radiant and blazing.

These declarations create not only the terms used, but the relations between the terms. Conditions can later be tested using the domain-specific terms thus created (if the cat is on the mat...).

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Actually, No

Inform is the language created by Graham Nelson to compile to Z-code, the bytecode instruction set that was created by Infocom, etc. Infocom's original source language was called ZIL ("Zork Implementation Language"), and was essentially a cut-down dialect of a language called MDL ("Muddle"), which was itself a dialect of LISP that had been called "Lisp 1.5 with data types."

Oh, I just rediscovered this thread, where I said everything I've said here and more.

I stand corrected.

I stand corrected.


...that's my pedantic side coming out. It's irrelevant to the very interesting subject at hand, unless you're interested in the history of Infocom and ZIL.

Zork Implementation Language

Google found a tutorial on ZIL.

More Offtopic...

This got me interested in the history of the Z-Machine (the 25-year-old virtual machine behind Inform 7 and all the previous Infocom games), and rummaging around I found this nugget -- a Scheme interpreter (and tutorial) implemented in the Z-Machine:

Just in case you ever need to write a quick Scheme program on your Commodore 128 ;)

30 Years After Colossal Cave

This is actually pretty cool. The NL interface is pretty powerful, and allows for rules which aggregate over subsets of objects. For instance, the idea of a 'kind' defines inheritance:

An electronic component is a kind of thing. An electronic component is either powered or off. After examining an electronic component: say "It is currently [if powered]powered.[otherwise]off."

The quantifiers are simple and composable (from the docs):

if each door is open
if anyone is carrying all of the animals
if everybody is in the Dining Room

The UI is very slick and simple, with just two panes on either side of the screen. There are interesting concepts of unit-testing your game (the Transcript, which requires you to "bless" changes, and the Skein, which is a dynamic flow graph of the game logic). The documentation is also top-notch, giving more-complicated examples as footnotes to every concept.

I would advise anyone who is mildly interested in IF, NLP, human-computer interaction, or who just wants to give their left brain a rest, to download and give it a try. I mean, you won't often see code like this in C++ (actual code, again from the docs):

if the table supports something which supports a drippy thing (called the offending item), say "'[The offending item] could still theoretically dribble down here,' says the table nonchalantly. 'It's possible.'"


man, that's really sweet! Graham Nelson is an impressive fella! It's been years since i tried anything on Inform, though...

I heard Perl6 had a lot of features that looked like Inform6. Now Inform has leapfrogged them... :)

Amazing language for simulations, like the original Colossal Cave was intended to...

I'd also urge people to read the delightful handcrafted Inform manual, which is a labor of love itself... :)

Another writeup.

Another writeup.