Numlex Documentation
Syntax Reference

Operators & logic

Full precedence, arithmetic, comparisons, boolean logic (true short-circuit rules) and the exact Int64 bitwise lane.

Main branch reference after R89 · released versions may differ docs/SYNTAX_REFERENCE.md @ 1ebc752

Every expression in Numlex is evaluated by one strict operator grammar: a single precedence ladder for arithmetic and logic, real boolean values (never 1/0 coercion), and a separate exact-integer lane for bitwise work.

This page is the complete operator reference: precedence from if/then/ else down to postfix operators, what each operator means, exactly where the language short-circuits (&& with a false left side — and nowhere else), and the Int64 lane’s own precedence table, checked shifts and overflow behavior.

Precedence

From lowest to highest:

if … then … else …     (right-associative)
or  /  ||
and /  &&
not /  !
==  !=
<  <=  >  >=
+  −                   (left)
*  ×  /  ÷             (left; `of` after a percent or multiplier is this level)
^                      (power, right)
unary + / −
primary                (literals, parentheses, calls, % and x postfixes)

Operators

OperatorMeaningNotes
+ addition / subtractionin an additive context a right-hand “pure” percent is a share of the accumulated left side: 100 + 10% = 110
* × / ÷multiplication / division200 × 10% = 20, 200 / 10% = 2000
^powernever XOR (XOR is the word xor on the integer lane)
% (postfix)p% = p/100semantic “percent” in an additive context
x (postfix)1.5x = multiplier 1.5recognized only when no variable x is active
of (infix, * level)15% of 490 = 73.5the left side must be a percent or a multiplier (1.5x): 1.5x of 20 = 30, chains 10% of 20% of 50 = 1; 3 of 4 is an error. In percent lines the basis of N% of E is the rest of the line: 15% of 490 + 5 = 74.25
< <= > >=comparisonsnumeric; the result is boolean
== !=equality / inequalityboolean result
and &&conjunction&& short-circuits only on a false left side: false && (1/0 > 0) = false; true && … and the word and always evaluate the right operand
or ||disjunctiondoes not short-circuit: both operands are evaluated — false or (1/0 > 0) and false || (1/0 > 0) are division-by-zero errors
not !negationprefix
if a then b else cconditionallowest precedence; the branches are full expressions; else is required

More on the percent and multiplier forms is in Percentages.

Booleans are a real type

true and false are never coerced to 1/0. Mixing a boolean and a number in one operator is an error.

Glyphs versus words

  • The glyphs & and | are always bitwise: used with boolean operands they are an error (false | (1/0 > 0) → “Invalid expression”).
  • Only the words and/or are contextual: two integers make them bitwise, two booleans make them logical.

The integer lane (exact Int64)

The lane is activated by:

  • Strong: literals 0x… / 0b… / 0o…, the calls int( bin( oct( hex(, the phrases … as|in <base> / … to base N, the bitwise glyphs & | << >>, and the word xor. Glyphs only count when the line has mathematical content — fish & chips stays prose.
  • Weak: the word and/or with “mathematical” neighbours.

Lane precedence, from lowest to highest:

if/then/else  →  ||  →  &&  →  | / or  →  xor  →  & / and
→  comparisons == != < <= > >=  →  shifts << >>  →  + -  →  * / %  →  ^
→  unary  →  primaries
OperatorMeaningNotes
&bitwise AND
|bitwise ORthe glyph is always bitwise: boolean operands are an error (false | (1/0 > 0))
xorbitwise XOR (word)6 xor 3 = 5
<<left shiftshift 0…63; overflow is an error (checked)
>>right shiftshift 0…63; arithmetic for negative values
/integer divisionleaves the lattice for Double when there is a remainder
%remainder
^powerexponent is checked; a negative exponent produces a Double

All lane values are exact Int64: 0x7FFFFFFFFFFFFFFF = 9223372036854775807. Overflow is a visible error — never wraparound, never a silent Double. Division with a remainder, a negative exponent, and non-integer values all “leave” the lattice into Double, so use explicit parentheses at the boundaries between lanes.

The literal forms, base names and verified examples live in Numbers & integer bases.

Found an issue in these docs? Report it on GitHub .