Variables and terminal symbols

A terminal symbol is a symbol to which a single sound-object may be assigned. Terminal symbols are either predefined (see QuickStart §1.4: simple notes) or enlisted in an alphabet file (with prefix "-ho.").

Terminal symbols always start with a lower-case character a..z, or a character in the set


and may contain any character in the above set or in the additional set:


These restrictions are not applicable to terminal symbols defined between single quotes in a grammar.

Terminal symbols may be mapped to one another through one or several (non-erasing) homomorphisms. A homomorphism named 'OCT' may for instance be used to define octaves in a terminal alphabet of simple notes in the English convention:

C0 --> C1 --> C2 --> C3 --> C4 --> C5 --> C6 --> C7 --> C8 --> C9 --> C10
C#0 --> C#1 --> C#2 --> C#3 --> C#4 --> C#5 --> C#6 --> C#7 --> C#8 --> C#9 --> C#10
Db0 --> Db1 --> Db2 --> Db3 --> Db4 --> Db5 --> Db6 --> Db7 --> Db8 --> Db9 --> Db10
D0 --> D1 --> D2 --> D3 --> D4 --> D5 --> D6 --> D7 --> D8 --> D9 --> D10
D#0 --> D#1 --> D#2 --> D#3 --> D#4 --> D#5 --> D#6 --> D#7 --> D#8 --> D#9 --> D#10

Similarly, a homomorphism named 'TRANS' would for instance transpose all simple notes one semitone higher:

C0 --> C#0 --> D0 --> D#0 --> ...

These homomorphisms are edited in the "Alphabet" window and stored in "-ho.<name>" files. See for instance "-gr.MyMelody", §4.10 infra. Examples of homomorphisms doing tonal transformations other than transpositions may be found in "-gr.Ruwet" and in "-gr.cloches1".

A variable is a symbol bound to be rewritten as a string of terminals and/or variables (in a derivation of the grammar). The label of a variable is either an alphanumeric string starting with an uppercase character, or written between |vertical bars|, and may otherwise contain any character in the set:


When BP2 reads a grammar it first assumes any unknown word to be a variable. Therefore, if that word is not between vertical bars and does not begin with an uppercase character, an error message is returned. Be careful to separate variables with spaces or tabulations. If you write "XYZ", a variable named "XYZ" is created although you perhaps meant "X", "Y" and "Z"... However, spacing is not necessary for stringing together predefined tokens like terminal symbols.

The concepts of terminal symbols and variables are slightly different in BP grammars and conventional formal grammars. In formal grammars, "terminals" are the symbols that cannot be rewritten; in BP grammars they denote labels of hypothetic sound-objects. BP2 makes no difference between terminal symbols and variables as far as derivations are concerned. This means that even BP terminal symbols might be used as variables in production rules. (Not recommended)