let's play: Inform 10's Basic Inform and Standard Rules (SR: Physical World Model 4)

Hello! What follows is a line-by-line discussion of Inform 10.1.2’s Standard Rules and Basic Inform extensions (sometimes referred to as “SR” and “BI”).

What is Basic Inform?

“Basic Inform, included in every project, defines the basic framework of Inform as a programming language.”

Basic Inform contains, among other things, the phrases and definitions that we use to make Inform programs. While these phrases and definitions are in recognizable natural language, they typically refer to Inform 6 code.

What are the Standard Rules?

According to Writing with Inform,

"The ‘Standard Rules’ file contains the definitions of the basic kinds, phrases, actions and grammar described in this documentation: for instance, it includes lines like

A container is a kind of thing.

…without which Inform would be lost. Although including the Standard Rules is compulsory, it is treated internally as if it were any other ‘extension’.

Together, Basic Inform and the Standard Rules are the foundation upon which Inform projects are built. While it might be hard to understand all of it, studying it will help us grow as Inform authors.

We will look at both of them here, section by section. Hopefully, the combined knowledge of this forum will illuminate all of its corners. Along the way, we might have a bit of fun sharing our understanding and experience.

How will this work?

In every post, I’ll choose an excerpt for us to discuss, writing every post. I’ll make corrections and tweaks as we go. Leaving a day or so between posts to give posters a chance to comment seems best.

I am not an Inform expert. It is all but certain that I will misunderstand something or find myself stumped. Please, please, please correct, advise, and expand whenever you see fit. My goal is to finish this process with a thread other authors can benefit from. My priorities are accuracy and legibility.

We will use the HTML source files. They are shared here:

Basic Inform
Standard Rules

It may be desirable to refer to other source files. Kits, for instance, are sometimes mentioned. While the Inform code they refer to might be hard to follow, the comments can be illuminating.

Inform Source Documentation Page

It will often be beneficial to reference Writing with Inform, also known as the “docs.” I use Zed Lopez’s version, which is quite legible and helpfully includes Borogove and Quixe links with Inform’s documented examples.

Inform 7 v10 documentation

A final note

As Zed observes, the lines between Standard and Basic inform are not always clear. Some elements are not where we expect, and while we have incredible resources at hand (this forum, for instance), we will not, at the end of this thread, have arrived an Inform “theory of everything.” This thread advises authors that tinkering with these two extensions may produce poor results. It’s worth having a look at this section of Writing with Inform, also recommended by Zed, which contains Graham Nelson’s thoughts on the linkage between i6 and Inform. It further contains a warning:

Any i6-related syntax which is not documented in this chapter may be removed or changed in effect at any time without warning, for instance in an update of Inform to fix bugs.

While Inform tries to maintain project compatibility between versions when possible (it isn’t always so!), authors experimenting with Basic Inform should not expect painless upgrades.

Looking forward

Itinerary:

  • Basic Inform: Preamble
  • Standard Rules: Preamble
  • Basic Inform: Miscellaneous Definitions
  • Standard Rules: Physical World Model
  • Standard Rules: Variables and Rulebooks
  • Standard Rules: Activities
  • Standard Rules: Actions
  • Standard Rules: Command Grammar
  • Basic Inform: Phrase Definitions
  • Basic Inform: Adjectival Definitions
  • Standard Rules: Phrase Definitions

We will begin with the Preamble, which is markedly not made up of the natural language that we beginners have come to learn. It’s a good way for us to jump into the deep water!

Table of Contents

  1. Introducing Basic Inform
  2. Interlude: testing applications of the TO BE meaning in Baisc Inform
  3. Basic Inform: Preamble, Part 2
  4. Basic Inform: Preamble, Part 3
  5. Basic Inform: Preamble, Part 4
  6. Standard Rules: Preamble
  7. Interlude: simple projects using BI and SR
  8. Basic Inform: Miscellaneous Definitions
  9. Standard Rules: Physical World Model
  10. Standard Rules: Physical World Model 2
  11. Standard Rules: Physical World Model 3
  12. Standard Rules: Physical World Model 4
11 Likes

scrapped discussion of Inform 11 Standard Rules

Basic Inform projects don’t have to have rooms.

Before you get too far into this I’d strongly suggest you go through the Basic Inform extension first. The Standard Rules are no longer complete, but are now a layer on top of Basic Inform. For example the Basic Inform preamble has 43 more verbs, lots more use options, etc.

These are for the WIP Inform 11 extensions, and have some significant differences. I’m not sure if the 10.1 docs are still online anywhere.

3 Likes

I can see how that would be, but I’m not equipped to write about Basic Inform. Maybe someone else will do it someday.

That’s alarming! I got this link in the last thread, I don’t think that came up. I’ll do a compare, but it would be nice if the HTML version for 10 still exists (anyone?).

