package ostap

  1. Overview
  2. Docs

BNF expression implementation.

type t =
  1. | String of string
    (*

    String terminal

    *)
  2. | Term of string
    (*

    Non-string terminal

    *)
  3. | Nonterm of string
    (*

    Nonterminal

    *)
  4. | Apply of t * t list
    (*

    Rule application

    *)
  5. | Star of t
    (*

    Iteration

    *)
  6. | Plus of t
    (*

    Non-empty iteration

    *)
  7. | Opt of t
    (*

    Optional expression

    *)
  8. | Alt of t list
    (*

    Alternation

    *)
  9. | Seq of t list
    (*

    Sequencing

    *)
  10. | Group of t
    (*

    Expression in brackets

    *)
  11. | Custom of [ `S of string | `T of t ] list
    (*

    Custom mixed structure (for internal use)

    *)

Main type.

Constructors

val string : string -> t

String terminal.

val term : string -> t

Non-string terminal.

val nonterm : string -> t

Nonterminal.

val apply : t -> t list -> t

Rule application.

val star : t -> t

Iteration.

val plus : t -> t

Non-empty iteration.

val opt : t -> t

Optional expression.

val alt : t list -> t

Alternation.

val seq : t list -> t

Sequencing.

val group : t -> t

Expression in brackets.

val custom : [ `S of string | `T of t ] list -> t

Custom text.

val toTeX : t -> string

TeX printer.

val toTree : t -> string

Tree printer.

OCaml

Innovation. Community. Security.