package pratter

  1. Overview
  2. Docs
An extended Pratt parser

Install

Dune Dependency

Authors

Maintainers

Sources

pratter-2.0.0.tar.gz
sha512=89fc9d0645e55dda7201a2cb47fe7bee774db92892c528efcbec179f270563088b1fab1d8d25ebca97b389947c2741f7a05127996cd1a4e3c7fe726be45ab835

doc/pratter/Pratter/Make/index.html

Module Pratter.MakeSource

Parameters

module Sup : SUPPORT

Signature

Sourcetype error = [
  1. | `OpConflict of Sup.term * Sup.term
    (*

    Priority or associativiy conflict between two operators. In `OpConflict (t,o), operator o generates a conflict which prevents term t to be parsed.

    *)
  2. | `UnexpectedInfix of Sup.term
    (*

    An infix operator appears without left context. If + is an infix operator, it is raised in, e.g., + x x or x + + x x.

    *)
  3. | `UnexpectedPostfix of Sup.term
    (*

    A postfix operator appears without left context. If ! is a postfix operator, it is raised in ! x.

    *)
  4. | `TooFewArguments
    (*

    More arguments are expected. It is raised for instance on partial application of operators, such as x +.

    *)
]

Errors that can be encountered while parsing a stream of terms.

expression tbl s parses stream of tokens s with table of operators tbl. It transforms a sequence of applications to a structured application tree containing infix and prefix operators. For instance, assuming that + is declared infix, it transforms 3 + 5 + 2, represented as @(@(@(@(3,+),5),+),2) (where @ is the application) into (@(+(@(+,3,5)),2).

OCaml

Innovation. Community. Security.