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

Question: Custom strategies with ast-grep? #194

Open
tmandry opened this issue Jun 4, 2024 · 1 comment
Open

Question: Custom strategies with ast-grep? #194

tmandry opened this issue Jun 4, 2024 · 1 comment

Comments

@tmandry
Copy link

tmandry commented Jun 4, 2024

Hey there, this seems like a really cool project. I'm curious about the possibility of configuring language-specific (or even project-specific) reduction strategies, maybe using ast-grep's patterns or rules (ast-grep also works on tree-sitter grammars and has a Rust API, though you could invoke it as a command-line tool). Do you think that would integrate well into the existing model?

As an example, this would make it really simple to express Rust-specific reduction strategies like the ones described in Felix Klock's blog post, e.g. replacing bodies or expressions with loops, removing non-binding statements, and removing generic parameters.

Sorry if this is the wrong place for such discussion.

@langston-barrett
Copy link
Owner

@tmandry Thanks for your interest in the project! I think this would be doable. I also maintain a ast-grep-like project called Mogglo, which is an alternative basis on which to integrate language-specific patterns.

Essentially, what would need to be done is to expand Task to contain various other kinds of reduction-related tasks (such as calling out to external tools/libraries) and add appropriate handling of such tasks during reduction.

I'd welcome PRs or further discussion in this direction!

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

No branches or pull requests

2 participants