Page Numbers: Yes First Page: 1
Heading:
UNPUBLISHED WORKING DRAFT - DO NOT COPY OR DISTRIBUTE
November 16, 1977 3:13 PM 8: Signals [IFS]<KRL>specs>signals.bravo
8. Type declarations and Signal documentation for the KRL-1 matcher
8.1 The Standard Tables
There is a defualt signal table (the value of DefaultSignalTable) which is used to determine the response by any signal not caught be the signal table mentioned in the call to the aligner. All of the other tables are fragments, which are designed to be appended to the front of a complete table. All are available as values of global variables. These fragments have names ending with SF (signal fragment). Since tables are lists, the normal list structure operations work, but there is a function MatchTable of an arbitrary number of arguments which appends copies of all but the last to the last. By using this explicitly in the call (i.e. not through a bound variable), the access compiler can recognize what is being done, and handle the cases it knows:
(Align \A Foo with bar = @Do(’(Bind x Primary))/
\$F23:self
(MatchTable MultipleSeekSF UseTriggersSF SimpleMatchSF)
If all of these are system-known names, the appending will be done only once. If they are other variables, it will be done each time the Align is called.
All of the actual tables in the system appear in the file SIGTABLES. It is the final authority for all of this.
8.1.1 The defaults
This is the default table everywhere but the editor -- it is what you get with a NIL argument to Align, etc. It is basically intended to do simple accessing. Its main features are:
1. The effective description at every level of recursion into the pattern consists of datum structure plus the results of following coreferences. No other links are followed.
2. The only goal for a pattern element is to find a single datum element which matches it structurally. Logical descriptors in the pattern are treated as follows:
Or creates a simple split;
Not creates a subgoal and does the appropriate sign inversion;
SetOf looks for a SetOf descriptor in the datum and tries to match the argument to its argument, or a complete enumeration and sets up conjunctive goals of matching the argument to all of them. Same for SequenceOf.
This says what is done with these descriptors in the pattern. If found in the datum, they are ignored except as mentioned for matching SetOf and SequenceOf
3. All demons and servants are used
4. Categories are checked
5. Only a single value is sought
6. Value returned for SUCCEESS is a list containing the binding list. If there are no bindings, this will result in (NIL)
7. Value returned for FAIL is NIL.
8. If the aligner runs out of things to do, the match fails
9. All of the signals for catching things the user might want to handle (e.g. UnknownInterpretedMapDInPattern) result in a HELP.
8.1.2 Fragments
AllResultsSF: This is used with any match table to add the following effect:
1. Multiple results are sought.
2. Full binding set is returned as a list of A-lists.
CanMatchSF: This is used with any match table to add the following effect:
1. If the aligner runs out of stuff to do without having fail, the alignment succeeds.
DescribeSF: This is used with any match table (although it is not clear what combinations are useful) to add the following effect:
1. After the match has been set up, but before non-trivial goals are run, a DESCRIBE pass occurs in which descriptors are added wherever necessary to make the alignment succeed.
2. Value returned is whatever bindings were accumulated in list of list form.
GenerateSeekSF: This is used with any match table to add the following effect:
1. It assumes that there is a single Bind action in the pattern (as is the case with a Seek CLISP form).
2. When a value is found, it is PRODUCEd and the aligner goes on looking for others.
3. Final value is list of bindings.
MultipleSeekSF: This is used with any match table to add the following effect:
1. It assumes that there is a single Bind action in the pattern (as is the case with a Seek CLISP form).
2. Multiple results are sought. When all are found, they are returned in a single list with no explcit binding variable -- i.e. the value is a list of the result values.
NoDemonsSF, NoServantsSF, NoProceduresSF: These are used with any match table to add the following effect:
1. No demons, servants, or either, respectively are used
OverWriteSF: This is like the DescribeSF, except that in addition:
1. If the new description would contradict one already there, the old one is removed.
SimpleCanMatchSF: This is used with any match table to add the following effect:
1. If the aligner runs out of stuff to do without having failed, the alignment succeeds.
2. No links of any kind are followed.
SimpleSeekSF: This is used with any match table to add the following effect:
1. It assumes that there is a single Bind action in the pattern (as is the case with a Seek CLISP form).
2. The value itself is returned.
StructuralMatchSF: This is used with any match table to add the following effect:
1. Interpreted map descriptors are treated like other map descriptors, not using the special semantics of NOT, OR, etc.
Note that this match is really structural, NOT semantic. The pattern \A Foo with bar = Not(A Frob)/ will succeed against the datum \A Foo with bar = Not(A Frob with stuff = 3)/ but will fail against \A Foo with bar = A Bletch/ regardless of the incompatibility (including categories) of Frob and Bletch. Similarly, \Or(A Foo, ..., A Bletch)/ will succeed against \Or(A Foo with bar = 3, A Mumble, A Bletch) but will fail against either \A Foo/ (which is not an Or) or \Or(A Bletch, A Foo)/ (because the arguments are in the wrong sequence).
2. No links of any kind are followed.
UsePrototypesSF: This is used with any match table to add the following effect:
1. Links to prototype anchors are followed.
8.2 The actual Signals
The following is a partial list of the signals generated in the Align code. There are many missing, especially those associated with triggers. It reflects the current state of align.bravo and classes.bravo, but cannot be trusted as they evolve.
This was in the original specs. Where do we want to put this kind of hook?
AddingGoal: About to add a goal to the goal set. This means that it was not trivially satisfied (which it checks before actually building a goal data structure). It is the user hook for doing arbitrarily fancy things to the goal structure.
AllGoalsSuspended
generated in: RunGoal
reason: There are active goals, but they are all suspended.
relevant variables: all of the FullAlign free variables, esp. activeGoals
responses:
OK -> unsuspend all suspended goals and go on
SUCCEED -> the Align succeeds with the usual signals
FAIL -> the Align fails with the ususal signals
else -> the alignment goes on, the response having unsuspended something on activeGoals or added a new unsuspended goal
CompletedTopGoalResult
generated in: SuccessfulResults
reason: The top level goal succeeded with one or more results. The go-ahead was given (via response to FoundTopGoalResult) to do the actions for newResult. They have been done, and newResult has been pushed on oldResults.
relevant variables: newResult oldResults pendingResults alignValue
responses:
STOP -> the Align succeeds immediately, with resultValue or bindings for this result added to alignValue
OK -> the result is added to alignValue and the process goes on
else -> ignore this result and go on
ConvertingReflexiveInDatum
generated in: Reflexive/TRY
reason: A reflexive has been found in the datum (most likely in a description inherited from a prototype). A corresponding map descriptor will be produced (actually building memory structure in a scratch space) and used.
relevant variables: self goal
responses:
OK -> do it
else -> don’t
CreatingInstanceForMapLink
generated in: FindInstance
reason: An anchor is being created for the self filler of a map descriptor in order to provide the instance for the context of a link.
relevant variables: mapD prototype anchor
responses:
OK -> create the anchor and use it for the link
SKIP -> the variable anchor has been set to the appropriate instance to use in the link
else -> don’t create the link
FollowingCoreference
generated in: Coreference/ADDLINK
reason: A coreference appears in the datum. The anchor it points to will be used to get more datum descriptors. At the time of this signal, the link is being added, not followed.
relevant variables: self goal fullContext
responses:
OK -> add a link to the goal
else -> don’t
FollowingCoreferenceInPattern
generated in: AlignCoreference/AFTERFIRST
reason: A non-primary coreference in the pattern didn’t match immediately. Try to find a post for it (using full-scale Find) then match that post against the datum.
relevant variables: self
responses:
OK -> look for the post
else -> don’t
FollowingMapLink
generated in: MapDescriptor/ADDLINK
reason: this looks in the slots of the mapD to see if they can be inverted. e.g. if the mapD is \The x from a y thatIs z/ then it looks in anchor z for \a y with x = .../ and creates a link to the x filler anchor. Not currently implemented
relevant variables: self
responses:
OK -> look for the linked anchor
else -> don’t
FoundTopGoalResult
generated in: SuccessfulResults
reason: The top level goal succeeded with one or more results. There may be still others to be found, but at least one batch has arrived. newResult is on neither oldResults nor pendingResults. The actions for the result have not been taken. This is the place to stick in a PRODUCE if you want Align to act as a generator.
relevant variables: newResult oldResults pendingResults alignValue
responses:
STOP -> the Align succeeds immediately, nothing new added to alignValue
OK -> the result is processed for actions
else -> ignore this result and go on
GeneratingDescription
generated in: LispPointer/ADDLINK, KrlPointer/ADDLINK
reason: A KrlPointer or MapDescriptor was found in the datum. A LINK will be created to a description of the object (as generated by the appropriate function), e.g. \A LitAtom/, for use by the pattern. Not implemented yet
relevant variables: self (the descriptor), goal, fullContext
responses:
SKIP -> don’t add the link
OK -> do
else -> error
ImplicitDescribe
generated in: FullAlign
reason: To set the value of variable describe used to decide whether to satisfy a goal by adding the pattern descriptors to the datum.
relevant variables:
responses:
OK -> do a describe
else -> don’t
LinkingToPrototype
generated in: MapDescriptor/ADDLINK
reason: The datum includes a map descriptor. A link is made (with appropriate context) to the prototype slot for its focus slot.
relevant variables: self goal fullContext
responses:
OK -> put in the link
else -> don’t
LinkingToPrototypeSelf
generated in: MapDescriptor/ADDLINK
reason: The datum includes a map descriptor with focus slot a self slot. A link is made (with appropriate context) to the prototype slot.
relevant variables: self goal fullContext
responses:
OK -> put in the link
else -> don’t
NotEnoughItemsFound
generated in: SetUpFind
reason: A find of nth element was tried on a set or sequence with fewer than n elements
relevant variables: candidates count immediateBindings
responses:
OK -> ignore the binding and go on with the match
else -> cause a failure for the goal trying the binding
NothingHappened
generated in: RunGoal
reason: There are active goals, but on a complete cycle, nothing happened.
relevant variables: all of the FullAlign free variables, esp. activeGoals
responses:
OK -> unsuspend all suspended goals and go on
SUCCEED -> the Align succeeds with the usual signals
FAIL -> the Align fails with the ususal signals
else -> the alignment goes on, the response having changed something so something will happen
NothingToDo
generated in: RunGoal
reason: There are no active goals.
relevant variables: all of the FullAlign free variables, esp. activeGoals, alignValue
responses:
SUCCEED -> the Align succeeds with the usual signals
FAIL -> the Align fails with the ususal signals
else -> the alignment goes on, the response having put something on activeGoals
PartialResultFound
generated in: GoalPartiallySucceeded
reason: One set of results were returned for a goal. others are potentially available.
relevant variables: goal results
responses:
STOP -> suspend the goal (and its descendants)
else -> don’t
SimpleCanMatch
generated in: FullAlign
reason: To set the value of variable canMatch used to decide whether to pursue a goal or simply pass up the value INCOMPLETE if it doesn’t fail immediately.
relevant variables:
responses:
OK -> do a simple structural can-match
else -> don’t
StructuralMatch
generated in: FullAlign
reason: To set the value of variable structuralMatch used to decide whether to pursue a goal or simply pass up the value FAIL if it doesn’t succeed immediately.
relevant variables:
responses:
OK -> do a structural match
else -> don’t
SuspendAfterResult
generated in: CheckDisjunctCompletion
reason: A disjunction succeeded with one set of results.
relevant variables: goal
responses:
OK -> Suspend all of the other alternatives
else -> go on
UngroundedAction
generated in: SetUpAction
reason: The pattern specifies an action to be taken, but it would not be taken on a part of the original datum.
relevant variables: doArg anchorPath
responses:
OK -> Ignore this action and go on
else -> Alignment is aborted
UnknownActionType
generated in: DoActions
reason: A Do functional contains an unknown first element (action type). This happens after the match has succeeded and actions ar being done.
relevant variables: action
responses:
whatever -> Go on assuming user has put in right type. This needs to be improved.
UnknownBindingType
generated in: SetUpAnchorMatch
reason: A Pattern element has a metadescriptor which is not a Do functional.
relevant variables: anchorGoal meta metaDescriptor
responses:
OK -> Ignore this metadescriptor and go on (action can modify the goal)
else -> Alignment of the anchor fails
UnknownInterpretedMapDInDatum
generated in: InterpretedMapD/TRY
reason: A datum element is an interpreted map descriptor which is not recognized, and the match is not a structural match. It is being tried on some goal.
relevant variables: self goal fullContext
responses:
whatever -> go ahead. if you want the descriptor use, make calls to the functions which use it (e.g. TryDescriptor..., AddLink...). If you want the match to succeed or fail, do it directly (e.g. GoalDone... AlignCompleted...)
UnknownInterpretedMapDInPattern
generated in: InterpretedMapD/SETUP
reason: A Pattern element is an interpreted map descriptor which is not recognized, and the match is not a structural match. A goal has been set up with goalType blank
relevant variables: self goal
responses:
OK -> go ahead (the goal record has been fixed up)
SUCCEED -> the goal for this descriptor succeeds
FAIL -> the goal for this descriptor fails
else -> Abort the alignment
UnknownMetaOnPatternAnchor
generated in: AlignAnchor/SETUP
reason: A Pattern element has a metadescriptor which is not a Do functional.
relevant variables: self meta metaDescriptor
responses:
OK -> Ignore this metadescriptor and go on (action can modify the goal)
else -> Alignment of the anchor fails
UsingCategoriesForPatternCoreference
generated in: AlignCoreference/STARTUP, AlignPost/STARTUP
reason: A coreference didn’t match immediately, so we can use categories from the anchor it points to to try to make match fail.
relevant variables: self
responses:
OK -> get the categories
else -> don’t
UsingTrap
generated in: DoTraps
reason: An applicable trap has been found.
relevant variables: ANCHOR WORLD type trap
responses:
OK -> go ahead and evaluate the trap form (the variable trap can be reset)
else -> don’t
UsingTrigger
generated in: DoTriggers
reason: An applicable trap has been found.
relevant variables: SLOT PROPTYPE INSTANCE WORLD type trigger
responses:
OK -> go ahead and evaluate the trigger form (the variable trigger can be reset)
else -> don’t
ValueForAbortedAlign
generated in: AbortAlign
reason: function AbortAlign was called anywhere in alignment process, or top level goal was aborted.
relevant variables: alignValue
responses:
OK -> return value of alignValue for value of fn FullAlign
else -> return NIL
ValueForAlign
generated in: AlignCompleted
reason: The FullAlign was completed successfully. The value returned from FullAlign will be the value of the free variable alignValue.
relevant variables: alignValue
responses:
OK -> return value of alignValue for value of fn FullAlign
else -> error
ValueForAlignFailed
generated in: AlignCompleted
reason: The FullAlign was completed because of failure. The value returned from FullAlign will be the value of the free variable alignValue.
relevant variables: alignValue
responses:
OK -> return value of alignValue for value of fn FullAlign
else -> error
WrongTypeForBinding
generated in: GetPost
reason: the binding type argument didn’t agree with the post descriptor. e.g. a Primary was asked for and a LispPointer found.
relevant variables: descriptor bindingType
responses:
value returned by signal is returned as value of GetPost