Jess
Game world modeling using English-like sentences. For example:
The kitchen is a room. The closed container called the cabinet is in the kitchen. The cabinet contains a mug. The mug is transparent.
The commands in this idl aren't used directly by authors. Instead, these commands are created as a byproduct of reading a sentence. Each successfully matched English sentence results in a single [matched_phrase] with exactly one valid member.
The types of sentences jess can process are based on the sentences described in Inform7's documentation. However, Inform can handle a much wider range of sentences than jess.
An additional set of traits and a kind.
Matches additional directions.
only used by map_locations.
Matches a kind following another kind.
Partial phrase used for map connections.
This allows multiple doors, etc. on the lhs.
Matches a name following another name.
Matches a text following another some previous text.
Matches a trait following another trait.
One or more phrases consisting of traits and a kind.
while all parts are marked as optional, matching expects
there will be at least one trait or one kind
and that there can only be additional adjective phrases
if the previous one ended with a kind.
ex.
exists to support phrases like:
`the box is transparent and a container.`
Matches the words "is" or "are".
One of a predefined set of determiners: the, a/n, some, our.
This only matches if the first letter is lowercase, or uppercase at the start of a sentence;
otherwise, the article gets treated as part of the name.
Also note:
Defines traits for aspects that can be (re)used by various other kinds.
ex.
The commands aspects_are_traits, kinds_are_traits, and names_are_like_verbs all handle similar phrasing.
Used for kinds_have_properties.
like kind_called, specifying "called the/our ..." gives the noun an indefinite article.
Matches the word "called".
Matches commas, "and", or "or".
relies on the fact package match treats commas and ands each as their own words.
This matches commas, "and", or ", and".
It relies on the fact package match treats commas and the word "and" each as their own words.
Provides English specification of a number of objects.
( yes, `the five the containers` is permitted. )
Partial phrase for mapping declarations.
Matches some existing compass direction.
Defines a name and its kind in a single phrase.
Matches: (traits) kind "called" {the name}.
For example:
As per inform, the name includes all text after the word "called"
until "is", "are", or the end of the sentence;
and specifying "called the/our ..." gives the noun an indefinite article.
Matches the name of an existing kind.
Can generate a single anonymous noun.
Kinds ("can be"|"are either") new_trait [or new_trait...].
ex.
Names are "a kind of"/"kinds of" traits kind:any.
Interesting to note that inform allows "some kind/s of", but
this is more strict.
Like inform `The animals called kittens are a kind of things.` is legal.
can match plain names and existing kinds;
only allows a leading kind called, and errors on all counted kinds.
the phrases "a kind of" or "kinds of"
inform doesnt allow commas or ands here,
jess reuses the traits list here, so it does allow comma/and.
inform (weirdly) allows multiple kinds on the rhs:
`A box is a kind of container and things.`
but not if traits are specified, suggesting a switch there;
possibly to detect and reject `A box is a kind of closed and openable container.`
which it wants written as `A box is a kind of closed openable container.`
this doesnt switch to special traits, and doesnt allow multiple kinds.
Assigns default traits to a kind.
kinds:objects are "usually" traits.
Inform doesn't require the "usually", but i like it as a way to differentiate phrases about kinds vs. phrases about nouns.
Future: allow limiting traits to kinds with other traits.
For example, in Inform:
makes any containers that are *initially* closed also immovable.
Kinds "have" a ("list of") type ("called" name).
ex.
Matches a set of possible kinds as part of kinds_are_traits.
jess looks for but prohibits leading traits.
inform uses traits specified here to select
matching nouns; jess is not that clever.
matches a span ending with "is/are/comma/and"
Generates a room, a door, or nowhere.
( This i similar to, but distinct from other noun matching phrases. )
A mapping declaration to set the destination of doors.
ex.
The destination of a door is always treated as a room or nowhere.
( Inform doesn't allow nowhere, but it seems like a good idea. )
A mapping declaration starting with a direction.
ex. `[Inside from the Meadow] is... the woodcutter's hut.`
ex. `[West of the Garden] is ... south of the Meadow.`
A mapping declaration starting with a room or door.
ex.
This is the union of all possible matching phrases.
For any given plain text sentence,
jess tries each of these looking for the first to succeed.
Different phrases belong to different scheduled phases;
scheduling is handled manually.
( tbd: an alternative might be slots and some scheduling metadata;
this is fine for now )
Reads a number specified in words or as digits.
Stores the result as the parsed number.
Specifies a name who's meaning depends on context.
For example, when matching: "Gold Roger's treasure chest is a container. The chest is open."
the "chest" implies the noun "treasure chest."
In other cases, the name might be a kind, or trait, or pretty much anything else.
To optimizing matching the words "is/are/comma/and" are never part of name names.
Future: allow quoted "titles" ( which are then allowed to break those assumptions )
Matches an existing noun, or if not: then something new.
Names are adjectives [verb names].
ex.
This is the *only* way of assigning names initial states directly.
All other phrases require a kind to be involved, here the kind is optional.
adjectives are *not* optional.
if there are no adjectives present,
then 'names_verb_names' (might) match instead.
Names are verb (other) names.
ex.
Specifies one or more nouns, in full or in part.
Only one of the options, plus possibly 'additional_names', will match.
Not all options are valid in all contexts.
note that because this phrase is greedy
once used, no additional names will match.
matches existing nouns
used primarily for anonymous nouns: ex. "the container"
note that anonymous nouns are prohibited from starting a sentence.
One or more new trait names,
separated by the word "or".
Assigns a default value to a noun.
ex.
like inform, adjectives ( in phrases with "is" ) cannot be combined with property phrases ( "has/of" )
Matches an existing noun
( by checking multiple words for the best match ).
Assigns a default value to a noun.
ex.
As a special case this also allows a list of quoted text
indicated with "are" ( versus "is" )
the word "of"
Matches text, number, kind ( kind|aspect|record )
as part of 'kinds_have_properties'.
Exactly one member can match.
Matches the name of a field in a kind.
Text that begins and ends with double quotes.
The quotes themselves are not part of the matched text.
One or more strings of quoted text
separated by the words "and", "comma", or "or".
Specific names can follow rule declarations.
ex.
Matches rule prefixes:
before, instead of, when, after, report
Controls what to do after matching a rule.
Matches "then continue", "then stop", "then skip phase",
and "begins", "ends" ( for domain rules )
with an optional leading comma.
This matches only one of its options.
( The options could be represented as a slot; this feels easier for now ).
Phrases can break out of plain text and into structured tell docs.
The documents start with a colon (:) followed by a newline
the next line is assumed to be an indented tell mapping or sequence
which ends with the first unindented line.
Sequences are treated as execute blocks;
Mappings are assumed to be a valid eval
( ie. an implementation of one of the rtti interfaces. )
Matches pattern rule definitions.
the pattern this rule targets.
the pattern must exist for this phrase to generate successfully.
ex. "instead of traveling"
parenthetical text
Matches the name of an (existing) trait.
Matches at least one trait.
Various phrases, all starting with the word "Understand".
all of jess's understand start with quoted text
inform is smart enough to *not* allow articles before actions.
i am lazy.
ex. Understand "birds" and "ruddy ducks" as the plural of duck.
fix? in jess this (also) influences the story interpretation.
this matches one or more nouns or kinds:
generation susses out what to do with those nouns or kinds.
* aliases for nouns: Understand "floor" or "sawdust" as the message.
* aliases for kinds: Understand "cupboard" or "cupboards" or "cabinets" as a cabinet.
* grammar for actions: Understand "reach underneath/under/beneath/-- [something]" as looking under.
jess doesn't permit aliases for kinds, those generate errors.
Verb names are (other) names.
ex.
This intentionally doesn't recognize adjectives attached to named names.
"In the closed coffin" generates a name with the name "closed coffin"
not a coffin in an initially closed state.
A phrase, starting with a verb, that ends a sentence.
ex.
Matches one or more predefined verbs.
( verbs are nouns of the verb kind )
Matches one or more predefined words.
Definitions:
Slots:
Commands:
Commands
Terms:
commaAnd:
CommaAnd
adjectives:
Adjectives
Terms:
commaAnd:
CommaAnd
directionOfLinking:
DirectionOfLinking
additionalDirections:
optional
AdditionalDirections
Terms:
Terms:
commaAnd:
CommaAnd
linking:
Linking
additionalLinks:
optional
AdditionalLinks
Terms:
Terms:
commaAndOr:
CommaAndOr
quotedTexts:
QuotedTexts
Terms:
a container
closed and fixed in place
a closed container and a fixed in place thing
Terms:
traits:
optional
Traits
commaAnd:
optional
CommaAnd
kind:
optional
Kind
additionalAdjectives:
optional
AdditionalAdjectives
Terms:
matched:
Matched
Terms:
text:
Text
The colors are a kind of aspect. The colors are red, blue, and greasy green.
Terms:
Terms:
Terms:
matched:
Matched
Terms:
matched:
Matched
Terms:
matched:
Matched
Slots:
Terms:
article:
optional
Article
matchingNum:
MatchingNum
kind:
Kind
matched:
Matched
Terms:
Terms:
text:
Text
The closed container called the trunk is in the lobby.
Terms:
Slots:
Terms:
A thing can be open or closed.
Terms:
Terms:
names:
Names
are:
Are
kindsAreKind:
Words
traits:
optional
Traits
name:
Name
The closed containers are fixed in place.
Terms:
Things have some text called a description.
Terms:
kind:
Kind
have:
Words
article:
optional
Article
listOf:
optional
Text
propertyType:
PropertyType
calledName:
optional
CalledName
Terms:
traits:
optional
Traits
article:
optional
Article
matched:
Matched
additionalKinds:
optional
AdditionalKinds
Terms:
nowhere:
optional
Bool
kindCalled:
optional
KindCalled
noun:
optional
Noun
name:
optional
Name
Through the long slide is the cellar.
Through the blue door and the red door is the kitchen.
Terms:
through:
Bool
doors:
Linking
additionalLinks:
optional
AdditionalLinks
are:
Are
room:
Linking
Terms:
directionOfLinking:
DirectionOfLinking
are:
Are
linking:
optional
Linking
redirect:
optional
DirectionOfLinking
A dead end called the Airport is west of the Road and north of the Farm.
Terms:
linking:
Linking
are:
Are
directionOfLinking:
DirectionOfLinking
additionalDirections:
optional
AdditionalDirections
Terms:
understand:
Understand
timedRule:
TimedRule
kindsAreKind:
KindsAreKind
aspectsAreTraits:
AspectsAreTraits
kindsAreTraits:
KindsAreTraits
kindsHaveProperties:
KindsHaveProperties
kindsAreEither:
KindsAreEither
mapConnections:
MapConnections
mapDirections:
MapDirections
mapLocations:
MapLocations
propertyNounValue:
PropertyNounValue
nounPropertyValue:
NounPropertyValue
verbNamesAreNames:
VerbNamesAreNames
namesVerbNames:
NamesVerbNames
namesAreLikeVerbs:
NamesAreLikeVerbs
Terms:
value:
Num
Slots:
Terms:
Slots:
Terms:
The bottle is a transparent, open, container.
The coffin is a closed container [in the antechamber].
Terms:
names:
Names
are:
Are
adjectives:
Adjectives
verbPhrase:
optional
VerbPhrase
The thing called the stake is on the supporter called the altar.
Terms:
Slots:
Terms:
countedKind:
optional
CountedKind
kindCalled:
optional
KindCalled
noun:
optional
Noun
kind:
optional
Kind
name:
optional
Name
additionalNames:
optional
AdditionalNames
Terms:
The pen has (the) description (of) "mightier than the sword."
Terms:
Slots:
Terms:
The description of the pen is "mightier than the sword.
Terms:
article:
optional
Article
property:
Property
of:
Words
namedNoun:
NamedNoun
are:
Are
singleValue:
optional
SingleValue
quotedTexts:
optional
QuotedTexts
Terms:
Terms:
Terms:
matched:
Text
Terms:
quotedText:
QuotedText
additionalText:
optional
AdditionalText
( this is the witness light rule )
Terms:
Terms:
None.
Terms:
None.
Terms:
Terms:
quotedText:
optional
QuotedText
matchingNum:
optional
MatchingNum
noun:
optional
Noun
kind:
optional
Kind
Terms:
assignment:
Assignment
Terms:
rulePrefix:
RulePrefix
someone:
optional
Bool
pattern:
Kind
ruleTarget:
optional
RuleTarget
ruleSuffix:
optional
RuleSuffix
ruleName:
optional
RuleName
subAssignment:
SubAssignment
Terms:
Terms:
trait:
Trait
additionalTraits:
optional
AdditionalTraits
Terms:
understand:
Words
quotedTexts:
QuotedTexts
as:
Words
article:
optional
Article
pluralOf:
optional
Text
names:
Names
In the coffin are some coins, a notebook, and the gripping hand.
Terms:
... in the kitchen.
... carries the football and sousaphone.
Terms:
Terms:
text:
Text
Terms:
matched:
Matched