Skip to content

Operators

The lexer recognizes operators such as:

+ - * / % = == != > >= < <=

The parser determines how these operators are structured.

Conceptually, NXL parses expressions through these precedence levels:

assignment
logical OR
logical AND
equality
comparison
term
factor
unary
call
primary

For:

let result = a + b * 2

the AST is:

+
/ a *
/ b 2

Therefore b * 2 is evaluated first, producing:

a + (b * 2)

This is handled by the parser, not the lexer. The lexer only identifies the individual tokens.