Oh, you are actually going through the Inform 11 extension. Use options were quite different in 10.1: https://github.com/ganelson/inform/blob/r10.1/inform7/extensions/standard_rules/Sections/Preamble.w

I think you are. It’s not a different thing than regular Inform, just a subset of it. If you look at the phrases section you’ll see it has everyday things that all Inform authors use: saying values, arithmetic, control structures, tables, text manipulation, etc. inform/inform7/extensions/basic_inform/Sections/Phrase Definitions.w at r10.1 · ganelson/inform · GitHub

(If you like I could move these comments back to the original discussion topic.)

I can see how it would be an interesting reference… well, heck, why not. So long as people can answer questions sometimes.

I’m going to scrap the second post and revise the first.

It’s ok to keep it here. I think it will be good to include the discussion, I’ll maintain a table of contents to help readers keep up.

2 Likes

It wouldn’t be too hard to upload the 10.1 docs somewhere if that’s what you’d prefer?

I think readers might like the HTML, but I want the links to be permanent. Is github the best option for that?

Here you go, I’ve published the docs from the r10.1 branch:

https://curiousdannii.github.io/inform-10.1-docs/extensions.html

These links will be permanent.

4 Likes

Great! Thanks.

One last suggestion… maybe it would make sense to interleave Basic Inform and the Standard Rules?

You could do something like this:

  • Basic Inform: Preamble
  • Standard Rules: Preamble
  • Basic Inform: Miscellaneous Definitions
  • Standard Rules: Physical World Model
  • Standard Rules: Variables and Rulebooks
  • Standard Rules: Activities
  • Standard Rules: Actions
  • Standard Rules: Command Grammar
  • Basic Inform: Phrase Definitions
  • Basic Inform: Adjectival Definitions
  • Standard Rules: Phrase Definitions
1 Like

Sure, if that’s going to be most helpful. I’ll start with Basic Inform preamble, and unless there’s debate I’ll just keep going in your suggested order.

Note: in many cases, a substitution might permit an object, a value, some more specific thing, etc. As a catch-all for these variable cases, I use the term [item].

Note 2: Updated based on corrections downthread.

Introducing Basic Inform (v10.1.2)

Basic Inform introduces itself in this way:

Basic Inform is like a boot program for a computer that is starting up: it sets up the compiler to implement the familiar language, beginning with basic verbs and use options.

My observation is that Basic Inform is what connects Inform’s natural language and it’s more esoteric (or, at least, not discussed in Writing with Inform) underlayers. What can it offer those of us who don’t understand the inner workings of Inform?

I may have a different answer at this thread’s conclusion, but my hope now is that it can help us appreciate the way our natural language code is constructed syntactically. For more information about general qualities and advantages of Basic Inform, see this helpful reply by Dannii.

§1. Title. Every Inform 7 extension begins with a standard titling line and a rubric text, and this is no exception:

Version [[Version Number]] of Basic Inform by Graham Nelson begins here.

"Basic Inform, included in every project, defines the basic framework
of Inform as a programming language."

Sections 2 and 3 create two primal verbs that are used to build everything that follows.

§2. Verbs. The first task is to create the verbs which enable us to do everything else. The first sentence should really read “The verb to mean means the built-in verb-means meaning”, but that would be circular. So Inform starts with two verbs built in, “to mean” and “to be”, with “to mean” having the built-in “verb-means meaning”, and “to be” initially having no meaning at all.

It’s striking to consider that something as primordial as TO BE would be defined at all, but every syntax must come from somewhere. TO BE, we discover, can be used in a number of ways. Inform presumably deduces the specific meaning used contextually, as we never have to say which kind of IS we mean.

Here is my understanding of the usages. Please correct or amend as needed!

The verb to be means the built-in new-verb meaning.

Basic Inform permits the declaration of new verbs that can be used in adaptive text or else apply to exiting relations. This is different from declaring verbs for relations, which uses the to mean verb.
[verb name] is a verb.

The verb to be means the built-in new-plural meaning.

Basic Inform handles the assertion of new plurals.
the plural of [thing] is [new plural of thing].

The verb to be means the built-in new-activity meaning.

Declaring new activities.
[activity name] is an activity.

The verb to be means the built-in new-action meaning.

Despite this declared meaning, Basic Inform does not support actions or the creation of new actions off the shelf.

The verb to be means the built-in new-adjective meaning.

It is possible to define new adjectives in Basic Inform.
definition: [item to be described] is...

The verb to be means the built-in new-either-or meaning.

New either/or properties.
[an item] is either [option 1] or [option 2]

The verb to be means the built-in defined-by-table meaning.

Defining things with tables.
some/the [items] are defined by the table of...

The verb to be means the built-in rule-listed-in meaning.

Support for organizing rulebooks.
[rule name] is listed first/last/after/before/-- in [rulebook name]

