Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support recursive datatypes in egglog #432

Merged
merged 8 commits into from
Oct 11, 2024
Merged

Conversation

yihozhang
Copy link
Collaborator

I actually accidentally pushed this to main... which is bad (now reverted). I have updated repo settings so that no one can directly push to main

@yihozhang yihozhang requested a review from a team as a code owner October 4, 2024 08:04
@yihozhang yihozhang requested review from saulshanabrook and removed request for a team October 4, 2024 08:04
src/ast/mod.rs Outdated
Err((head, args)) => list!("sort", name, list!(head, ++ args)),
})
.collect();
list!("datatypes", ++ datatypes)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be datatype*? Hm, I wonder if there are no tests for these?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! For NCommand, cases like this would be caught by resugared tests (which re-run same tests over programs converted from ASTs), but we don't have tests for Command (which is immediately desugared into NCommand)

Copy link
Member

@saulshanabrook saulshanabrook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, had one question about turning to s-expr. Thanks!

src/ast/mod.rs Outdated
@@ -450,6 +450,8 @@ pub type Command = GenericCommand<Symbol, Symbol>;

pub type Subsume = bool;

pub type Subdatatypes = Result<Vec<Variant>, (Symbol, Vec<Expr>)>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you using Result to separate sorts vs datatypes? I think it might be clearer if you have a custom enum instead? Unless I'm missing something, just when trying to follow the code.

Copy link
Collaborator Author

@yihozhang yihozhang Oct 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good point. I have changed it to use a custom enum.

Co-authored-by: Saul Shanabrook <s.shanabrook@gmail.com>
@yihozhang yihozhang merged commit bb97e1e into main Oct 11, 2024
6 checks passed
@saulshanabrook saulshanabrook deleted the yihozhang-recursive-datatype branch October 11, 2024 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants