User guide
2.2. EXPRESSIONS 21
2.2.8 VALOF Expressions
An expression of the form VALOF C, wh er e C is a command, is evaluated by
executing the command C. On encountering a co m m an d of the form RESULTIS E
within C, execut i on terminates, returni n g the value of E as the result of the VALOF
expression. Valof expressions are often used as the bodies of functions.
2.2.9 Expression Precedence
So that the separator semicolon (;) can be omitted at the end of any line, there
is the restriction that infi x ed operators may not occur as the first token of a line.
So, if the first token on a line i s !, + or -, these must be regarded as prefixed
operators.
The syntax of BCPL is specified by the diagrams in Appendix A, but a sum-
many of the precendence of expression op er a to r s is given in tab l e 2.1. The prece-
dence values are in the range 0 to 9, with the higher values signifying greater
binding power. The letters L and R denote the associativity of the operators.
For instance, the dyadic operator - is left associative an d so a-b-c is equiva-
lent to (v-i)-j, while b1->x,b2->y,z is right associative an d so is equivalent to
b1->x,(b2->y,z).
9 Names, Literals, ?,
TRUE, FALSE, BITSPERBCPLWORD
(E),
9L SLCT : Field selector constants
Function and method calls
8L ! % OF Dyadic
7 ! @ Prefixed
6L * / MOD REM Dyadic operators
5 + - ABS
4 = ~= <= >= < > Extended Relati on s
4L << >>
3 ~ NOT Bitwise and Boolean operators
3L &
2L |
1L EQV NEQV XOR
1R -> , Conditional expression
0 VALOF TABLE Valof and Tab l e expressions
Table 2.1: Operator preced en ce