12. Step computation
So far we have seen how BP2 can be used
to produce items randomly. BP2 makes decisions on candidate rules and positions
of derivation following a (pre-set) pseudo-random sequence generated by the
computer, as indicated in §5.1.
Another way of controlling computation
is to make stepwise decisions on candidate rules. This becomes possible by
selecting option "Choose candidate rule" (see
Fig.31 infra). Now BP2 will display computation steps along with the rules
used, prompting the user to click "Resume" at each step. When there
are several candidate rules the user is prompted to mark the selected one.
Fig.31 Prompting the user for a rule
To select a rule just click on it, then
click "Resume" or type cmd-r. If the "Resume-Undo-Stop"
window disappears you may click the upper bar (the drag region) of the "Trace"
window to bring it to front.
In the example below rule "X -->
a" has been selected:
Fig.32 Selecting a candidate rule
If your decision leads to an
unacceptable solution you may undo the computation typing cmd-z or selecting "Undo" in the "Action" menu. Undoing permits to
backtrack as far as possible.
At any stage of the computation you may
want to stop and save current choices. Click button "Save decisions". The current grammar is saved along with decisions.
Decisions include the index of the subgrammar, the index of the selected rule
and the position of the current derivation.
When loading a decision file (clicking "Load decisions")
BP2 first checks whether or not the grammar currently in memory is the same one
as the grammar to which decisions were refering. (BP2 remembers the date and
time at which the grammar was compiled.) If the grammar has changed it suggests
to delete the current grammar and replace it with the version saved along with
the decision file.
Forcing a set of decisions on a grammar
which is no longer compatible may produce unpredictable results
including crashing the system
.
Once a decision file
is loaded, select "Step-by-step compute" and
click "Repeat computation". When reaching the
point at which the production had been interrupted, the user is prompted to
continue making his/her own decisions.