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

refactor: use patterns in more of the ast #270

Merged
merged 5 commits into from
Apr 18, 2024
Merged

refactor: use patterns in more of the ast #270

merged 5 commits into from
Apr 18, 2024

Conversation

tjjfvi
Copy link
Contributor

@tjjfvi tjjfvi commented Apr 17, 2024

  • lambdas and lets can now bind simple patterns (e.g. @(a, b) bod or let ((a, b), (c, d)) = val; nxt)
    • Term::Dup and Term::Ltp are now part of Term::Let
  • these patterns can now bind scopeless variables (so e.g. let $x = ... is valid)
    • Term::Chn is now part of Term::Lam
  • tuples can now be tagged, and use the same AST node as superpositions
    • tup/sup/dup are all collectively called fan
    • the logic for these is nearly identical for the vast majority of the code
  • erased lets are no longer elided, fixing some miscompilation bugs

(even though this added features, the line count is net negative!)

@tjjfvi tjjfvi requested a review from developedby April 17, 2024 20:57
@tjjfvi
Copy link
Contributor Author

tjjfvi commented Apr 17, 2024

(this is a modern version of the original pattern-refactor started by @FranchuFranchu (cf1bc25))

src/term/net_to_term.rs Outdated Show resolved Hide resolved
& {2 c b} ~ (c a)
Copy link
Member

Choose a reason for hiding this comment

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

Does hvm-core completely ignore the value of labels? As in, it doesn't ever look at the meaning of any specific values, just compares them between nodes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

correct

@tjjfvi tjjfvi requested review from developedby and imaqtkatt April 18, 2024 13:00
@tjjfvi tjjfvi added this pull request to the merge queue Apr 18, 2024
Merged via the queue into main with commit d87c091 Apr 18, 2024
5 checks passed
@tjjfvi tjjfvi deleted the pattern-refactor branch April 18, 2024 13:09
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.

3 participants