Lang.AnalysisFunctions for analysing and transforming Common.parseable objects, notably including the Unparse module.
val matches_empty : Common.parseable -> boolDetermines if the given parseable accepts the empty string.
For this function, a parseable p is considered empty if: for all p2, the parser Seq [p; p2] accepts at least p2. Note that Common.parseable.Eof is not empty by this definition.
val seq_inner : Common.parseable -> Common.parseable -> Common.parseableAttempts to create a parseable which performs l then r, but pushes r as deep as possible to maximise backtracking.
val to_eof : Common.parseable -> Common.parseableAttempts to modify the given parseable to require Common.parseable.Eof immediately after it.
val vars : Common.parseable -> Common.StringSet.tObtains the set of names which are possibly bound when parsing the given parseable.
Names are bound by Common.parseable.Bind structures.
val disjunctive_clauses : Common.parseable -> Common.parseable CCList.tConverts the given parseable into its disjunctive clauses.
The disjunctive clauses are such that Or (disjunctive_clauses p) accepts the same language as the original p, and none of the disjunctive clauses contain an Or within them.
Warning: The number of disjunctive clauses is exponential in the number of sequential Common.parseable.Or terms.
module Unparse : sig ... endImplementation of the "unparsing" functionality. The goal of this feature is to enable parsers to be used as printers by manually providing a Common.bindings object with a structure matching those returned by Parse.run_parse.
val unparse_with_bindings :
Common.parseable ->
Common.bindings ->
Common.output * Common.bindingsval unparse : Common.parseable -> Common.bindings -> Common.outputSee Unparse.unparse.