The following short examples illustrate the usage of specific controls of the inference mechanism in grammars of Bol Processor (BP2 and BP3).
This instruction is useful in pattern grammars containing repetition and pseudo-repetition markers. For instance, the following grammar creates a sequence of two occurrences of variable “X” which may further be derived as “abc” or “de”.
S --> (= X)(: X)
X --> abc
X --> de
In the first rule, (= ) is called a master parenthesis and (: ) a slave parenthesis — containing a copy of the former. This master-slave dependency is maintained throughout subsequent derivations.
The only eligible final derivations would be “abcabc” or “dede”. However, the final string would be displayed for instance “(= abc)(: abc)”. To obtain a usable string in which ‘a’, ‘b’, ‘c’ may be further instantiated as sound-objects, it is necessary to remove structural markers. The Bol Processor does it automatically once the final string has been created, i.e. there are no more candidate rules for further derivations. However, the user may want to display strings without their markers. Instruction _destru is used to this effect.
Let us consider for instance “-gr.tryDESTRU”:
// This grammar produces various patterns on alphabet …
gram#1 <2-1> S --> (= (= X) S (:X)) (: (= X) S (:X))
gram#1 <2-1> X --> Y
gram#1 <2-1> X --> Y S Z
gram#1 <2-1> X --> Z
gram#2 LEFT S --> lambda [This is an erasing rule]
gram#3 X X --> abca
gram#3 Z Y --> abc
gram#3 Y Z --> cba
gram#3 Y Y --> cbbc
gram#3 Z Z --> lambda [This is an erasing rule]
The first rule in subgrammar #1 creates a self-embedding pattern in which the start symbol S is created again recursively. This recursivity might produce unlimited strings. To avoid this, each rule in subgrammar #1 is assigned initial weight “2” decreased by “1” once the rule has been fired. Therefore, no rule may be used more than 2 times. Subgrammar #2 contains a single rule deleting the left-over “S”.
Subgrammar #3 destroys the structure by erasing all parentheses and master/slave markers, then it rewrites variables “X”, “Y”, “Z” as strings of terminal symbols. Tracing the production shows for instance that workstring
(=(= Z)(=(= Y)(: Y))(:(= Y)(: Y))(: Z))(:(= Z)(=(= Y)(: Y))(:(= Y)(: Y))(: Z))
is replaced with “Z Y Y Y Y Z Z Y Y Y Y ZZ Y Y Y Y Z Z Y Y Y Y Z”.
Rewriting is then done strictly from left to right due to the LIN instruction.
The following is a series of 10 items produced by this grammar:
Complex patterns are visible on the following sound rendering of the first item using “-mi.abc” sound-object prototypes.