The following table shows all operators supported by PCC2. Operators have a certain precedence or binding strength, which determines which parts of the expression belong to that operator. For example, in 2 + 3 * 4, the precedence of * is higher than the precedence of +, so the multiplication is performed first. The addition then adds 2 and the result of 3 * 4. The table shows operators in increasing order of precedence, i.e. later operators are evaluated before those shown first.

(1)a; bSequence: evaluate a, discard its result, then evaluate b. This is needed very rarely, but can be useful to perform an assignment before producing the actual value in a search expression, for example.
(2)a := bAssignment: evaluate b, and assign it to a. Returns b.
(3)Or bLogical Or: return True if either operand is True. If the result is known after evaluating a (i.e. a is True), does not evaluate b (short-circuit evaluation).
Xor bLogical Exclusive-Or: return True if one operand is True and one is False. If the result is known after evaluating a (i.e. a is EMPTY), does not evaluate b (short-circuit evaluation).
(4)And bLogical And: return False if either operand is False. If the result is known after evaluating a (i.e. a is False), does not evaluate b (short-circuit evaluation).
(5)Not aLogical Not: return True if operand is False, False if operand is True.
(6)a = bComparison: return True if a is identical to b. Values must have comparable types; when you attempt to compare a number and a string, this will generate an error.
a <> bComparison: return True if a is different from b. Note that values still must have comparable types.
a < bComparison: return True if a is less than b.
a > bComparison: return True if a is greater than b.
a <= bComparison: return True if a less or equal to b.
a >= bComparison: return True if a is greater or equal to b.
(7)a # bConcatenation: convert a and b to strings and concatenate them.
a & bConcatenation: convert a and b to strings and concatenate them. If either is EMPTY but the other is not, treat the EMPTY one as empty string.
(8)a + bAddition: add a and b, which may be numbers or strings.
a - bSubtraction: subtract b from a, which must both be numbers.
(9)a * bMultiplication: multiply a and b, which must both be numbers.
a / bDivision: divide a by b, which must both be numbers.
a \ bInteger division: divide a by b, which must both be integers, and discard the remainder.
Mod bInteger remainder: divide a by b and return the remainder. Both operands must be integers.
(10)-aNegation: change sign of a, which must be a number.
+aUnary plus: do not change sign of a, which must be a number. Exists for symmetry with "-".
(11)a ^ bPower: compute a-to-the-bth. Both operands must be numbers.

Operands

Operands to operators are shown as "a" and "b" above. The following things are possible operands:

  • literals.
  • an expression of higher precedence, as shown in the multiplication/addition example above the table.
  • an expression within parentheses.
  • a function call.
  • a variable or property.
This is a testing version.
It may be incomplete, and have more bugs (or features) than the public live version at planetscentral.com.