bare

BAP Rule Engine Library
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library bare
Module Bare . Rule
type t

rule abstract type

type error

an abstract representation of an error

Rule Parsing

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.

Rule introspecting

val lhs : t -> tuple list

lhs rule is the left hand side of the rule.

val rhs : t -> fact list

rhs rule is the right hand side of the rule

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.

Rule transformations

val apply : t -> fact -> t * fact list

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 reset : t -> t

reset rule discards the matching state and returns a fresh rule.

val report_error : ?filename:string -> Format.formatter -> error -> unit