Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Supported Languages

Coraline uses tree-sitter for parsing, enabling support for 33 programming languages with AST-level precision.

Language Support Table

LanguageStatustree-sitter grammarFramework Support
Bash✅ Fulltree-sitter-bash 0.25.1-
C✅ Fulltree-sitter-c 0.23-
C++✅ Fulltree-sitter-cpp 0.23-
C#✅ Fulltree-sitter-c-sharp 0.23.NET
Blazor✅ Fulltree-sitter-blazor 0.1.1 (custom)Blazor components
Dart✅ Fulltree-sitter-dart 0.0.4Flutter
Elixir✅ Fulltree-sitter-elixir 0.3.4Phoenix
Elm✅ Fulltree-sitter-elm 5.9.0-
Erlang✅ Fulltree-sitter-erlang 0.15.0OTP
Fortran✅ Fulltree-sitter-fortran 0.5.1-
Go✅ Fulltree-sitter-go 0.23-
Groovy✅ Fulltree-sitter-groovy 0.1.2Gradle
Haskell✅ Fulltree-sitter-haskell 0.23.1-
Java✅ Fulltree-sitter-java 0.23Spring
JavaScript✅ Fulltree-sitter-javascript 0.25.0Node.js
JSX✅ Fulltree-sitter-javascript 0.25.0React
Julia✅ Fulltree-sitter-julia 0.23.1-
Kotlin✅ Fulltree-sitter-kotlin-ng 1.1.0Android
Lua✅ Fulltree-sitter-lua 0.4.1-
Markdown✅ Fulltree-sitter-markdown-fork 0.7.3-
MATLAB✅ Fulltree-sitter-matlab 1.3.0-
Nix✅ Fulltree-sitter-nix 0.3.0-
Perl✅ Fulltree-sitter-perl 1.1.2-
PHP✅ Fulltree-sitter-php 0.24.2Laravel
PowerShell✅ Fulltree-sitter-powershell 0.25.10-
Python✅ Fulltree-sitter-python 0.23Django, Flask
R✅ Fulltree-sitter-r 1.2.0-
Ruby✅ Fulltree-sitter-ruby 0.23Rails
Rust✅ Fulltree-sitter-rust 0.24.0-
Scala✅ Fulltree-sitter-scala 0.24.0-
Swift✅ Fulltree-sitter-swift 0.7.1iOS/macOS
TOML✅ Fulltree-sitter-toml-ng 0.7.0Config files
TypeScript✅ Fulltree-sitter-typescript 0.23.1Node.js
TSX✅ Fulltree-sitter-typescript 0.23.1React
YAML✅ Fulltree-sitter-yaml 0.7.2Config files
Zig✅ Fulltree-sitter-zig 1.1.2-

Language Detection

Coraline detects languages by file extension:

Extension(s)Language
.rsRust
.tsTypeScript
.tsxTSX (TypeScript + JSX)
.jsJavaScript
.jsxJSX (JavaScript + JSX)
.pyPython
.goGo
.javaJava
.c, .hC
.cpp, .cc, .cxx, .hppC++
.csC#
.phpPHP
.rbRuby
.swiftSwift
.kt, .ktsKotlin
.sh, .bashBash
.ps1, .psm1PowerShell
.razorBlazor
.dartDart
.ex, .exsElixir
.elmElm
.erl, .hrlErlang
.f90, .f95, .f03Fortran
.groovy, .gradleGroovy
.hsHaskell
.jlJulia
.luaLua
.md, .markdownMarkdown
.mMATLAB
.nixNix
.pl, .pmPerl
.r, .RR
.scala, .scScala
.tomlTOML
.yaml, .ymlYAML
.zigZig

Node Types by Language

Different languages produce different node kinds:

