gasp.info: Expressions

Go forward to String Builtins
Go backward to Symbols
Go up to Syntax Details
Go to the top op gasp

Arithmetic expressions in GASP

   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.
  1. Single-argument `+' (identity), `-' (arithmetic opposite), or `~'
     (bitwise negation).  _The argument must be an absolute expression._
  2. `*' (multiplication) and `/' (division).  _Both arguments must be
     absolute expressions._
  3. `+' (addition) and `-' (subtraction).  _At least one argument must
     be absolute._
  4. `&' (bitwise and).  _Both arguments must be absolute._
  5. `|' (bitwise or) and `~' (bitwise exclusive or; `^' in C).  _Both
     arguments must be absolute._