package ego

  1. Overview
  2. Docs

Module Make.RuleSource

This module Rule defines the rewrite interface for the EGraph, allowing users to express relatively complex transformations of expressions of the Language L.

Sourcetype t

Represents rewrite rules over the language of the EGraph.

Sourceval make_constant : from:L.op Query.t -> into:L.op Query.t -> t

make_constant ~from ~into creates a rewrite rule from a pattern from into a schema into that applies a purely syntactic transformation.

Sourceval make_conditional : from:L.op Query.t -> into:L.op Query.t -> cond: ((Id.t L.shape, A.t, A.data, rw) egraph -> Id.t -> Id.t StringMap.t -> bool) -> t

make_conditional ~from ~into ~cond creates a syntactic rewrite rule from from to into that is conditionally applied based on some property cond of the EGraph, the root eclass of the sub-expression being transformed and the eclasses of all bound variables.

Sourceval make_dynamic : from:L.op Query.t -> generator: ((Id.t L.shape, A.t, A.data, rw) egraph -> Id.t -> Id.t StringMap.t -> L.op Query.t option) -> t

make_dynamic ~from ~generator creates a dynamic rewrite rule from a pattern from into a schema that is conditionally generated based on properties of the EGraph, the root eclass of the sub-expression being transformed and the eclasses of all bound variables

OCaml

Innovation. Community. Security.