KthOperator

Operator token to be included in a KthModule or KthContext and used in an expression.

An operator takes two arguments (one on the left and one on the right) and returns a value.

Operators can be built using the helper functions createOperator and asOperator.

Properties

Link copied to clipboard
abstract val key: String

The key of the token. Used to parse the token in an expression.

Link copied to clipboard
abstract val leftAssociative: Boolean

Whether the operator is left associative, which is used to determine the order of operations.

Link copied to clipboard
abstract val precedence: Int

The operator precedence, which is used to determine the order of operations.

Functions

Link copied to clipboard
abstract operator fun invoke(left: Double, right: Double): Double

Applies the operator to the given arguments.