#parser #language #dlang

nightly oak-d

High-performance incremental D language parser for the oak ecosystem with flexible configuration, supporting systems programming and native development

12 releases

Uses new Rust 2024

0.0.11 Mar 30, 2026
0.0.10 Mar 24, 2026
0.0.4 Feb 17, 2026
0.0.1 Jan 23, 2026
0.0.0 Oct 20, 2025

#573 in Text editors

MPL-2.0 license

425KB
7K SLoC

🚀 Oak D Parser

Crates.io Documentation

Systems Programming with Modern Agility — A high-performance, incremental D parser built on the Oak framework. Optimized for systems programming, performance-critical applications, and modern developer tooling.

🎯 Project Vision

D is a language that combines the power and performance of C++ with the programmer productivity of modern languages like Python and Ruby. oak-d aims to provide a robust, modern, Rust-powered infrastructure for parsing D that is both accurate and incredibly fast. By utilizing Oak's incremental parsing architecture, we enable the creation of highly responsive IDEs, refactoring tools, and static analyzers that can handle large D codebases in real-time.

✨ Core Features

  • ⚡ Blazing Fast: Leverages Rust's performance and memory safety to provide sub-millisecond parsing, essential for high-frequency developer tools and real-time analysis.
  • 🔄 Incremental by Design: Built-in support for partial updates—re-parse only what changed. Ideal for large-scale D projects where maintainability and tool responsiveness are critical.
  • 🌳 High-Fidelity AST: Generates a comprehensive Abstract Syntax Tree capturing the full depth of D:
    • Metaprogramming: Deep support for templates, mixins, and compile-time function execution (CTFE).
    • Object-Oriented & Functional: Precise mapping of classes, interfaces, and functional programming constructs.
    • Memory Management: Awareness of D's various memory management strategies (GC, manual, reference counting).
    • Comments & Whitespace: Retains all trivia, enabling faithful round-trip processing and refactoring.
  • 🛡️ Industrial-Grade Fault Tolerance: Engineered to recover from syntax errors gracefully, providing precise diagnostics—crucial for maintaining a smooth developer experience during active coding.
  • 🧩 Deep Ecosystem Integration: Seamlessly works with oak-lsp for full LSP support and oak-mcp for intelligent code discovery and analysis.

🏗️ Architecture

The parser follows the Green/Red Tree architecture (inspired by Roslyn), which allows for:

  1. Efficient Immutability: Share nodes across different versions of the tree without copying.
  2. Lossless Syntax Trees: Retains all trivia (whitespace and comments), enabling faithful code formatting and refactoring.
  3. Type Safety: Strongly-typed "Red" nodes provide a convenient and safe API for tree traversal and analysis.

🤝 Contributing

We welcome contributions of all kinds! If you find a bug, have a feature request, or want to contribute code, please check our issues or submit a pull request.

Dependencies

~5–9.5MB
~100K SLoC