Module Regexp.ExprSource

Sourcetype uid = private int

Integer that serves as a unique id to identify sub-terms. Thanks to properties of Antimirov's derivatives, no new term is introduced during derivation. All terms are produced during initial parsing.

Sourcetype 'g t = private {
  1. uid : uid;
  2. desc : 'g desc;
  3. position : Syntax.position;
}
Sourceand 'g desc =
  1. | Set of 'g Info.lr1 Utils.Misc.indexset * Capture.set
    (*

    Recognise a set of states, and optionally bind the matching state to a variable.

    *)
  2. | Alt of 'g t list
    (*

    Alt ts is the disjunction of sub-terms ts. Alt [] represents the empty language.

    *)
  3. | Seq of 'g t list
    (*

    Seq ts is the concatenation of sub-terms ts. Seq [] represents the empty string ε.

    *)
  4. | Star of 'g t * Syntax.quantifier_kind
    (*

    Star t qk is the Kleene star of t with quantifier policy qk (shortest or longest match).

    *)
  5. | Filter of 'g Info.lr1 Utils.Misc.indexset
    (*

    Restrict matching to LR(1) states in the given set.

    *)
  6. | Reduce of Capture.set * 'g Reductions.t
    (*

    The reduction operator. The first component is the set of captures to bind, the second is the reduction specification.

    *)
  7. | Usage of Utils.Usage.set
    (*

    Dead-code tracking marker. The set records which source constructs are exercised at this point in the expression.

    *)

The different constructors of regular expressions

Sourceval empty : _ t

An empty expression representing the empty language.

Sourceval make : Syntax.position -> 'g desc -> 'g t

Introduce a new term, allocating a unique ID

Sourceval compare : 'g t -> 'g t -> int

Compare two terms by unique ID.

Sourceval cmon : ?lr1:('g Info.lr1 Fix.Indexing.index -> Cmon.t) -> 'g t -> Cmon.t

Print a term to a Cmon document. The optional lr1 argument allows customizing the printing of LR(1) state indices.