package pratter

  1. Overview
  2. Docs
An implementation of the Pratt parsing algorithm for first order terms

Install

Dune Dependency

Authors

Maintainers

Sources

pratter-v0.1.1.tbz
sha256=bc66d56e1756caca42d4d324c0f2ebae9710615116258e660642694d841d4a16
sha512=9af84dea4efbce4d9c1cb11181487043b65d2b408247c221e4d6728d7c60f2a8f8d8605f968b989ed40c1506d4d6d7254b888038b633839674fa8f1bf3435e7b

doc/pratter/Pratter/index.html

Module PratterSource

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.

Sourcetype 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.

Sourcetype operator =
  1. | Unary
    (*

    Unary prefix operators.

    *)
  2. | Binary of associativity
    (*

    Binary infix operators with its associativity.

    *)

Reprensentation of operators.

Sourcetype priority = float

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

Sourcemodule type SUPPORT = sig ... end

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

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

Innovation. Community. Security.