Question

I'm trying to learn the language Inform 7 and its very odd programming model.

Unfortunately I'm finding it hard to get my head around it because the language reads so much like natural English. I can't seem to intuitively understand what natural English statements are and aren't valid statements within the grammar.

Has anyone presented the Inform 7 grammar in EBNF form? I think that might make it a lot easier for me to understand.

Was it helpful?

Solution

There is a BNF grammar in Chapter 19 of the manual, presented by the authors of Inform with the qualification that it’s “doubtful that BNF is such a good tool for a natural-language system”.

This is what it looks like:

<rule> ::= 
  Definition : A/an <kind> is <new adjectival name> if/unless <definition> 
  | <preamble> : <phrases> 
  | <preamble> , <phrase> (* only allowed for a few cases: see below)

<definition> ::= 
  <condition> 
  | its/his/her/their <value property name> is/are <value> or less/more 
  | : <phrases>

<preamble> ::= 
  To <phrase template> 
  | To decide if/whether <phrase template> 
  | To decide which/what <kind of value> is <phrase template> 
  | This is the <rule name> 
  | [[A] Rule for] <circumstances> [(this is the <rule name>)]

<circumstances> ::= 
  At <time> 
  | When <event name> 
  | [<placement>] <rulebook reference> [while/when <condition>] [during <scene name>]
  <rulebook reference> ::= 
  <rulebook name> [about/for/of/on/rule] [<action pattern>] 
  | <object-based-rulebook name> [about/for/of/on/rule] [<description>]

<placement> ::= 
  a/an 
  | [the] first 
  | [the] last

<phrases> ::= 
  <phrase> 
  | <phrases> ; <phrase>
Licensed under: CC-BY-SA with attribution
scroll top