package elpi

  1. Overview
  2. Docs

Commodity module to build a simple query and extract the output from the solution found by Elpi.

Example: "foo data Output" where data has type t (a is t Conversion.t) and Output has type v (b is a v Conversion.t) can be described as: | let q : (v * unit) t = Query { predicate = "foo"; arguments = D(a, data, Q(b, "Output", N))

|

}

Then compile q can be used to obtain the compiled query such that the resulting solution has a fied output of type (v * unit). Example: | Query.compile q |> Compile.link |> Execute.once |> function | Execute.Success { output -> output | _ -> ...

|

}

type name = string
type _ arguments =
  1. | N : unit arguments
  2. | D : 'a Conversion.t * 'a * 'x arguments -> 'x arguments
  3. | Q : 'a Conversion.t * name * 'x arguments -> ('a * 'x) arguments
type 'x t =
  1. | Query of {
    1. predicate : name;
    2. arguments : 'x arguments;
    }
val compile : Compile.program -> Ast.Loc.t -> 'a t -> 'a Compile.query
OCaml

Innovation. Community. Security.