---
title: "Supported languages"
description: "Source-code and documentation languages mehen analyzes today, plus the parser backing each one."
keywords: ["mehen languages", "supported languages", "polyglot", "ruff", "oxc", "mago", "prism", "tree-sitter", "antlr", "pulldown-cmark"]
---

mehen supports eleven source languages, Markdown, and SQL. Per-file language detection is by extension, and the
matching analyzer crate owns parsing and metric interpretation. Each language uses the parser that
gives mehen the best semantic coverage for that ecosystem.

## Source languages

| Language | Extensions | Parser |
|---|---|---|
| **Python** | `.py` | [Ruff](https://docs.astral.sh/ruff/) (`ruff_python_parser` + `ruff_python_ast`) |
| **TypeScript / JavaScript** | `.ts`, `.mts`, `.cts`, `.js`, `.mjs`, `.cjs` | [Oxc](https://oxc.rs/) (`oxc_parser`) |
| **TSX / JSX** | `.tsx`, `.jsx` | [Oxc](https://oxc.rs/) (`oxc_parser`) |
| **PHP** | `.php` | [Mago](https://github.com/carthage-software/mago) (`mago-syntax`) |
| **Ruby** | `.rb` | [Prism](https://ruby.github.io/prism/) (`ruby-prism`) |
| **Rust** | `.rs` | [`ra_ap_syntax`](https://docs.rs/ra_ap_syntax/) (rust-analyzer's syntax library) |
| **Go** | `.go` | [tree-sitter-go](https://github.com/tree-sitter/tree-sitter-go) |
| **Kotlin** | `.kt`, `.kts` | [ANTLR](https://www.antlr.org/) — official [Kotlin spec grammar](https://github.com/Kotlin/kotlin-spec) via [antlr-rust-runtime](https://github.com/ophi-dev/antlr-rust-runtime) |
| **Java** | `.java` | [ANTLR](https://www.antlr.org/) — [grammars-v4 Java grammar](https://github.com/antlr/grammars-v4/tree/master/java/java) via [antlr-rust-runtime](https://github.com/ophi-dev/antlr-rust-runtime) |
| **C#** | `.cs`, `.csx` | [ANTLR](https://www.antlr.org/) — [Roslyn's own generated grammar](https://github.com/dotnet/roslyn/blob/main/src/Compilers/CSharp/Portable/Generated/CSharp.Generated.g4) via [antlr-rust-runtime](https://github.com/ophi-dev/antlr-rust-runtime) |
| **C** | `.c`, `.h` | [tree-sitter-c](https://github.com/tree-sitter/tree-sitter-c) |
| **PowerShell** | `.ps1`, `.psm1`, `.psd1` | [tree-sitter-pwsh](https://github.com/wharflab/tree-sitter-powershell) |

<Note>
TypeScript is a superset of JavaScript, so mehen analyzes `.js` / `.mjs` / `.cjs` through the Oxc
TypeScript front-end and `.jsx` through Oxc's TSX front-end.
</Note>

## Why these parsers

- **Ruff** parses Python with full support for current syntax (3.13/3.14 features, f-strings,
  `match`/`case`, exception groups, async constructs) and exposes a typed AST plus a semantic model.
- **Oxc** is a JavaScript/TypeScript toolchain in Rust and one of the fastest TS parsers in
  production. It handles decorators, class fields, parameter properties, JSX, `satisfies`, `using`,
  and dynamic import natively.
- **Mago** is a PHP toolchain in Rust. It understands attributes, promoted properties, enums, traits,
  anonymous classes, readonly members, null-safe calls, and `match` expressions out of the box.
- **Prism** is the official Ruby parser maintained by the Ruby core team. It covers blocks, lambdas,
  numbered parameters, modifier conditionals, rescue modifiers, endless methods, pattern matching,
  and safe navigation.
- **`ra_ap_syntax`** is the syntax tree library used by rust-analyzer; it gives mehen exactly the
  syntactic granularity rust-analyzer uses for its own analyses.
- **ANTLR** parses Kotlin, Java, and C#, generated to Rust by
  [`ophi-dev/antlr-rust-runtime`](https://github.com/ophi-dev/antlr-rust-runtime). Kotlin uses the
  official [Kotlin specification grammar](https://github.com/Kotlin/kotlin-spec), which models Kotlin
  constructs (`when` entries, the elvis `?:` and safe-call `?.` operators, `catch` blocks, labeled
  jumps, property accessors) as first-class, semantically-named rules. Java uses the community
  [grammars-v4 Java grammar](https://github.com/antlr/grammars-v4/tree/master/java/java), which
  covers modern Java (records, sealed types, switch expressions, text blocks, pattern matching,
  modules). C# uses [Roslyn's own generated
  grammar](https://github.com/dotnet/roslyn/blob/main/src/Compilers/CSharp/Portable/Generated/CSharp.Generated.g4),
  which the C# compiler generates from the same `Syntax.xml` model that produces its syntax node
  classes — so it tracks C# *as implemented*: records, `is not`, `and`/`or` and relational patterns,
  list patterns, collection expressions, raw strings, primary constructors, `required` members, and
  the C# 14 additions (`field`, extension blocks). It replaced the community grammars-v4 C# grammar,
  which stops at C# 7 and parsed 93 of 322 `System.Text.Json` files against 317 for the derived
  Roslyn grammar; see `crates/mehen-csharp-parser/grammar/PROVENANCE.md` for the pinned revision and
  what the derivation repairs. All three are richer than a tree-sitter CST.
- **Tree-sitter** is mehen's pick for Go, C, and PowerShell, where its grammar quality and
  ecosystem maturity make it the best fit.

## Documentation

| Format | Extensions | Parser |
|---|---|---|
| **Markdown** | `.md`, `.markdown`, `.mdown`, `.mkd`, `.mkdn`, `.mdx` | [pulldown-cmark](https://github.com/pulldown-cmark/pulldown-cmark) |

Markdown gets a dedicated documentation metric suite — code-style metrics like cyclomatic complexity
and NOM/NPA/NPM/WMC do not apply because Markdown has no functions or classes. See
[Markdown metrics](/metrics/markdown/overview) for the full set.

## SQL

| Format | Extensions | Parser |
|---|---|---|
| **SQL** | `.sql`, `.ddl`, `.dml` | [sqruff](https://github.com/quarylabs/sqruff) |

A dedicated SQL analyzer (`mehen-sql`) ships its own metric family — query-block structure, CTE
graphs, join graphs, predicate complexity, object-touch risk, dialect portability, and an
SQL-flavored Halstead. Code-style metrics like cyclomatic complexity and NOM/NPA/NPM/WMC do not
apply to declarative SQL. The dialect is inferred from syntax hints (postgres, T-SQL, snowflake,
bigquery, mysql, sqlite, oracle, clickhouse, redshift, sparksql, athena, db2) with a reported
confidence, defaulting to ANSI. See [SQL metrics overview](/metrics/sql/overview) for the full set.

## Polyglot monorepos

mehen runs per-file language detection over any directory tree. Pass multiple paths to limit which
trees are walked and let mehen pick supported languages from each:

```bash
mehen top-offenders crates/api/src apps/web/src tools --metric cognitive
```

The [GitHub Action](/guides/github-action) accepts the same multi-path input.
