Comments:
From %% to end of line.
Special characters:
#, $, @, ~, *, |, \, parentheses, brackets, and braces. Prefix by \ to print.
Rule definitions:
Statements:
Value syntax:
#abc
Object name.
@abc
Dictionary word. The @ is optional inside list expressions.
$abc
Variable.
123
Number (the valid range is 0–16383).
[]
Empty list.
[ element1 element2 element3 ... ]
Complete list.
[ element1 element2 element3 ... | tail ]
Partial list.
*
Current topic.
The current topic is set with an object name in the leftmost column.
Unification:
{ ... }
Conjunction.
~{ ... }
Negated conjunction.
... (or) ... (or) ...
Disjunction.
(if) ... (then) ... (elseif) ... (then) ... (else) ... (endif)
Conditions are evaluated at most once. Missing else-clause is assumed to be empty, i.e. succeeds.
(select) ... (or) ... (or) ... (stopping)
Branches entered one at a time, then the final branch repeats.
(select) ... (or) ... (or) ... (cycling)
Branches entered one at a time, then the cycle repeats.
(select) ... (or) ... (or) ... (at random)
Branches entered at random, avoiding repetition.
(select) ... (or) ... (or) ... (purely at random)
Branches entered at random, allowing repetition.
(select) ... (or) ... (or) ... (then at random)
First like (select) ... (stopping), then like (select) ... (at random).
(select) ... (or) ... (or) ... (then purely at random)
First like (select) ... (stopping), then like (select) ... (purely at random).
(exhaust) statement
Backtracks over all solutions to the statement (typically a block).
(collect $Element) ... (into $List)
Backtracks over all solutions to the inner expression. Values bound to $Element are collected in order and unified with $List.
(collect words) ... (into $List)
Backtracks over all solutions to the inner expression, grabbing all output. Printed words are diverted into $List, possibly out of order.
(collect words) ... (and check $List)
Backtracks over all solutions to the inner expression, grabbing all output. Succeeds if every value in $List appears in the grabbed output.
(stoppable) statement
The inner statement executes, succeeding at most once. The (stop) built-in breaks out of the innermost stoppable environment. The stoppable environment itself always succeeds.
(status bar $Height) statement
Like (stoppable), but all output is diverted to the status bar area, which is created if necessary.
(now) pseudo-query
Updates a dynamic predicate.
(just)
Removes choice-points created since the current predicate was queried.
(global variable (name of predicate $))
Declares a global variable for holding simple values.
(global variable (name of predicate $) $MaxSize)
Declares a global variable for holding complex values. The size requirements are: 1 for simple values, and 1 + N for lists, where N is the total storage required for the elements inside.
(generate $N (name of predicate $))
Creates $N anonymous objects, for which the predicate will succeed.
The list is sorted alphabetically, considering just the non-parameter words.
($X = $Y)
Unifies $X with $Y.
($X < $Y)
Succeeds if $X and $Y are numbers, and $X is strictly less than $Y.
($X > $Y)
Succeeds if $X and $Y are numbers, and $X is strictly greater than $Y.
(bold)
Enables bold text.
(clear)
Clears the main window (but not the status bar area).
(clear all)
Clears the screen and disables the status bar.
(compiler version)
Prints the name and version of the compiler.
(cursor to row $ column $)
In status bar: Moves cursor to given coordinates (1, 1 is top left).
(display memory statistics)
Displays a backend-specific line of memory usage statistics.
($X divided by $Y into $Z)
Unifies $Z with the quotient after dividing $X by $Y.
(empty $X)
Succeeds if $X is bound to an empty list.
(fail)
Fails. Equivalent in functionality to e.g. (1 = 2).
(fixed pitch)
Enables fixed-pitch text.
(get input $)
Reads a line of input from the player. Returns a list of words.
(get key $)
Waits for the player to press a key. Returns a single-character word.
(get raw input $)
Reads a line of input from the player. Returns a list of single-character words.
($X has parent $Y)
Dynamic predicate that succeeds when $X is a direct child of $Y in the object tree. Either parameter can be unbound.
(interpreter supports undo)
Succeeds if the current interpreter claims to support undo.
($X is one of $Y)
Unifies $X with each element of $Y in turn.
(italic)
Enables italic text.
(line)
Requests a line break.
(list $X)
Succeeds if $X is bound to a list (empty or non-empty).
($X minus $Y into $Z)
Unifies $Z with the difference between $X and $Y.
($X modulo $Y into $Z)
Unifies $Z with the remainder after dividing $X by $Y.
(non-empty $X)
Succeeds if $X is bound to an non-empty list.
(no space)
Inhibits automatic whitespace before the next word or punctuation mark.
(number $X)
Succeeds if $X is bound to a number.
(object $X)
Checks if $X is an object, or—in a multi-query—backtracks over every object.
(par)
Requests a paragraph break.
(par $)
Prints $N blank lines.
($X plus $Y into $Z)
Unifies $Z with the sum of $X and $Y.
(quit)
Immediately terminates the interpreter.
(random from $X to $Y into $Z)
Unifies $Z with a random number in the range $X to $Y inclusive.
(repeat forever)
Provides an infinite supply of choice points. Generally invoked with a multi-query.
(restart)
Restarts the program.
(restore)
Restores a saved game (the interpreter asks for a filename).
(reverse)
Enables reverse-video text.
(roman)
Disables all text styles (bold, italic, reverse, and fixed pitch).
(save)
Saves the current game (the interpreter asks for a filename).
(save undo)
Saves the current program state in memory.
(script off)
Disables transcription.
(script on)
Enables transcription (the interpreter asks for a filename).
(serial number)
Prints the serial number (compilation date) of the current program.
(space)
Forces whitespace before the next word or punctuation mark.
(space $N)
Prints $N space characters.
(split $X by $Y into $Left and $Right)
Splits $X into two halves around each occurrence of a keyword from $Y.
(status bar width $)
Returns the current width of the status bar area (i.e. the screen), in characters.
(stop)
Breaks out of the innermost (stoppable) environment.
($X times $Y into $Z)
Unifies $Z with the product of $X and $Y.
(trace off)
Disables low-level tracing.
(trace on)
Enables low-level tracing.
(unbound $X)
Succeeds if $X is currently unbound.
(undo)
Restores the program state at the time of the latest (save undo).
(word $X)
Succeeds if $X is bound to a dictionary word.
(word representing backspace $Char)
Unifies $Char with the single-character word that represents the backspace key.
(word representing down $Char)
Unifies $Char with the single-character word that represents the down arrow key.
(word representing left $Char)
Unifies $Char with the single-character word that represents the left arrow key.
(word representing return $Char)
Unifies $Char with the single-character word that represents the return key.
(word representing right $Char)
Unifies $Char with the single-character word that represents the right arrow key.
(word representing space $Char)
Unifies $Char with the single-character word that represents the space key.
(word representing up $Char)
Unifies $Char with the single-character word that represents the up arrow key.
(error $ErrorCode entry point)
Execution restarts here when a fatal error has occurred.
(program entry point)
Normal execution starts here.
(story author)
Metadata: Defines the author of the story.
(story blurb)
Metadata: Defines the blurb for the story.
(story ifid)
Metadata: Defines the IFID of the story.
(story noun)
Metadata: Defines the noun (also known as the headline) of the story.
(story release $N)
Metadata: Defines the release number of the story.
(story title)
Metadata: Defines the title of the story.
(removable word endings)
Defines one or more word endings that can be removed when parsing user input.