There are two kinds of expressions, depending on their result: absolute expressions, which resolve to a constant (that is, they do not involve any values unknown to GASP), and relocatable expressions, which must reduce to the form
addsym+const-subsym
where addsym and subsym are assembly symbols of unknown value, and const is a constant.
Arithmetic for GASP expressions follows very similar rules to C. You can use parentheses to change precedence; otherwise, arithmetic primitives have decreasing precedence in the order of the following list.
+ (identity), - (arithmetic opposite), or
~ (bitwise negation). The argument must be an absolute
expression.
* (multiplication) and / (division). Both arguments
must be absolute expressions.
+ (addition) and - (subtraction). At least one argument
must be absolute.
& (bitwise and). Both arguments must be absolute.
| (bitwise or) and ~ (bitwise exclusive or; ^ in
C). Both arguments must be absolute.