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
Bashbashbash, 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
Elixirex, elixirex, exs
Gogo, golanggo
Haskellhs, haskellhs
Htmlhtmlhtml, htm, xhtml
Javajavajava
JavaScriptjavascript, js, jsxcjs, js, mjs, jsx
Jsonjsonjson
Kotlinkotlin, ktkt, ktm, kts
Lualualua
Phpphpphp
Pythonpy, pythonpy, py3, pyi, bzl
Rubyrb, rubyrb, rbw, gemspec
Rustrs, rustrs
Scalascalascala, sc, sbt
Swiftswiftswift
TypeScriptts, typescriptts, cts, mts
Tsxtsxtsx
Yamlymlyml, yaml

Pro Tips

You can use languageGlobs to customize languages' extension mapping.

Made with ❤️ with Rust