Code-Graph-RAG Supported Languages: 14 Programming Languages and Their Capabilities

Code-Graph-RAG supports 14 programming languages including C, C#, C++, Dart, Go, Java, JavaScript, Lua, PHP, Python, Rust, TypeScript, TypeScript-TSX, and Scala (in development), all parsed through Tree-sitter into a unified, language-agnostic knowledge graph.

Code-Graph-RAG is an open-source retrieval-augmented generation (RAG) engine for codebases that builds cross-language knowledge graphs. Understanding which Code-Graph-RAG supported languages are available—and what capabilities each offers—is essential for teams working with polyglot codebases.

How Code-Graph-RAG Achieves Language Agnosticism

The engine relies on Tree-sitter, a fast incremental parser that produces a uniform abstract syntax tree (AST) for any language with a Tree-sitter grammar. This eliminates the need for language-specific parsers and enables a single graph schema across all supported languages.

In codebase_rag/language_spec.py, the LanguageSpec class handles three critical tasks:

  1. Grammar discovery – Loads the appropriate Tree-sitter grammar for each language
  2. Extension registration – Maps file extensions to their corresponding parsers
  3. AST-to-graph mapping – Converts language-specific AST nodes into unified graph entities (functions, classes, modules, etc.)

This architecture means a Cypher query written for Python functions works identically for Rust functions, Java methods, or Go receiver methods.

Complete Language Support Matrix

The authoritative source for Code-Graph-RAG supported languages is docs/architecture/language-support.md. The table below reflects the current coverage as implemented in the repository:

Fully Supported Languages (13)

Language Extensions Functions Classes/Structs Modules Package Detection Key Capabilities
C .c ✓ ✓ ✓ ✓ Functions, structs, unions, enums, pre-processor includes
C# .cs ✓ ✓ ✓ – Namespaces, classes/structs/records/interfaces/enums, generics, inheritance, using directives
C++ .cpp, .h, .hpp, .cc ✓ ✓ ✓ ✓ Constructors, destructors, operator overloading, templates, lambdas, C++20 modules, pre-processor macros
Dart .dart ✓ ✓ ✓ – Classes, mixins, extensions, enhanced enums, Flutter widgets, package/relative imports
Go .go ✓ ✓ ✓ – Receiver methods, structs, interfaces, type declarations
Java .java ✓ ✓ ✓ – Generics, annotations, records, sealed classes, concurrency constructs
JavaScript .js, .jsx, .mjs, .cjs ✓ ✓ ✓ – ES6 modules, CommonJS, prototype & object methods, arrow functions
Lua .lua ✓ – ✓ – Local/global functions, metatables, closures, coroutines
PHP .php ✓ ✓ ✓ – Classes, interfaces, traits, enums, namespaces, PHP 8 attributes
Python .py ✓ ✓ ✓ ✓ Type inference, decorators, nested functions
Rust .rs ✓ ✓ ✓ ✓ impl blocks, associated functions, macro_rules! macros
TypeScript .ts, .mts, .cts ✓ ✓ ✓ – Interfaces, type aliases, enums, namespaces, ES6/CommonJS modules
TypeScript (TSX) .tsx ✓ ✓ ✓ – Full TypeScript plus JSX components

In Development (1)

Language Extensions Functions Classes/Structs Modules Status Notes
Scala .scala, .sc ✓ ✓ ✓ Case classes, objects—parsing implementation incomplete

Language-Specific Capabilities Deep-Dive

Systems Languages: C, C++, Rust

These languages receive comprehensive low-level support. C++ parsing in codebase_rag/language_spec.py handles modern C++20 modules alongside traditional templates and lambdas. Rust support captures impl blocks and associated functions—critical for understanding ownership patterns. Both C and C++ include package detection via header/include analysis.

JVM Languages: Java, Scala

Java support covers modern language features including records, sealed classes, and generics. The Scala integration is actively developed, with case classes and singleton objects already recognized in the AST mapping.

Web/Node.js Ecosystem: JavaScript, TypeScript, TSX

