package ego

  1. Overview
  2. Docs

This module encodes patterns (for both matching and transformation) over Sexprs and is part of Ego.Basic's API for expressing syntactic rewrites.

type t

Encodes a pattern over S-expressions.

val pp : Format.formatter -> t -> unit

pp fmt s pretty prints the query s.

val show : t -> string

show s converts the query s to a string

val of_sexp : Sexplib0.Sexp.t -> t

of_sexp s builds a pattern from a s-expression

Note: Any atom prefixed with "?" will be treated as a pattern variable.

For example, the following pattern will match any multiplication expressions:

List [Atom "*"; Atom "?a"; Atom "?b"]
val to_sexp : t -> Sexplib0.Sexp.t

to_sexp s converts a pattern back into an s-expression. This is idempotent with of_sexp.


Innovation. Community. Security.