Library
Module
Module type
Parameter
Class
Class type
Matching rule specification.
A rule is consists of the rule specification and matching state, thus applying a rule to a fact will produce another rule that will store the partial matching state and, if some states reached the completion, it will also produce a sequence of facts.
val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
val from_string : string -> (t list, error) Core_kernel.Result.t
val from_file : string -> (t list, error) Core_kernel.Result.t
from_file name
parses a file that contains zero or more rule specifications. Returns Ok rules
if all rules specifications were well-formed, otherwise returns Error e
with a detailed description of an error and a location of a subterm that is not part of the grammar.
val of_string : string -> t
of_string s
parses the rule specification s
.
Precondition: s
is a well-formed rule specification.
val spec : t -> string
spec rule
is the human readable and machine parseable well-formed rule specification.
val pp : Format.formatter -> t -> unit
pp ppf rule
prints rule
into the formatter ppf
.
apply rule fact
applies rule
to fact
and produces a new rule that contains a partial mathcing state, as well as a list (possibly empty) of newly produced facts.
val report_error : ?filename:string -> Format.formatter -> error -> unit