package pratter

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

Parameters

module Sup : SUPPORT

Signature

val add_unary : Sup.ident -> priority -> unit

add_unary id pr adds unary operator identified by id with priority pr to the table of operators.

val add_binary : Sup.ident -> priority -> associativity -> unit

add_binary id pr assoc adds binary operator identified by id with priority pr to the table of operators, with associativity assoc.

val flush : unit -> unit

flush () empties the table of operators.

val expression : ?rbp:priority -> Sup.term Stream.t -> Sup.term

expression rbp s parses stream of tokens s with right binding power rbp (which is 0 by default). 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.