#datalog #equality #compiler #e-graphs #compiler-optimization

bin+lib egglog

egglog is a language that combines the benefits of equality saturation and datalog. It can be used for analysis, optimization, and synthesis of programs. It is the successor to the popular rust library egg.

3 releases (breaking)

0.3.0 Oct 2, 2024
0.2.0 May 24, 2024
0.1.0 Oct 31, 2023

#136 in Programming languages

Download history 24/week @ 2024-07-25 7/week @ 2024-08-01 2/week @ 2024-08-08 6/week @ 2024-08-15 24/week @ 2024-08-22 23/week @ 2024-08-29 9/week @ 2024-09-12 24/week @ 2024-09-19 65/week @ 2024-09-26 164/week @ 2024-10-03 36/week @ 2024-10-10 17/week @ 2024-10-17 6/week @ 2024-10-24 19/week @ 2024-10-31 20/week @ 2024-11-07

73 downloads per month

MIT license

475KB
12K SLoC

egglog

Web Demo Main Branch Documentation

This is the repo for the egglog tool accompanying the paper "Better Together: Unifying Datalog and Equality Saturation" (ACM DL, arXiv).

If you use this work, please use this citation.

See also the Python binding, which provides a bit more documentation: https://egglog-python.readthedocs.io/

Chat

There is a Zulip chat about egglog here: https://egraphs.zulipchat.com/#narrow/stream/375765-egglog

Prerequisites & compilation

apt-get install make cargo
cargo install cargo-nextest
make all

Usage

cargo run [-f fact-path] [-naive] [--to-json] [--to-dot] [--to-svg] <files.egg>

or just

cargo run

for the REPL.

  • The --to-dot command will save a graphviz dot file at the end of the program, replacing the .egg extension with .dot.
  • The --to-svg, which requires Graphviz to be installed, will save a graphviz svg file at the end of the program, replacing the .egg extension with .svg.

Community extensions

Development

To run the tests use make test.

Documentation

To view documentation, run cargo doc --open.

TODO migrate the following documentation to cargo doc:

Sort: i64

Signed 64-bit integers supporting these primitives:

+ - * / %           ; arithmetic
& | ^ << >> not-i64 ; bit-wise operations
< > <= >=           ; comparisons
min max log2
to-f64
to-string

Sort: f64

64-bit floating point numbers supporting these primitives:

+ - * / %           ; arithmetic
< > <= >=           ; comparisons
min max neg
to-i64
to-string

Sort: map

A map from a key type to a value type supporting these primitives:

empty
insert
get
not-contains
contains
set-union
set-diff
set-intersect
map-remove

Sort: rational

Rational numbers (fractions) with 64-bit precision for numerator and denominator with these primitives:

+ - * /         ; arithmetic
min max neg abs floor ceil round
rational        ; construct from a numerator and denominator
numer denom     ; get numerator and denominator
pow log sqrt
< > <= >=       ; comparisons

These primitives are only defined when the result itself is a pure rational.

Sort: string

Use double quotes to get a quote: "Foo "" Bar" is Foo " Bar. No primitives defined.

Dependencies

~14–28MB
~383K SLoC