Inform7 and Natural Language Programming DSLs

I would like to mention Inform7, an IDE for developing interactive fiction (aka “text adventures”) in natural language programming (i.e. in plain English).

Natural language programming is not often mentioned in DSL discussions, which is rather a pity because it’s a fascinating field. From what I gather, there haven’t been all that many natural language programming tools created either.

Obviously, text adventures lends themselves naturally to the adoption of this kind programming, since the author intends to create a textual world using language. Inform7 (aka i7) has been around for many years (15 or more, I can’t even remember) and although it’s still WIP thousands of adventures have been created with it, in many languages (not only English, but always programmed in “English”).

Due to my appreciation of the genre (which dates back to the 80’s) I’ve used Inform7 myself quite extensively, and I was really impressed by the way the “illusion” of being programming in plain English is delivered.

To offer some very brief examples of the level of quality that i7 has achieved, you only need to look at the various examples found in its Recipe Book. The language is quite flexible at picking up semantic variation of common constructs, allowing end users to build their world in a very spontaneous way.

This is an i7 source code example taken from Writing with Inform, the i7 learning manual:

"Cave Entrance"

The Cobble Crawl is a room. "You are crawling over cobbles in a low passage. 
There is a dim light at the east end of the passage."

A wicker cage is here. "There is a small wicker cage discarded nearby."

The Debris Room is west of the Crawl. "You are in a debris room filled with
stuff washed in from the surface. A low wide passage with cobbles becomes
plugged with mud and debris here, but an awkward canyon leads upward and west. 
A note on the wall says, 'Magic word XYZZY'."

The black rod is here. "A three foot black rod with a rusty star on one end lies

Above the Debris Room is the Sloping E/W Canyon. West of the Canyon is the
Orange River Chamber.

You can easily spot how signifiers like here are correctly contextualized, and how west of the Crawl is correctly understood as a spatial reference to The Cobble Crawl room previously created.

Text adventures used be the exclusive domain of programmers, until i7 arrived and introduced Natural Language Programming, thus opening the doors to non-programmers authors. I see this as a great DSL achievement, especially since literature and prose should be the domain of writers, not programmers.

Ultimately, Inform7 is just an overlay build on top of Inform (aka Inform 6), which was one of the first “second generation” text-adventure programming languages — and indeed Inform 6 code is what ultimately i7 will produce and compile.

Having used this tool myself I can clearly see the benefits of moving toward natural language based DSLs, and I think that i7 might be the best available example in this field (the language is very powerful and feature rich, allowing to define verbs with multiple objects, kinds, proprieties and relationships).

Inform7 is an open source tool, but the full source code hasn’t been yet published. The first official release, with full source disclosure, was due in December 2019, but then Catalina OS stopped supporting 32-bit application (as well as Apple Store) which forced i7 developers to provide patches to allow macOS users to keep using the product. Then the COVID-19 emergency started, and for some reason or another the project hasn’t been updated since.

Here you might find some presentation material from two recent talks by Inform7’s creator, Graham Nelson, were he also speaks about the challenges of Natural Language Programming and parsing:

I would love to see Natural Language Programming mentioned more often when speaking of DSLs, and I think it has a great potential in the field of providing human-accessible interfaces to software and technologies.


The timing of you post is just perfect for me. I was just showing to my son some classic interactive fiction games a few weeks ago and was reading about DSLs for IF games creating. It is just impressive. And today I found your repo with IF resources which contains a real treasure of information on the subject. Thanks a lot for maintaining it and for bringing up the subject here.

I’m glad to read that the Awesome IF project is useful. I’m convinced that many people from our generation were attracted to programming by those early text adventures, which provided us a glimpse into the IA potentials of computers (I mean, if home computers could interact that way with users, then only the sky had to be limit for the mainframes!).

Like many other IF enthusiasts, which saw the genre booming and then all of a sudden disappearing into oblivion, I was quite surprised when (around 2000) I discovered that its legacy was not only still alive (thanks to emulators and backward compatible interpreters) but that many new languages had been created to revive the genre and bring it to new heights.

Although all attempts to make IF commercial again never succeeded beyond the occasional limited sales, thanks to the Internet and the open source movement (and obviously, the passion of those professionals that loved IF since childhood) we’ve seen some great new languages entering the IF scene — Inform7 being the most attractive due to its natural language approach, but also others like TADS-3 being impressive in terms of its high quality and power (and the fact it supported Unicode in an age in which it was still mostly an unknown standard).

Whether we might consider text adventures as being works of literature or “just games”, their educational value hasn’t gone by unnoticed, especially with Inform7 which has been used as a teaching tool in primary schools all around the world, helping kids gaining confidence with programming, writing and creating simulations of all types (history, chemistry, etc.).

Probably some Inform7 users don’t even realize they are learning to program, but when you explain them that they have been actually creating objects and relationships, attributes and proprietaries in the course of their adventure-creation, they might learn a deal more about programming than if you were to teach them those concepts firsts and then ask them to use them (which is a more intimidating experience).

This is a very practical example of how DSLs can bridge the knowledge gap between what we already know (i.e. the spoken language) and the technologies we need to interface too. Ultimately, any type of software could be driven by natural languages, making them more accessible (especially error reports).