Code-Graph-RAG distinguishes between TypeScript (.ts, .mts, .cts) and TypeScript-TSX (.tsx) as separate entries. Both support full type system constructs—interfaces, type aliases, namespaces—while TSX adds JSX component detection. JavaScript handles both ES6 modules and CommonJS seamlessly.

Mobile & Specialized: Dart, Go, Lua, PHP

  • Dart – Flutter widget detection and mixin/extension support
  • Go – Receiver method parsing distinguishes between value and pointer receivers
  • Lua – Unique among supported languages for lacking class constructs; focuses on function-level analysis with closure detection
  • PHP – Modern PHP 8 attributes and trait composition are fully parsed

Python: Deep Language Integration

Python receives enhanced treatment with type inference and decorator chain parsing. The codebase_rag/constants/languages.py file includes Python-specific AST node mappings that capture nested function scopes—uncommon in other language implementations.

Working with the Language Support System

Loading a Multi-Language Repository

from codebase_rag import CodeGraphRAG

# Automatically detects all supported languages in the repository

cgr = CodeGraphRAG(root_path="/path/to/polyglot_repo")
cgr.build_graph()  # Parses files based on registered extensions

This initializes the engine with default configuration enabling all Code-Graph-RAG supported languages from codebase_rag/constants/languages.py.

Running Language-Agnostic Queries


# Find all functions named "validate" across any supported language

query = """
MATCH (f:Function {name: "validate"})
RETURN f.language, f.file_path, f.start_line, f.end_line
"""
results = cgr.query_cypher(query)

for r in results:
    print(f"[{r['language']}] {r['file_path']}:{r['start_line']}-{r['end_line']}")

The language property on every graph node enables filtering or aggregation by source language without modifying the query structure.

CLI Export for Specific Languages


# Export only Python and Rust files from a mixed codebase

python -m codebase_rag.cli export-graph \
    --root /path/to/project \
    --include-ext .py,.rs \
    --output python_rust_graph.json

The CLI in codebase_rag/cli.py respects the same extension-to-language mappings defined in the core language spec.

Extending Language Support

Adding new languages is designed to be straightforward. The repository's Adding Languages guide (referenced in docs/architecture/language-support.md) specifies that any language with an existing Tree-sitter grammar requires only:

  1. Grammar package installation
  2. Extension registration in codebase_rag/constants/languages.py
  3. AST node type mapping in codebase_rag/language_spec.py

The LanguageSpec class automatically discovers and registers new grammars through this configuration-driven approach.

Summary

  • Code-Graph-RAG supported languages total 14: 13 fully supported (C, C#, C++, Dart, Go, Java, JavaScript, Lua, PHP, Python, Rust, TypeScript, TypeScript-TSX) plus Scala in active development
  • Tree-sitter foundation provides uniform AST parsing across all languages
  • Unified graph schema enables truly language-agnostic Cypher queries
  • Deep language features are captured per-language: C++ templates, Rust macros, Python decorators, TypeScript interfaces, etc.
  • Extension capability allows straightforward addition of any Tree-sitter grammar

Frequently Asked Questions

What makes Code-Graph-RAG "language-agnostic"?

The engine maps every language's AST into a single graph schema with common entity types: Function, Class, Module, Package. A query for functions returns results from Python, Rust, Java, or any combination without syntax changes. This polyglot design is implemented in codebase_rag/language_spec.py through unified node type mappings.

Why is Scala listed as "in development" while other languages are fully supported?

Scala's complex type system and syntactic flexibility require additional AST node mappings that are incomplete as of the current repository state. The docs/architecture/language-support.md file indicates that case classes and objects are partially implemented, but full pattern matching and implicits coverage remains under development.

Can I query across multiple languages in a single operation?

Yes. The graph schema deliberately shares entity types across languages, so MATCH (f:Function) WHERE f.name = "main" returns the main function from C, Go, Rust, or any supported language in the same query. The language property on each node allows post-filtering if needed.

How does package detection work for languages that support it?

Package detection is implemented for C, C++, Python, and Rust. For C/C++, it analyzes #include directives and header guards. For Python, it parses __init__.py structures and relative imports. For Rust, it maps mod declarations and Cargo.toml workspace membership. This information feeds into the Package node type in the unified graph.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →