Blocks, short circuit and index of interpretation
One or more instructions can be enclosed in round brackets "(...)" that define the block. Enclosing the instructions in blocks is useful for evaluating the final result of the block instructions, not the individual results of each instruction. For example:
A & B | C - Expression is TRUE if A is TRUE and B is TRUE, or C is TRUE. The evaluation of the expression stops if A and B are True, otherwise it continues analyzing C. In addition, if A is FALSE, the analysis also stops with FALSE.
A & (B | C) - Expression is TRUE if A is TRUE and B or C is TRUE. Evaluation of the expression stops if A is FALSE, or continues by entering the instruction block, evaluating B, interrupting if B is TRUE, and finally also evaluating C.
THE SHORT CIRCUIT: SHORT-CIRCUIT
If you explicitly use logic operators, expressions are interpreted using the SHORT CIRCUIT technique. This means that if the part already interpreted provides a useful value to satisfy the whole expression, the part to be interpreted will be ignored and the circuit will end. For example:
A | B - If A is TRUE, B is not evaluated, as the expression would still give a TRUE result.
A & B - In this case both A and B must have a TRUE value to satisfy the expression, so the expression is evaluated as a whole if A is TRUE. Otherwise, if A is FALSE, it stops, because even if B is evaluated the expression would still be FALSE.
SHORT CIRCUIT AND IMPLICIT AND
In expressions where the operator is not explicitly specified & (AND), the short circuit is not applied. For example:
A B - Expression is evaluated in both A and B, even if A is FALSE. At the end if A and B are TRUE the expression will be TRUE.
A & B - In this case we explicitly used the AND operator. If A is FALSE B it will not be evaluated, because it activates the short circuit that considers the expression FALSE anyway.
SHORT CIRCUIT AND FLAG INSTRUCTIONS
Biblos' language has particular instructions (flag and index) which, if executed, perform specific actions. These instructions are executed only if they are reached by the expression interpreter. Since these are instructions contained in the same line of code to be interpreted, the short circuit system may prevent them from being executed.
If you are using Flag or Index Shift instructions, it is helpful to use the brackets to enclose the instructions to be analyzed with a short circuit, and put the Flag or Index instructions outside of the brackets.
INDEX OF ANALYSIS AND INSTRUCTIONS
Bear in mind that Biblos analyses the text using an index variable. The instructions meet their own conditions (TRUE or FALSE) by reading the text using this special variable. In many instructions you have to specify values. The instruction will use the index variable to check if this value matches the text in which this index is placed. Each instruction always returns a Boolean value (TRUE or FALSE). It will return TRUE if text and value meet, otherwise FALSE.