Operand (aka "something that can be assigned") = Identifier
Factor = Operand |
Constant |
"-" Factor |
"(" Expression ")" |
FunctionName [ "(" Expression [{"," Expression}] ")" ]
FactorOperator = "^" | "*" | "/" | "%" | "div"
# In other words, all multiplicative operators have the same priority
# and are left-associative.
# "^" operator is for power.
# X ^ Y = Power(X, Y)
# This works for non-integer Y, but in this case Y has to be >= 0.
# "%" operator is for modulo (remainder of division).
# X % Y = X - Floor(X/Y) * Y
# "/" does float division. Like in Pascal (and unlike C),
# result is always float, even when both operands are integers
# (they will be just converted to floats).
# E.g. "1 / 2" and "1.0 / 2.0" are equivalent and both yield "0.5".
# "div" does integer division, returns integer,
# and requires both operants to be integer (cannot be floats).
# E.g. "1 div 2" is "0