The verb to be means the built-in new-figure meaning.
The verb to be means the built-in new-sound meaning.
The verb to be means the built-in new-file meaning.

Files can be declared in Basic Inform, but figures and sounds cannot. CF Declaring Files.

The verb to be means the built-in episode meaning.

Likely refers to the specification of story episodes, which is not documented anywhere.
the story is episode [a number] of "[series name]"

The verb to be means the equality relation

(this one is different, as it invokes a relation rather than a built-in meaning). Equality is not discussed in the documentation, though it will be used often in the typical Inform project.
if [item 1] is [item 2]

§3. We allow “imply” as a synonym for “mean”.

The verb to imply means the built-in verb-means meaning.
The verb to imply means the meaning relation.

We might recognize this verb from the documentation on relations.
the verb [infinitive] implies the [relation name].

Asking again: what does this offer? I think it helps clarify the way we must construct code, and codifies appropriate uses of to be.

I may have gotten some of these wrong, but I’ve done my best! Do any readers have observations regarding the first three sections of Basic Inform’s preamble? In the next post, we’ll continue with Section 4.

2 Likes

In Graham’s 2020 Narrascope talk he explained his plan for Basic Inform:

Something else enabled by Inbuild is Basic Inform, a version of Inform stripped down to be a programming language with no interactive fiction features.

This meant dividing the old Standard Rules extension in half. The first is called Basic Inform, and defines the language itself; the second is still called Standard Rules, and does all the narrative business of actions, the world model, and so on. Inbuild also introduces the notion of “kits”, the green jigsaw pieces here. These are precompiled packages of Inter code, which Inbuild incrementally compiles as needed. You can write your own, if you want to.

In Basic Inform, all of the stuff involving command parsing and the world model disappears. You can’t say “The Gymnasium is a room”, or “The player is wearing a silk hat.” That might seem like Hamlet without the Prince, or like apple pie without the apple. But modularising Inform like this means it can be used to make different sorts of games, or different sorts of art. It would be really interesting to see Inform used as an accessible front end for the visual art language Processing, for example.

Basic Inform asks the question “what if Inform wasn’t for parser IF?” What if it was a general purpose language, with which other frameworks could be used. A choice based framework could be used without any of the parser code. You could even use it to make graphical point and click adventures, or do totally non-IF stuff like calculating prime numbers or running single transferable vote elections.

Even though no one is really using it for that yet, I think it does help the development team have clarity over how various features should be implemented. In Inform 11 I’ve been working on a Glk framework, which needs to work entirely within Basic Inform only. On the other hand even though Glulx is the default format, the Z-Machine is still intended to be a fully supported format. Having the Standard Rules and its kits being separate from Basic Inform also means that it’s largely separated from the Glulx/Glk specific code in Basic Inform. There are still some functions in the WorldModelKit which have format dependent #if statements, but they’re isolated, while the code as a whole is format agnostic.

See also this prior discussion: How to Program in Basic Inform

4 Likes

Thanks for putting this together and sharing the links! To be clear, I don’t mean to ask “What does basic inform have to offer?” (quite a lot) but rather “What can beginning and intermediate authors get out of reading this extension?” I think BI has a lot to offer.

Looking at Nelson’s test cases, I’m pleasantly surprised that understand them (mostly)! The samples use familiar phrases and sentences. That being so, I’m surprised we haven’t seen more Basic Inform projects around, even as little experiments.

2 Likes

Interlude: testing to be usages.

Note: some of the information presented here has been corrected downthread.

Just to verify things, I made a simple BI project to test uses of to be. It looks like I got some of them wrong, which makes sense when I think about it.

"basic inform test"

to begin:
	say "BI test.";

"frob" is a verb.

[The verb to be means the equality relation.]
frotz is a kind of value.

[The verb to be means the built-in new-plural meaning.]
the plural of frotz is frotzes.

[The verb to be means the equality relation.]
the frotzes are serious and laugable.

frotza is a frotz that varies.
frotzb is a frotz that varies.
frotzc is a frotz that varies

frotz verification is a rulebook.

[The verb to be means the built-in new-either-or meaning.]
a frotz verification rule (this is the fv rule):
	if frotza is frotzb or frotza is frotzc, say "Yes!";
	
[The verb to be means the built-in rule-listed-in meaning.]
the fv rule is listed first in the frotz verification rules.

[The verb to be means the built-in new-figure meaning.
The verb to be means the built-in new-sound meaning.
The verb to be means the built-in new-file meaning.]

[figure filfre is the file "filfre.jpg.".
sound gong is the file "gong.ogg".
file document is the file "document".]

[The verb to be means the built-in episode meaning.

***
I don't know how to apply this one
***
		]

[The verb to be means the built-in new-action meaning.

***
How is this applied in basic inform? Sentences like ``[action name] is an action...`` don't compile, so it must be something else.
***
		]