Object-Oriented (Java, C#, Swift, Kotlin)

  • class
  • interface
  • method
  • property
  • field
  • enum
  • enum_member

Functional (Haskell, Scala, Elixir, Erlang)

  • function
  • module
  • trait (Scala)
  • type_alias
  • constant

Systems (Rust, C, C++, Zig)

  • struct
  • function
  • trait (Rust)
  • enum
  • type_alias
  • module (Rust)

Scripting (Python, Ruby, PHP, Bash)

  • function
  • class
  • method
  • variable
  • constant

Web Frontend (JavaScript, TypeScript, TSX, JSX)

  • function
  • class
  • method
  • component (React/JSX/TSX)
  • interface (TypeScript)
  • type_alias (TypeScript)

Markup (Markdown, YAML, TOML)

  • module (file-level)
  • constant (YAML/TOML keys)

Framework-Specific Features

Rust

  • Crate-relative imports (crate::, super::, self::)
  • Trait implementation tracking
  • Macro detection
  • Module tree resolution

React (JavaScript/TypeScript/JSX/TSX)

  • Component detection (PascalCase)
  • Hook tracking (use* functions)
  • Relative imports (./, ../)
  • Path aliases (@/)

Blazor (C# + Razor)

  • Razor component detection (.razor files)
  • Component parameter tracking
  • .NET type resolution
  • Dependency injection detection

Laravel (PHP)

  • PSR-4 autoloading resolution
  • Blade template tracking
  • Facade detection
  • Dot-notation view paths

Python

  • Module imports (from ... import)
  • Package structure
  • Class/function decorators
  • Django/Flask detection (future)

Others

  • Swift/Kotlin: Protocol/interface conformance
  • Elixir: Phoenix routing, Ecto schemas
  • Java: Spring annotations, package resolution

Cross-Language Support

Coraline can index polyglot projects with multiple languages:

project/
├── backend/           (Rust)
├── frontend/          (TypeScript + React)
├── mobile/            (Swift, Kotlin)
└── scripts/           (Python, Bash)

All languages are indexed into a unified graph. Cross-language references (e.g., TypeScript calling Rust WASM) are tracked as unresolved edges unless framework resolvers are available.

Language-Specific Configuration

Customize indexing per language via config.toml:

[indexing]
include_patterns = [
  "src/**/*.rs",           # Rust source
  "lib/**/*.ts",           # TypeScript libraries
  "app/**/*.tsx",          # React components
  "**/*.py",               # Python anywhere
]
exclude_patterns = [
  "**/target/**",          # Rust builds
  "**/node_modules/**",    # JS/TS deps
  "**/__pycache__/**",     # Python cache
  "**/dist/**",            # Build outputs
]

Adding New Languages

Coraline can be extended with new tree-sitter grammars:

  1. Add the grammar to Cargo.toml:

    tree-sitter-newlang = "0.1.0"
    
  2. Register in extraction.rs:

    #![allow(unused)]
    fn main() {
    ".newlang" => tree_sitter_newlang::language(),
    }
  3. Add extraction patterns for node/edge types

  4. (Optional) Add framework resolver in resolution/frameworks/

See Development Guide for contribution instructions.

Language Limitations

Markdown

  • Only headings and code blocks are indexed
  • No inline link tracking

YAML/TOML

  • Config keys indexed as constant nodes
  • No deep structure analysis

Bash/PowerShell

  • Function detection only
  • Limited variable tracking

Future Enhancements

  • SQL query extraction (embedded SQL strings)
  • HTML/CSS parsing (currently ignored)
  • GraphQL schema tracking
  • Protocol Buffers support

Performance by Language

Parse speed varies by grammar complexity:

Language GroupRelative SpeedNotes
Rust, Go, CFastSimple, deterministic grammars
TypeScript, PythonMediumMore complex syntax rules
C++, ScalaSlowerHigh grammar complexity
Markdown, YAMLVery FastSimple structure

Actual impact on indexing is minimal (<5% variation) for most projects.

Testing Language Support

Verify language support for your project:

# Index and check stats
coraline init -i
coraline stats --json

# Check language breakdown
jq '.files_by_language' .coraline/stats.json

Output:

{
  "rust": 42,
  "typescript": 31,
  "python": 12,
  "markdown": 5
}

Search for language-specific symbols:

# Rust
coraline query "impl" --kind trait

# TypeScript
coraline query "interface" --kind interface

# Python
coraline query "def" --kind function

Requesting Language Support

To request a new language:

  1. Check if a tree-sitter grammar exists at tree-sitter.github.io
  2. Open an issue at github.com/greysquirr3l/coraline/issues
  3. Include:
    • Language name and typical file extensions
    • Link to tree-sitter grammar
    • Example files for testing
    • (Optional) Framework-specific features needed

Next Steps