package pratter

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

This modules defines a functor whose image is a parser for terms with applications, binary and unary operators. These terms are specified in the argument of the functor.

The algorithm implemented is an extension of the Pratt parser. The Sunting Yard algorithm could also be used.

type associativity =
  1. | Left
    (*

    If + is a left associative operator, x + y + z is parsed (x + y) + z.

    *)
  2. | Right
    (*

    If + is a right associative operator, x + y + z is parsed x + (y + z).

    *)

Associativity of an operator.

type operator =
  1. | Unary
    (*

    Unary prefix operators.

    *)
  2. | Binary of associativity
    (*

    Binary infix operators with its associativity.

    *)

Reprensentation of operators.

type priority = float

Priority of operators. If * has a higher priority than +, than x + y * z is parsed x + (y * z).

module type SUPPORT = sig ... end

Types and utilities on terms that are to be Pratt parsed.

module Make (Sup : SUPPORT) : sig ... end
OCaml

Innovation. Community. Security.