chomp/pratt

This module is very similiar to the elm-pratt-parser package in the Elm ecosystem, and much of its docs apply to this module.

Types

pub opaque type Config(a, e, tok, ctx)
pub opaque type Operator(a, e, tok, ctx)

Functions

pub fn expression(
  one_of first: List(fn(Config(a, b, c, d)) -> Parser(a, b, c, d)),
  or_error or_error: b,
  and_then then: List(Operator(a, b, c, d)),
) -> Parser(a, b, c, d)
pub fn infix_left(
  precedence: Int,
  operator: Parser(a, b, c, d),
  apply: fn(e, e) -> e,
) -> Operator(e, b, c, d)
pub fn infix_right(
  precedence: Int,
  operator: Parser(a, b, c, d),
  apply: fn(e, e) -> e,
) -> Operator(e, b, c, d)
pub fn postfix(
  precedence: Int,
  operator: Parser(a, b, c, d),
  apply: fn(e) -> e,
) -> Operator(e, b, c, d)
pub fn prefix(
  precedence: Int,
  operator: Parser(a, b, c, d),
  apply: fn(e) -> e,
) -> fn(Config(e, b, c, d)) -> Parser(e, b, c, d)
pub fn sub_expression(
  config: Config(a, b, c, d),
  precedence: Int,
) -> Parser(a, b, c, d)
Search Document