ast-grep vs GNU GLOBAL
ast-grep
ast-grep.github.ioGNU GLOBAL
gnu.orgSide by side
| Figure | ast-grep | GNU GLOBAL |
|---|---|---|
| Price from | Free | Free |
| Free plan | Yes | Yes |
| Free trial | — | — |
| Open source | — | — |
| Web | Yes | — |
| Windows | Yes | Yes |
| macOS | Yes | Yes |
| Linux | Yes | Yes |
| API | Yes | — |
| Self-hosted | — | Yes |
| Plans published | 1 | 1 |
| Spec score · Code Search Tools | 9.1 (#1) | 8.1 (#7) |
| Distribution | The CLI is distributed through npm, Cargo, Homebrew, MacPorts, Nix, and pip, and can also be built from source. | The project distributes a source package; binary packages are provided by outside projects. |
| Integrations | The documentation describes editor integrations, including a VS Code extension and language server support for editors such as Vim and Neovim. | The documentation lists use with Emacs, Vi, Less, Bash, web browsers, and Doxygen. |
| Languages | The project says it supports 20+ languages and allows custom languages to be loaded. | The built-in parser supports C, Yacc, Java, PHP, and assembly. |
| Purpose | ast-grep is a fast, polyglot tool for structural code search, linting, and rewriting at scale. | GNU GLOBAL is a source code tagging system for locating objects such as functions, macros, structs, and classes in source files. |
| Support | The project directs users with questions or issues to GitHub or Discord and also points to Stack Overflow and Reddit. | The project directs users seeking help to the [email protected] mailing list. |
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.