Skip to content

Commit 971fb22

Browse files
committed
Merge branch 'main' into yihozhang-fix-subsume2
2 parents 2f3a6c3 + 71ecd99 commit 971fb22

28 files changed

+1635
-1263
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
# (https://github.com/orgs/community/discussions/7730)
3030
# this can be removed.
3131
- name: Upload web artifact
32-
uses: actions/upload-artifact@v3
32+
uses: actions/upload-artifact@v4
3333
with:
3434
name: www
3535
path: target/www

CHANGELOG.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,56 @@
22

33
## [Unreleased] - ReleaseDate
44

5+
## [0.4.0] - 2024-1-TODO
6+
7+
Semantic change (BREAKING)
8+
9+
- Split `function` into `constructor` and `functions` with merge functions. (#461)
10+
- Remove `:default` keyword. (#461)
11+
- Disallow lookup functions in the right hand side. (#461)
12+
- Remove `:on_merge`, `:cost`, and `:unextractable` from functions, require `:no-merge` (#485)
13+
14+
Language features
15+
16+
- Add multi-sets (#446, #454, #471)
17+
- Recursive datatypes with `datatype*` (#432)
18+
- Add `BigInt` and `BigRat` and move `Rational` to `egglog-experimental` (#457, #475, #499)
19+
20+
Command-line interface and web demo
21+
22+
- Display build info when in binary mode (#427)
23+
- Expose egglog CLI (#507, #510)
24+
- Add a new interactive visualizer (#426)
25+
- Disable build script for library builds (#467)
26+
27+
Rust interface improvements
28+
29+
- Make the type constraint system user-extensible (#509)
30+
- New extensible parser (#435, #450, #484, #489, #497, #498, #506)
31+
- Remove `Value::tag` when in release mode (#448)
32+
33+
Extraction
34+
35+
- Remove unused 'serde-1' attribute (#465)
36+
- Extract egraph-serialize features (#466)
37+
- Expose extraction module publicly (#503)
38+
- Use `set-of` instead of `set-insert` for extraction result of sets. (#514)
39+
40+
Bug fixes
41+
42+
- Fix the behavior of i64 primitives on overflow (#502)
43+
- Fix memory blowup issue in `TermDag::to_string`
44+
- Fix the issue that rule names are ignored (#500)
45+
46+
Cleanups and improvements
47+
48+
- Allow disabling messages for performance (#492)
49+
- Determinize egglog (#438, #439)
50+
- Refactor sort extraction API (#495)
51+
- Add automated benchmarking to continuous integration (#443)
52+
- Improvements to performance of testing (#458)
53+
- Other small cleanups and improvements (#428, #429, #433, #434, #436, #437, #440, #442, #444, #445, #449, #453, #456, #469, #474, #477, #490, #491, #494, #501, #504, #508, #511)
54+
555
## [0.3.0] - 2024-9-12
656

757
Cleanups
@@ -79,6 +129,7 @@ As of yet, the rust interface is not documented or well supported. We reccomend
79129
[0.1.0]: https://github.com/egraphs-good/egglog/tree/v0.1.0
80130
[0.2.0]: https://github.com/egraphs-good/egglog/tree/v0.2.0
81131
[0.3.0]: https://github.com/egraphs-good/egglog/tree/v0.3.0
132+
[0.4.0]: https://github.com/egraphs-good/egglog/tree/v0.4.0
82133

83134

84135
See release-instructions.md for more information on how to do a release.

Cargo.lock

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
edition = "2021"
33
name = "egglog"
4-
version = "0.3.0"
4+
version = "0.4.0"
55
description = "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."
66
repository = "https://github.com/egraphs-good/egglog"
77
keywords = ["e-graphs", "egglog", "datalog", "compiler", "equality"]
@@ -33,7 +33,6 @@ bin = [
3333
"graphviz",
3434
"dep:clap",
3535
"dep:env_logger",
36-
"dep:serde_json",
3736
"dep:chrono",
3837
]
3938
serde = ["egraph-serialize/serde"]
@@ -42,38 +41,28 @@ wasm-bindgen = ["instant/wasm-bindgen", "dep:getrandom"]
4241
nondeterministic = []
4342

4443
[dependencies]
44+
clap = { version = "4", features = ["derive"], optional = true }
45+
egraph-serialize = { version = "0.2.0", default-features = false }
46+
env_logger = { version = "0.10", optional = true }
4547
hashbrown = { version = "0.15" }
48+
im-rc = "15.1.0"
49+
im = "15.1.0"
4650
indexmap = "2.0"
4751
instant = "0.1"
52+
lazy_static = "1.4"
4853
log = "0.4"
54+
num = "0.4.3"
55+
ordered-float = { version = "3.7" }
4956
rustc-hash = "1.1"
57+
smallvec = "1.11"
5058
symbol_table = { version = "0.4.0", features = ["global"] }
5159
thiserror = "1"
52-
lazy_static = "1.4"
53-
num = "0.4.3"
54-
smallvec = "1.11"
55-
56-
egraph-serialize = { version = "0.2.0", default-features = false }
57-
58-
# binary dependencies
59-
clap = { version = "4", features = ["derive"], optional = true }
60-
env_logger = { version = "0.10", optional = true }
61-
serde_json = { version = "1.0.100", optional = true, features = [
62-
"preserve_order",
63-
] }
64-
65-
ordered-float = { version = "3.7" }
6660

6761
# Need to add "js" feature for "graphviz-rust" to work in wasm
68-
getrandom = { version = "0.2.10", features = ["js"], optional = true }
69-
70-
im-rc = "15.1.0"
71-
im = "15.1.0"
62+
getrandom = { version = "0.2.10", optional = true, features = ["js"] }
7263

7364
[build-dependencies]
74-
chrono = { version = "0.4", default-features = false, optional = true, features = [
75-
"now",
76-
] }
65+
chrono = { version = "0.4", default-features = false, features = ["now"], optional = true }
7766

7867
[dev-dependencies]
7968
codspeed-criterion-compat = "2.7.2"

README.md

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -93,66 +93,3 @@ env RUST_LOG=error samply record ./target/profiling/egglog --dont-print-messages
9393

9494
To view documentation, run `cargo doc --open`.
9595

96-
97-
98-
TODO migrate the following documentation to cargo doc:
99-
### Sort: i64
100-
101-
Signed 64-bit integers supporting these primitives:
102-
103-
```
104-
+ - * / % ; arithmetic
105-
& | ^ << >> not-i64 ; bit-wise operations
106-
< > <= >= ; comparisons
107-
min max log2
108-
to-f64
109-
to-string
110-
```
111-
112-
### Sort: f64
113-
114-
64-bit floating point numbers supporting these primitives:
115-
116-
```
117-
+ - * / % ; arithmetic
118-
< > <= >= ; comparisons
119-
min max neg
120-
to-i64
121-
to-string
122-
```
123-
124-
### Sort: map
125-
126-
A map from a key type to a value type supporting these primitives:
127-
128-
```
129-
empty
130-
insert
131-
get
132-
not-contains
133-
contains
134-
set-union
135-
set-diff
136-
set-intersect
137-
map-remove
138-
```
139-
140-
### Sort: rational
141-
142-
Rational numbers (fractions) with 64-bit precision for numerator and denominator with these primitives:
143-
144-
```
145-
+ - * / ; arithmetic
146-
min max neg abs floor ceil round
147-
rational ; construct from a numerator and denominator
148-
numer denom ; get numerator and denominator
149-
pow log sqrt
150-
< > <= >= ; comparisons
151-
```
152-
153-
These primitives are only defined when the result itself is a pure rational.
154-
155-
### Sort: string
156-
157-
Use double quotes to get a quote: `"Foo "" Bar"` is `Foo " Bar`.
158-
No primitives defined.

src/actions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ impl EGraph {
338338

339339
let variants = values[1].bits as i64;
340340
if variants == 0 {
341-
let (cost, term) = self.extract(values[0], &mut termdag, sort);
341+
let (cost, term) = self.extract(values[0], &mut termdag, sort)?;
342342
// dont turn termdag into a string if we have messages disabled for performance reasons
343343
if self.messages_enabled() {
344344
let extracted = termdag.to_string(&term);

src/ast/desugar.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub(crate) fn desugar_command(
112112
let s = std::fs::read_to_string(&file)
113113
.unwrap_or_else(|_| panic!("{span} Failed to read file {file}"));
114114
return desugar_program(
115-
parse_program(Some(file), &s, parser)?,
115+
parser.get_program_from_string(Some(file), &s)?,
116116
parser,
117117
seminaive_transform,
118118
);

src/ast/expr.rs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -130,24 +130,30 @@ impl ResolvedExpr {
130130
}
131131
}
132132

133-
impl Expr {
134-
pub fn call_no_span(op: impl Into<Symbol>, children: impl IntoIterator<Item = Self>) -> Self {
135-
Self::Call(
136-
DUMMY_SPAN.clone(),
137-
op.into(),
138-
children.into_iter().collect(),
139-
)
140-
}
133+
#[macro_export]
134+
macro_rules! call {
135+
($func:expr, $args:expr) => {
136+
$crate::ast::GenericExpr::Call($crate::span!(), $func.into(), $args.into_iter().collect())
137+
};
138+
}
141139

142-
pub fn lit_no_span(lit: impl Into<Literal>) -> Self {
143-
Self::Lit(DUMMY_SPAN.clone(), lit.into())
144-
}
140+
#[macro_export]
141+
macro_rules! lit {
142+
($lit:expr) => {
143+
$crate::ast::GenericExpr::Lit($crate::span!(), $lit.into())
144+
};
145+
}
145146

146-
pub fn var_no_span(v: impl Into<Symbol>) -> Self {
147-
Self::Var(DUMMY_SPAN.clone(), v.into())
148-
}
147+
#[macro_export]
148+
macro_rules! var {
149+
($var:expr) => {
150+
$crate::ast::GenericExpr::Var($crate::span!(), $var.into())
151+
};
149152
}
150153

154+
// Rust macro annoyance; see stackoverflow.com/questions/26731243/how-do-i-use-a-macro-across-module-files
155+
pub use {call, lit, var};
156+
151157
impl<Head: Clone + Display, Leaf: Hash + Clone + Display + Eq> GenericExpr<Head, Leaf> {
152158
pub fn span(&self) -> Span {
153159
match self {

0 commit comments

Comments
 (0)