Skip to content
SPECIFICTION
Get listed

ast-grep vs Coccinelle

ast-grep

ast-grep.github.io

Coccinelle

coccinelle.gitlabpages.inria.fr

Side by side

Figureast-grepCoccinelle
Price fromFreeFree
Free planYesYes
Free trial——
Open source——
WebYes—
WindowsYes—
macOSYesYes
LinuxYesYes
APIYes—
Plans published11
Spec score · Code Refactoring Tools9.1 (#1)7.9 (#9)
Purposeast-grep is a fast, polyglot tool for structural code search, linting, and rewriting at scale.Coccinelle is a program matching and transformation engine that uses SmPL to specify desired matches and transformations in C code.
SupportThe project directs users with questions or issues to GitHub or Discord and also points to Stack Overflow and Reddit.Questions can be sent to the [email protected] mailing list, which is moderated for non-members; contributions are preferred via the list and may also be submitted on GitHub.

Plans

ast-grep

  • ast-grepFree

ast-grep pricing →

Coccinelle

  • CoccinelleFree

Coccinelle pricing →

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.

Visit ast-grep.github.io

Coccinelle

Coccinelle is a free program matching and transformation engine for working with C code. It uses SmPL to describe code patterns and the transformations to apply when matches are found. A single semantic patch can change code at many sites across hundreds of files while allowing for differences in spacing, variable names, irrelevant code, and coding style. The project describes uses including automating collateral changes after library API evolution and finding and fixing bugs in systems code. Coccinelle semantic patches and bug fixes have been integrated into the official Linux tree, and semantic patches are available in the Linux scripts directory for use with coccicheck. It supports C and C++, with C++ mode invoked using --c++; the project says its C++ support is still being extended, including for high performance computing. The download page lists version 1.3.3, dated September 2, 2026, with source code and precompiled spatch builds. It is available for Linux and macOS as desktop software. Source builds require OCaml, with Python and Menhir needed in specified cases.

Visit coccinelle.gitlabpages.inria.fr