Pratt Parser
open class PrattParser<S : Scanner<*>, C, R>(val parsePrimary: (S, C) -> R, val buildUnary: (S, C, String, R) -> R, val buildBinary: (S, C, String, R, R) -> R, vararg operators: Operator)
A simple configurable expression parser.
S is the scanner type
C is the type of the parsing context, typically holding variable definitions etc.
R is the type of the parsed expression.
The parser is primarily configured by providing buildUnary and buildBinary callbacks along with Operator definitions (Operator.Prefix, Operator.Infix, Operator.InfixRtl, Operator.Suffix) specifying operator names and precedences.
Constructors
Functions
Link copied to clipboard
Link copied to clipboard
Convenience overload for PrattParser instances with Unit context.