I got hung up on declaring external files.

figure filfre is the file "filfre.jpg.".
sound gong is the file "gong.ogg".
file document is the file "document".

Attempting to do so throws this error:

Problem. You wrote ‘figure filfre is the file “filfre.jpg.”’ : but this seems to give something a name which contains double-quoted text, which is not allowed. If you do need quotes in a name, one option would be to write something like ‘In the Saloon is ‘Black’ Jacques Bernoulli.’; but this problem message is often caused by an accident in punctuation, in which case you never intended to create an object - you thought that the text ended a sentence because it finished with sentence-ending punctuation, when in fact it didn’t, so that I read the next words as following on.

I also had trouble declaring a scene, which I had mistakenly equated with episode.

The verb to be means the built-in episode meaning.

How can this meaning be applied?

I couldn’t figure out a way to use to be in this sense, either:

The verb to be means the built-in new-action meaning.

My initial thought was that it would be used to create new actions (as in SR Inform with a world model), but that doesn’t seem relevant in Basic Inform.

What’s going on with these meanings?

  • built-in new-figure meaning
  • built-in new-sound meaning
  • built-in new-file meaning
  • built-in episode meaning
  • built-in new-action meaning
3 Likes

The division between Basic Inform and not-Basic Inform isn’t quite as orderly as it could be. BI retains a bunch of artifacts of its origins as something carved out of something else. For any number of things, the Standard Rules might seem like a better home. The reverse is true, as well. Rule responses don’t exist in Basic Inform, though they’re conceptually a generic language feature.

There’s a crucial detail buried way in the back of the docs, WI 27.14:

Finally, anyone hacking with I7 for a while is likely to become curious about the Basic Inform or Standard Rules extensions, and to look at the text which sets up the Inform language and world model. These extensions are, of course, no secret, but can be misleading to read. For one thing, they appear to have great freedom to set up the world model as it pleases, but in fact the I7 compiler may well crash unless certain things are done just so in the Standard Rules: they depend on each other.

Again, to emphasize… “the text which sets up the Inform language and world model […] can be misleading to read. For one thing, [the built-in extensions] appear to have great freedom to set up the world model as it pleases…” and, for another thing, they give the appearance of offering great freedom to set up the Inform language as they please, but that’s an illusion.

Many fundamentals in the built-in extensions look like the same sort of things authors can write in their own code, but really they might behave in very different ways from how seemingly equivalent author-created code would or in other cases an author-created seeming-equivalent might not work at all. Some of this owes to special-casing in the I6 kits, but much of it owes to special-cased behavior in the compiler itself and, thus, is even more obscured.

One of the clearer examples of this are verbs with different meanings in different contexts. I discussed “to hold” recently. “to have” means the possession relation in conditional sentences, but in imperative sentences it means carrying and in assertions it creates properties.

1 Like

That thread was the inspiration for this one. The scope has changed, but the idea here is still to promote understanding and give people a point of departure for research, speculation, and authorship. I think readers able to hack Basic Inform may not get much out of this thread beyond a bit of enjoyable discussion, and I hope that comes to pass! Expertise will improve the quality and value of the thread.

I would like to note cases where things aren’t necessarily what we would expect. The named meanings for declaration of files seem very specific and it may be reasonable to assume that these and perhaps episode and new-action are holdouts from the Standard Rules.

It’s very useful for you to point out the sometimes-unclear lines between things (and to update the to hold thread, too!). I think a lot of authors have the Standard Rules open all of the time, and it really can promote a sense of orderliness that is usually well-founded. The exceptions, when they come up, are interesting to talk about!

1 Like

It does look like you got some of them wrong, yeah. Let me see…

Neither of those are the equality relation. The equality relation would be stuff like if the cheese is in the fridge:. I think it probably can’t be used in assertions, but I’m not 100% sure of that; maybe some assertions are secretly using it.

That’s just the equality relation, nothing to do with either-or properties.

Hmm, those seem to match the expected syntax for figures and sounds, so I’m not really sure why it’s not compiling for you…

For files, you need to write it like this:

text file document is called "document.txt".
binary file data is called "data.db".

This is just a guess, but I suspect it refers to this rarely-used syntax:

The story is episode 3 of "A Series of Unfortunate Events".

You can’t declare an action without an action specification.

Flubbing is an action. [this is no good]
Bribing is an action applying to one thing. [this is fine]

I think most of these built-in meanings are hard-coded much more deeply into the compiler and/or the Preform. For example, it’s the Preform that specifies exactly what an action declaration looks like, and this one line in Basic Inform merely links that Preform definition to the verb conjugations of “to be”… a conjugation which is itself also specified in the Preform. So in other words, it means forms of “to be” are used as an element of that construct, and that’s it.

2 Likes

Could it just be the extra period in "filfre.jpg."?

1 Like