Skip to content

BindingPower

const BindingPower: {
Assignment: 10;
BitwiseAnd: 22;
BitwiseOr: 18;
BitwiseXor: 20;
Call: 80;
Conditional: 24;
Conjunction: 16;
Exponent: 50;
LogicalAnd: 14;
LogicalOr: 12;
Lowest: 0;
Postfix: 70;
Prefix: 60;
Product: 40;
Shift: 27;
Sum: 30;
};

Defined in: packages/engine/src/parser/BindingPower.ts:12

Named precedence levels for the Pratt parser, from loosest (Lowest) to tightest (Call) binding. A custom infix parselet compares its own binding power against the current expression’s to decide whether to consume the next operator (higher power binds tighter, e.g. * over +).

Package authors reference these when registering an infix parselet via IPackageRegistry.registerInfixParselet. See the built-in packages for examples of picking an appropriate level (e.g. arithmetic +/- use Sum, *// use Product).

readonly Assignment: 10 = 10;
readonly BitwiseAnd: 22 = 22;
readonly BitwiseOr: 18 = 18;
readonly BitwiseXor: 20 = 20;
readonly Call: 80 = 80;
readonly Conditional: 24 = 24;
readonly Conjunction: 16 = 16;
readonly Exponent: 50 = 50;
readonly LogicalAnd: 14 = 14;
readonly LogicalOr: 12 = 12;
readonly Lowest: 0 = 0;
readonly Postfix: 70 = 70;
readonly Prefix: 60 = 60;
readonly Product: 40 = 40;
readonly Shift: 27 = 27;
readonly Sum: 30 = 30;