That sounds right; when I wrote some puzzles involving giving orders to NPCs via persuasion, I had to do tons of rules about why actions failed. I copied the “Under Contract” example, which has code such as the following:
Unsuccessful attempt by Clark doing something:
repeat through table of Clark Retorts:
if the reason the action failed is the cause entry:
say "[response entry][paragraph break]";
rule succeeds;
say "'I don't think that's in the script,' says Clark dubiously."
Table of Clark Retorts
cause response
can't take yourself rule "'I'm always self-possessed,' Clark remarks. You've heard that line before, but it sounds so much more convincing from him."
can't take other people rule "'I don't think it would be appreciated if I tried to do that to [the noun],' he rumbles."
can't take component parts rule "'I don't want to rip [the noun] out,' Clark remarks."
can't take people's possessions rule "'I don't cotton to acting like a thief,' Clark replies. 'It ain't proper.'"
lab is room.
Include (-
<control-structure-phrase> ::=
if ... is begin |
if ... is |
if/unless ... |
repeat ... |
while ... |
until ... |
else/otherwise |
else/otherwise if/unless ... |
else/otherwise ... |
-- otherwise |
-- ...
<end-control-structure-phrase> ::=
end if/unless |
end while |
end repeat |
end until
-) in the Preform grammar.
To until (c - condition) begin -- end loop:
(- while (~~{c}) -).
When play begins:
let i be 1;
until i is 4 begin;
say i;
increment i;
end until
produces
You wrote ‘until i is 4 begin’ (source text, line 31): but this is an ‘else’ or ‘otherwise’ with no matching ‘if’ (or ‘unless’), which must be wrong.
Because of this problem, the source could not be translated into a working game. (Correct the source text to remove the difficulty and click on Go once again.)
Some syntax, like string literals, are baked into the compiler, so that won’t change.
But all that is defined by the Preform can be totally different depending on the language. The wording, the order of the words, and so on. For example, in French, I made it possible to write adjectives after the noun in descriptions.
So yeah, the reference will only apply to those who write their source in English, but that’s the majority so it’s still useful. As far as I know, only the French translation went as far as translating the Preform, and it’s only compatible with 6L38, and doesn’t fully work, and authors aren’t even forced to use the French syntax. I find the Preform quite poorly documented.
I believe those lines in the Preform grammar are indexed by number; when Preform says “this matches the sixth pattern in <control-structure-phrase>”, the compiler says “ah, that pattern is for ‘else’, so this is an ‘else’ block”. That’s why you get that error message, because “until” is now the sixth pattern in <control-structure-phrase>.
Try putting “while/until” in the fifth line instead of adding a new one. (There’s a fancy way to mix up the ordering without confusing the compiler but I don’t understand it well enough to use it.)
Include (-
<control-structure-phrase> ::=
if ... is begin |
if ... is |
if/unless ... |
repeat ... |
while/until ... |
else/otherwise |
else/otherwise if/unless ... |
else/otherwise ... |
-- otherwise |
-- ...
<end-control-structure-phrase> ::=
end if/unless |
end while/until |
end repeat
-) in the Preform grammar.
Each line has an implicit label, starting with /a/. If you need to add a line (if the formulation is too complicated to be expressed as a simple slash alternative), you have to make all label explicit by adding /a/, /b/, and so on in front of each line. You can have duplicate labels, so you’d use the same letter for while and until. (Again, that’s for 6L38. It could have changed since.)
[...]
<control-structure-phrase> ::= [...]
while/until/for ... | [...]
<end-control-structure-phrase> ::= [...]
end while/until/for |
[...]
to for each/-- (i - nonexisting K variable) in (L - list of values of kind K)
begin -- end loop:
(- {-primitive-definition:repeat-through-list} -).
to for each/-- (loopvar - nonexisting K variable) in (OS - description of values of kind K)
begin -- end loop:
(- {-primitive-definition:repeat-through} -)
This is good stuff, and potentially very useful as a high-level quick reference similar to the “I7 Cheat Sheet.” Thank you for putting it together!
If it does get made into a standalone document, please be sure to post here with its location (and get it into the IF Archive). It would make a nice addition to the content on the I7 Resources pinned topic.