Skip to main content

infix

Create an infix operator, given a binding power and a function that evaluates the node.

def infix(
bp: int,
func: callable
) - > class

Create an infix operator, given a binding power and a function that evaluates the node.

Parameters

NameTypeDescription
bpintThe left binding power (lbp) which determines the operator precedence level during parsing
funccallableA function that accepts a context and two operands to evaluate the result of the infix operation

Returns

TypeDescription
classA new Operator class inheriting from TokenBase with the specified binding power and evaluation logic