package menhir-secondary

  1. Overview
  2. Docs

The functor Make must be applied to a description of the LR(1) automaton. Its input signature is a super-signature of the signature MenhirLib.EngineTypes.TABLE.

Parameters

module A : sig ... end

Signature

module CST : sig ... end

The module CST offers an algebraic data type cst of concrete syntax trees. This definition is generic, that is, grammar-independent. This module is unsafe: the data constructor NonTerminal has an invariant that is not enforced. A safe, non-generic API can be constructed a posteriori on top of this unsafe, generic API.

module DCST : sig ... end

The module DCST offers an abstract data type dcst of disjunctive concrete syntax trees. This definition is generic, that is, grammar-independent. This module offers an unsafe API: the smart constructors nonterminal and choice have preconditions whose validity is not tested at runtime. A safe, non-generic API can be constructed a posteriori on top of this unsafe, generic API.

val settle : (DCST.dcst * A.state * A.terminal) -> CST.cst option

settle (dcst, s, t') attempts to convert the DCST dcst into some CST cst such that the parser, beginning in state s, when fed with the input sequence fringe cst followed with the terminal symbol t', consumes the sequence fringe cst, leaves the symbol t' unconsumed, and constructs the CST cst. If this is possible, then this function call returns Some cst. Otherwise, it returns None.

OCaml

Innovation. Community. Security.