Supported Languages
Rephole uses tree-sitter for intelligent AST-based code chunking. The following 37 programming languages are supported with full AST parsing.
Core Languages
| Language | Extensions | AST Parsing |
|---|---|---|
| TypeScript | .ts, .mts, .cts | ✅ Full support |
| TSX | .tsx | ✅ Full support |
| JavaScript | .js, .jsx, .mjs, .cjs | ✅ Full support |
| Python | .py, .pyw, .pyi | ✅ Full support |
| Java | .java | ✅ Full support |
| Kotlin | .kt, .kts | ✅ Full support |
| Scala | .scala, .sc | ✅ Full support |
Systems Programming
| Language | Extensions | AST Parsing |
|---|---|---|
| C | .c, .h | ✅ Full support |
| C++ | .cpp, .cc, .cxx, .c++, .hpp, .hxx, .h++, .hh | ✅ Full support |
| C# | .cs | ✅ Full support |
| Objective-C | .m, .mm | ✅ Full support |
| Go | .go | ✅ Full support |
| Rust | .rs | ✅ Full support |
| Zig | .zig | ✅ Full support |
Mobile Development
| Language | Extensions | AST Parsing |
|---|---|---|
| Swift | .swift | ✅ Full support |
| Dart | .dart | ✅ Full support |
Scripting Languages
| Language | Extensions | AST Parsing |
|---|---|---|
| Ruby | .rb, .rake, .gemspec | ✅ Full support |
| PHP | .php, .phtml | ✅ Full support |
| Lua | .lua | ✅ Full support |
| Elixir | .ex, .exs | ✅ Full support |
Functional Languages
| Language | Extensions | AST Parsing |
|---|---|---|
| OCaml | .ml, .mli | ✅ Full support |
| ReScript | .res, .resi | ✅ Full support |
Web3 / Blockchain
| Language | Extensions | AST Parsing |
|---|---|---|
| Solidity | .sol | ✅ Full support |
Web Technologies
| Language | Extensions | AST Parsing |
|---|---|---|
| HTML | .html, .htm, .xhtml | ✅ Full support |
| CSS | .css | ✅ Full support |
| Vue | .vue | ✅ Full support |
| ERB/EJS | .erb, .ejs, .eta | ✅ Full support |
Config / Data Languages
| Language | Extensions | AST Parsing |
|---|---|---|
| JSON | .json, .jsonc | ✅ Full support |
| YAML | .yml, .yaml | ✅ Full support |
| TOML | .toml | ✅ Full support |
| Markdown | .md, .markdown, .mdx | ✅ Full support |
Shell & Scripting
| Language | Extensions | AST Parsing |
|---|---|---|
| Bash/Shell | .sh, .bash, .zsh, .fish | ✅ Full support |
| Emacs Lisp | .el, .elc | ✅ Full support |
Formal Methods & Verification
| Language | Extensions | AST Parsing |
|---|---|---|
| TLA+ | .tla | ✅ Full support |
| CodeQL | .ql | ✅ Full support |
Hardware Description
| Language | Extensions | AST Parsing |
|---|---|---|
| SystemRDL | .rdl | ✅ Full support |
How Language Detection Works
The AST parser automatically detects the programming language based on file extension:
- File Extension Detection: When processing a file, Rephole extracts the file extension
- Grammar Loading: The appropriate tree-sitter WASM grammar is loaded
- AST Parsing: The code is parsed into an Abstract Syntax Tree
- Semantic Chunking: Functions, classes, methods, and other semantic blocks are extracted
- Embedding: Each chunk is embedded separately for precise retrieval
file.ts → TypeScript Grammar → AST → Semantic Chunks → Embeddings
Adding New Languages
To add support for a new language:
- Add the tree-sitter WASM grammar file to
resources/ - Create a query in
libs/ingestion/ast-parser/src/constants/queries.ts - Add the language config in
libs/ingestion/ast-parser/src/config/language-config.ts
Unsupported Files
Files with unsupported extensions are gracefully skipped during ingestion. The system will:
- Log a debug message about the unsupported extension
- Continue processing other files
- Return an empty array for that file's chunks
Binary Files
Binary files (images, compiled code, etc.) are automatically excluded from processing.