User guide

22 CHAPTER 2. THE BCPL LANGUAGE
Notice that these precedence values imply that
! f x means ! (f x)
! @ x means ! (@ x)
! v ! i ! j means ! ((v!i)!j)
@ v ! i ! j means @ ((v!i)!j)
x << 1+y >> 1 means (x<<(1+y))>>1)
~ x!y means ~ (x!y)
~ x=y means ~ (x=y)
NOT x=y means NOT (x=y)
b1-> x, b2 -> y,z means b1 -> x, (b2 -> y, z)
2.2.10 Manifest Constant Expressio ns
Manifest constant expressions can be evaluated at compile time. They may
only consist of manifest const ant names, numbers and character constants, TRUE,
FALSE, BITSPERBCPLWORD, ?, the operators REM, MOD, SLCT, *, /, +, -, ABS, the
relational operators, <<, >>, NOT, ~, &, |, EQV, NEQV, XOR, and conditional ex-
pressions. Manifest expressions are used in MANIFEST, GLOBAL and STATIC dec-
larations, the upper bound in vector declaration s and the step length in FOR
commands, an d as the l eft hand operand of OF.
2.3 Commands
The primary purpose of commands is for updating variables, for input/output
operations, and for controlling the flow of control.
2.3.1 Assignments
A command of the form L:=E updates the lo ca ti o n specified by the expressi on
L with the value of expression E. The following are some examples:
cg_x := 1000
v!i := x+1
!ptr := mk3(op, a, b)
str%k := ch
%strp := ’A’
SLCT 8:10:1 OF p := 5
Syntactically, L must be either a variable name or an expression whose leading
operator is !, % or OF. If it is a name, it must have been declared as a static or
dynamic variable. If the name denotes a function or label, it is only updateable
if it has been declared to reside in the global vector. If L has leading opera t or !,
then the location it refers to is updated by the assignment. If the % operator is