Skip to content

List of Languages with Built-in Support

The table below lists all languages that are supported by ast-grep.

Alias is the name you can use as an argument in sg run --lang [alias] or as a value in YAML rule with language: [alias].

Extension specifies the file extensions that ast-grep will look for when scanning the file system. By default, ast-grep uses the file extensions to determine the language.


Language NameAliasFile Extension
Bashbash-expbash, bats, cgi, command, env, fcgi, ksh, sh, sh.in, tmux, tool, zsh
Ccc,h
Cppcc, c++, cpp, cxxcc, hpp, cpp, c++, hh, cxx, cu, ino
CSharpcs, csharpcs
Csscsscss
Dartdartdart
Elixirex, elixirex, exs
Gogo, golanggo
Htmlhtmlhtml, htm, xhtml
Javajavajava
JavaScriptjavascript, js, jsxcjs, js, mjs, jsx
Jsonjsonjson
Kotlinkotlin, ktkt, ktm, kts
Lualualua
Phpphp-expphp
Pythonpy, pythonpy, py3, pyi, bzl
Rubyrb, rubyrb, rbw, gemspec
Rustrs, rustrs
Scalascalascala, sc, sbt
Swiftswiftswift
TypeScriptts, typescriptts, cts, mts
Tsxtsxtsx

Note: bash and php has only experimental support at the moment.


Pro Tips

You can use languageGlobs to customize languages' extension mapping.

Made with ❤️ with Rust