Polyglot Piranha
flexible multilingual framework for chaining interdependent structural search/replace rules using any matching language.
Structural find / replace
Find and replace code in any declarative matching language (regex, tree-sitter queries). Specify extra matchers in our filter language to achieve finely-grained rewrites.
Chain rewrite rules
Cascade program transformations by chaining your rewrite rules with our graph language. Piranha will automatically refactor your code with your chaining strategy.
Generate rewrite rules from templates and annotations
// 1
import java.util.Executor;
// end
class SomeClass {
void someMethod() {
// 2
Executor(:[x], :[y: identifier]);
// end
}
}
// 2 -> 1
// 1
import java.util.NovelExecutor;
import java.util.Wrapper;
// end
class SomeClass {
void someMethod() {
// 2
Wrapper(NovelExecutor(:[x], :[y]);
// end
}
}