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

Migrate to tree-sitter #33

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Migrate to tree-sitter #33

wants to merge 2 commits into from

Conversation

Noratrieb
Copy link
Owner

The current minimization approach with syn has many flaws. For example, it's impossible to nicely identify syn nodes. Syn nodes are also heterogeneous, which can make it more annoying to write more generic minimization steps.

After looking a bit at Langston Barrett's cool [treereducehttps://github.com/langston-barrett/treereduce), it became clear that tree-sitter is the better solution. It has first-class support for node IDs, making every homogeneous node unique, which is great and fixes all of these silly AstPath tracking garbage things.

Langston Barrett has also written a neat helper crate tree-sitter-edit that helps with editing tree-sitter trees and makes that very nice.

I won't be literally coping their approach, as treereduce is a bit different in scope (I can imagine integrating treereduce in the future though), being more generic and file-based while cargo-minimize is more focused on minimizing entire projects quickly using more specialized approaches.

Migrates all the lower level code to tree-sitter not touching passes yet.
@Noratrieb Noratrieb marked this pull request as draft December 31, 2023 16:38
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.

1 participant