How to Program in Basic Inform

Every since I heard Mr. Nelson’s Inform 7 open sourcing talks I’ve been interested in learning more about Basic Inform—what were its features, how you programmed in it, and what you could create with it.

I took a look at the Basic Inform kit and extension when the Inform 7 source code was open sourced. I think the documentation is excellent but I have to admit that when I read my first line of “The verb to be means the built-in new-verb meaning” I was more than a bit perplexed.

I also took a look at some of the Basic Inform code that been posted online and it seems to be written using either Inform 6 syntax, Inform 7 syntax, or a combination of both.

I’ve got some experience with Inform 7, no experience with Inform 6, and I don’t know what I don’t know. I’m willing to dig into the Inform 7 source code and learn Inform 6 if that’s what I’ve got to do but first I’ve got some very basic questions about Basic Inform:

  1. Is there any sort of Basic Inform documentation or reference besides the source code?
  2. How much Inform 6 knowledge is necessary to write Basic Inform?
  3. What syntax do you use to write Basic Inform—Inform 6, Inform 7, or a combination of both?
  4. If Inform 6 knowledge is required, should Inform 6 code be integrated into the Inform 7 environment like it is shown in “Writing with Inform” §27.14-§27.24?

I’m sure I’ll have other questions once I get answers to those above.

Any advice on getting started with coding in Basic Inform is appreciated.

Thanks in advance.

2 Likes

Essentially, the documentation is Writing with Inform, but you ignore the World Model bits. No, there’s not explicit labeling of which bits those are. But you can see in the Basic Inform extension what phrases exist there.

None is necessary and even if you knew I6 well you’d probably find much less reason to want to drop to I6: usually one does that to modify stuff related in some fshion to the parser or world model.

Inform 7: it really is just the isolated programming-language-y bits. It takes the “domain-specific” out of “domain-specific language”.

Yes, I6 inclusions would work the same way.

The key as far as I can tell is writing lots of rulebooks and activities. You write your “To begin:” rule, which should follow a rulebook that dictates how play proceeds, and you’re off.

Or that’s how it seems to me.

EDIT: One thing that’s not immediately clear to me is input. Big hole there.

Oh, good point. One will want to deal with I6 for input. I did an extremely simple-minded version here:

1 Like

Inform 6 and Inform 7 and completely different languages. Inform 6 is an object-oriented language somewhat similar to C++, but with enough syntactic differences to make it unique. Under the hood, Inform 7 converts stuff to Inform 6 prior to compilation, but you don’t normally need to worry about that.

I am not an Inform 7 user, so I had never heard the term ‘Basic Inform’. After following a couple of your links, I see that this is the kernel that is included with every Inform 7 game. From a quick skim, it looks like the ‘Basic Inform kit’ is written in Inform 6 and the ‘Basic Inform extension’ is written in Inform 7.

If you want to learn about Inform 6, remember that there are three components: the Inform 6 language, the Inform 6 library and the Inform 6 compiler. The classic reference for these is The Inform Designer’s Manual, 4th edn, colloquially known as the DM4. You can download this in various formats (html, pdf, chm) from the Internet Archive. If you’re a Windows user, I recommend the chm version.

The DM4 has not been updated for over 20 years, whereas the Inform 6 library and the Inform 6 compiler are updated and extended on a regular basis. You probably don’t need to know about all the changes over the years, as I don’t think these will have any impact on Inform 7. If you do, you’ll need to refer to the various release notes.

1 Like

The open-source distribution of Inform contains a suite of Basic Inform test cases, which are in effect small Basic Inform programs - the tests consist of compiling them, running them and making sure the printed output is correct. See:

Basic Inform is really just Inform with all its interactive-fiction features removed, leaving the underlying programming language the same. Basic Inform programs tend to compile a little faster, and come out a little smaller, as a result. As for why BI exists, partly that’s because it seemed cleaner design in the compiler code. But I also wanted to open the door for anyone wanted to experiment with Inform-like languages in other areas completely.

8 Likes

@Zed @rileypb @Warrigal @GrahamNelson - Thank you all so much for the additional information. It was exactly what I was looking for in order to point me in a direction for further experimentation.

For anyone else who is interested in Basic Inform I have created a new repository for any of the work that I do with Basic Inform. The new repository can be found here.

Currently there are two folders in this repository:

There are two things to keep in mind when experimenting with Basic Inform code:

  1. You must use Inform 7 v10.1.2 IDE or above to compile and run these Basic Inform examples
  2. In the IDE Settings tab, you must make sure that the “Use Basic Inform only” checkbox is selected (your code will not compile if this option is not selected)

I’ll post any future progress here and in the repository ReadMe as things develop.

If anyone else experimenting with Basic Inform wants to add their own code to the new repository that I created just send me a pull request.

2 Likes