libeulix

I pulled Eulix's analysis engine out into a Rust crate, so anything that needs the symbols and call graph of a repository can use it without the rest of the toolchain.

Status
● Live
Year
2026
Stack
Rust · Tree-sitter · PRISM
Source
Nurysso/eulix/tree/main/libeulix
37.3M
lines parsed, Linux kernel
9
languages
2
PRISM engines

01 / Overview

What it does

libeulix turns source text into structured data: files, symbols, call graphs, project metrics, entry points and dependencies. Tree-sitter parses nine languages, and PRISM resolves the relationships between them into one serializable knowledge base. It is built for large mixed-language repositories, where parsing from scratch for every query is too slow. It has no global state and no required runtime, so it embeds in other programs.

02 / Usage

From one file to a call graph

Add it
cargo add libeulix
Parse one file
use libeulix::grammar_files;
use std::path::Path;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let path = Path::new("src/main.rs");
    let src = std::fs::read_to_string(path)?;

    let (_rel_path, fd) = grammar_files::parse_source(path, &src)?;

    println!("{}: {} functions, {} classes", path.display(), fd.functions.len(), fd.classes.len());

    for f in &fd.functions {
        println!("  fn {} (line {})", f.name, f.line_start);
        for call in &f.calls {
            println!("    → {} at line {}", call.callee, call.line);
        }
    }
    Ok(())
}
Parse many files and build a call graph
use libeulix::analyze::call_graph::prism_v2;
use libeulix::grammar_files;
use libeulix::struc::kb_struct::FileData;
use std::collections::BTreeMap;
use std::path::PathBuf;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let files: Vec<PathBuf> = vec!["src/lib.rs".into(), "src/main.rs".into()];

    let mut structure: BTreeMap<String, FileData> = BTreeMap::new();
    for path in &files {
        let src = std::fs::read_to_string(path)?;
        let (rel, fd) = grammar_files::parse_source(path, &src)?;
        structure.insert(rel, fd);
    }

    let opts = prism_v2::CallGraphOptions::default();
    let cg = prism_v2::build_with(&structure, &opts);

    println!("{} nodes, {} edges", cg.nodes.len(), cg.edges.len());
    Ok(())
}

03 / Pipeline

Parse once, navigate many times

  • Parse

    Tree-sitter extracts functions, methods, classes, structs, traits, imports, docstrings, parameters and line ranges into one FileData per file.

  • Relate

    PRISM merges the files into a KnowledgeBase with a resolved and a reverse call graph, inheritance and type relationships, entry points, indices, patterns and metrics.

  • Use

    The KnowledgeBase serializes to JSON. Query it directly, or hand it to a retrieval layer without reparsing the repository.

04 / PRISM

Two relationship engines

  • PRISM v1

    The simpler, high-throughput path. Name-based resolution with broad call-graph coverage at low cost.

  • PRISM v2

    The scope-aware path. It keeps modules, classes, methods, inheritance, shadowing and receiver context, so common ambiguous calls resolve better than a global name lookup.

  • Evidence, not proof

    PRISM stands for Polyglot Resolution via Inverted Symbol Map. It is approximate by design: edges are labelled call or inheritance, carry a call-site line and a conditional flag, and are navigation evidence rather than proof of runtime behaviour.

05 / API

Free functions, no engine

  • grammar_files::parse_source

    Parse one in-memory source file into a FileData. parse_file reads it from disk first.

  • prism_v2::build_with

    Build a scope-aware call graph from a BTreeMap of FileData. CallGraphOptions sets max_ambiguous (default 8) and strict_imports (default on).

  • pipeline::analyze_and_build

    Run every analysis pass over a KnowledgeBase, so its call graph, entry points, patterns and external dependencies are filled in.

  • analyze::*

    Lookup indices, project summary, complexity metrics, entry points, external dependencies and architectural patterns, each available as its own pass.

06 / Goals

What it is built for

  • Large repositories

    A 30M+ line repository should be something it can process on consumer hardware, not a figure that only holds on a workstation.

  • Useful output

    Other tools consume it, so stable identifiers and useful source relationships matter as much as raw parse speed.

  • Cheap approximations

    Not every task needs compiler-grade reasoning. For code navigation, a fast and useful relationship beats an expensive attempt at a perfect one.

  • Embeddable

    No global state, no required runtime, no required tokio. Every public function takes its input by reference and returns owned data.

07 / Install

Get it running

Cargo
cargo add libeulix

Needs Rust stable and a C compiler for the tree-sitter grammars. The API docs are on docs.rs.

08 / Limits

Rough edges

  • Call resolution is approximate. Dynamic dispatch, reflection and generated code are best-effort, so treat the call graph as navigation evidence, not proof.
  • C and C++ parsing is limited by macro expansion, and JSX and TSX are not parsed.
  • It needs a C compiler to build, because the tree-sitter grammar crates compile C.

09 / FAQ

Before you try it

Do I need the Eulix CLI?
No. libeulix is a library with no global state, no required runtime and no required tokio, so you can embed it in your own program.
Which languages does it parse?
C, C++, Go, Java, JavaScript, PHP, Python, Rust and TypeScript. JSX and TSX are not parsed.
Is the call graph exact?
No. PRISM is approximate, tuned for navigating large repositories rather than proving whole-program behaviour. Dynamic dispatch, reflection and generated code are best-effort.
What do I need to build it?
Rust stable and a C compiler, because the tree-sitter grammar crates compile C at build time.
How do I use more than one core?
Parallelism is opt-in. Run libeulix inside your own rayon pool.

libeulix

I pulled Eulix's analysis engine out into a Rust crate, so anything that needs the symbols and call graph of a repository can use it without the rest of the toolchain.