Expressions

An expression is, in simple terms, "something which has a value". Numbers and strings are expressions. Numbers plus numbers are expressions, and so are function calls. More formally, expressions can be:

A single term, such as:

Or a compound expression, such as:

Precedence

In standard mathematics, the expression "1 + 6 * 7" evaluates to 43: you perform the multiplication first, and then the addition. This is formalized in the notion of operator precedence; that is, certain operators such as multiplication have a higher priority than other operators such as addition.

Frost's operator precedence, from highest to lowest, is:

  1. ., ->, (), []
  2. - (unary), !, !!
  3. *, /, //, %, <<, >>
  4. &&, ||, ~~
  5. +, - (binary)
  6. .., ...
  7. =, !=, ==, !==, >, <, >=, <=
  8. &, ~,
  9. |