Inform 7: Natural-Language Programming Lives

June 18, 2007 at 11:51 pm 3 comments

When most programmers think of natural-language programming, they usually think of Applescript – an ambitious yet doomed-to-failure language with English-like syntax that Apple developed in order to automate OS scripting tasks. Frankly, Applescript in its current incarnation is pretty dismal – any reasonably complex script is positively overflowing with ends and tells, reminiscent of Ruby’s slower, dumber cousin. (Incidentally, 99% of the pain of Applescript can be removed with Ruby or Python bridges.)

These painful memories, combined with other influential condemnations, will probably lead many programmers to shun Inform 7 and its mission to be “built by writing natural English-language sentences.” However, if you will wait a moment, I will show you the masterful elegance with which Inform 7 mixes modern programming paradigms and the English language.

For those of you unfamiliar with Inform, it’s a system for writing text adventures – well-known examples include Adventure, Zork, and the famously difficult adaptation of The Hitchhiker’s Guide to the Galaxy. Inform was created in 1993; in its first six versions, games were written in a procedural programming language with a syntax looking like a cross between Perl and Applescript. Now, however, games are written entirely in English and then translated with the I7 compiler.

The following is not meant to be a full-fledged I7 tutorial; the official site does that far better than I ever could. This is simply a demonstration of how I7 manages to express complex programming concepts entirely in English.

Let’s look at how we instantiate objects:

The hall is a room.

There, that’s it. Same thing as hall = or what have you. Its name “The hall” will be displayed correctly when the player enters, leaves or observes it.

What about making new types of objects?

A bathroom is a kind of room.

Ooh! Subclassing! Inheritance! And it does it concisely and readably, and without using any terms such as “public”, “class”, or “extends”!

Rooms can be clean, dirty, or filthy.
Bathrooms are usually dirty.

Dynamic programming! We can edit the properties of built-in objects, a lá Smalltalk and Ruby!

The oil drum is a thing. The oil drum is enterable.

“Enterable” in this case is like a Ruby mixin – it allows the player to get in and out of the oil drum and provides it with all the attributes that entails.

Color is a kind of value. The colors are blue, red and green.
Instead of touching the button: change the color of the button to red.

Note the definition of new enumerable types, subclassing methods (in this case, ‘touching’) on existing objects, and changing attribute values.

These are complicated concepts and the fact that the Inform 7 designers have made them expressible in concise English is, frankly, astounding.

Go check it out; write the Dramatic Lovecraftian Adventure you’ve had brewing up in your mind for the past few years. It’ll be fun.

Entry filed under: code.

Map, Filter and Reduce in Cocoa How Tim Burks and Nu Stole the Show at C4[1]


  • 1. Josef Svenningsson  |  June 19, 2007 at 10:43 am

    I just want to stress that I7 is a domain specific language. While it’s fun and productive to program interactive fiction with it I would never want to use it for general purpose programming.

  • 2. Top Posts «  |  June 19, 2007 at 11:59 pm

    […] Inform 7: Natural-Language Programming Lives When most programmers think of natural-language programming, they usually think of Applescript – an ambitious yet […] […]

  • 3. Chris Wirth  |  July 12, 2007 at 12:38 am

    You are the fucking man…

About Me

I'm Patrick Thomson. This was a blog about computer programming and computer science that I wrote in high school and college. I have since disavowed many of the views expressed on this site, but I'm keeping it around out of fondness.

If you like this, you might want to check out my Twitter or Tumblr, both of which are occasionally about code.

Blog Stats

  • 709,140 hits

%d bloggers like this: