ast-grep vs Spoon
ast-grep
ast-grep.github.ioSpoon
spoon.gforge.inria.frSide by side
| Figure | ast-grep | Spoon |
|---|---|---|
| Price from | Free | Free |
| Free plan | Yes | Yes |
| Free trial | — | — |
| Open source | — | — |
| Web | Yes | — |
| Windows | Yes | — |
| macOS | Yes | — |
| Linux | Yes | Yes |
| API | Yes | Yes |
| Self-hosted | — | Yes |
| Plans published | 1 | 1 |
| Spec score · Code Refactoring Tools | 9.1 (#1) | 7.8 (#10) |
| Integrations | The documentation describes editor integrations, including a VS Code extension and language server support for editors such as Vim and Neovim. | The site documents Maven and Gradle usage, along with command-line execution using a JAR from Maven Central. |
| Purpose | ast-grep is a fast, polyglot tool for structural code search, linting, and rewriting at scale. | Spoon is an open-source library for analyzing, rewriting, transforming, and transpiling Java source code. |
| Support | The project directs users with questions or issues to GitHub or Discord and also points to Stack Overflow and Reddit. | The site directs users seeking professional development, training, or extension support to comment on a GitHub issue. |
| What it does | ast-grep is a fast, polyglot tool for structural code search, linting, and large-scale rewriting. | Spoon is an open-source library for analyzing, rewriting, transforming, and transpiling Java source code through an abstract syntax tree (AST). |
Plans
In their own words
ast-grep
ast-grep is a free, open-source tool for structural code search, linting, and rewriting. It matches patterns against syntax-tree nodes, helping developers locate and change code across a codebase rather than searching plain text. Its CLI can preview and apply rewrites interactively, and scan configurable YAML rules with error, warning, info, or hint severity. Rules can combine pattern, kind, regex, relational, and composite conditions, and CLI commands help create and snapshot-test them. The project says it supports more than 20 languages and can load custom languages. JavaScript and WebAssembly APIs allow programmatic syntax-tree work; a browser playground offers a way to try patterns without local installation. Editor options include a VS Code extension and language-server setups, including for Vim and Neovim. The tool is free, has a web interface, and is distributed through package managers or built from source. Its FAQ notes that some advanced static-analysis information is unsupported, and one rule cannot target multiple languages at once.
Spoon
Spoon is a free, open-source library for analyzing, rewriting, transforming, and transpiling Java source code. It parses source files into an abstract syntax tree (AST), then exposes APIs for inspecting and changing that model. Processors can perform source-level static analysis on selected AST element types, while architectural rules can be expressed as AST checks and run as JUnit tests in continuous integration. Transformation facilities cover instrumentation and refactoring, including helpers for local and generic variables and removing deprecated methods. Spoon can also provide shared analysis of binary and source code through CtClass objects as an alternative to Java reflection. The project supports Java source up to Java 25, but runtime requirements vary: Spoon 11.x needs JDK 17 or later, 10.x needs JDK 11 or later, and 9.x needs Java 8. It is available through Java, the command line, Maven, and Gradle, with a dependency JAR on Maven Central. Command-line use requires manual classpath handling and source dependencies specified with --source-classpath. Spoon is an official Inria project and an OW2 consortium member.