9 releases
Uses new Rust 2024
| new 0.0.9 | Mar 21, 2026 |
|---|---|
| 0.0.8 | Mar 20, 2026 |
| 0.0.4 | Feb 18, 2026 |
| 0.0.1 | Jan 23, 2026 |
#1542 in Programming languages
Used in 2 crates
(via llvm-assembler)
400KB
6.5K
SLoC
🚀 Oak LLVM IR Parser
The Backbone of Modern Compiler Infrastructure — A high-performance, incremental LLVM Intermediate Representation (IR) parser built on the Oak framework. Optimized for compiler middle-end analysis, optimization passes, and toolchain development.
🎯 Project Vision
LLVM IR is the universal language of modern compiler technology, serving as the bridge between high-level source languages and low-level machine code. oak-llvm-ir aims to provide a robust, modern, Rust-powered infrastructure for parsing LLVM IR that is both accurate and incredibly fast. By utilizing Oak's incremental parsing architecture, we enable the creation of highly responsive compiler tools, static analyzers, and visualization utilities that can handle massive IR files with sub-millisecond latency. Whether you are building custom optimization passes, security auditors, or sophisticated IDE extensions for compiler engineers, oak-llvm-ir provides the high-fidelity AST and efficiency needed to interact with LLVM IR at scale.
✨ Core Features
- ⚡ Blazing Fast: Leverages Rust's performance and memory safety to provide sub-millisecond parsing, essential for high-throughput compiler pipelines and real-time analysis of large IR files.
- 🔄 Incremental by Nature: Built-in support for partial updates—re-parse only the functions or blocks that changed. Ideal for iterative compiler development and interactive optimization tools.
- 🌳 High-Fidelity AST: Generates a comprehensive and precise Abstract Syntax Tree capturing the full depth of LLVM IR:
- Module Structure: Precise mapping of Global Variables, Function Definitions, and Declarations.
- Basic Blocks: Detailed tracking of Control Flow Graph (CFG) nodes and edges.
- Instruction Set: Robust parsing of all LLVM instructions, including SSA form variables and types.
- Metadata & Attributes: Full support for debug metadata, function attributes, and calling conventions.
- Comments & Trivia: Retains all comments and formatting, enabling faithful round-trip processing and analysis.
- 🛡️ Industrial-Grade Fault Tolerance: Engineered to recover from syntax errors gracefully, providing precise diagnostics—crucial for debugging generated IR or malformed inputs.
- 🧩 Deep Ecosystem Integration: Seamlessly works with
oak-lspfor full LSP support andoak-mcpfor intelligent code discovery and analysis.
🏗️ Architecture
The parser follows the Green/Red Tree architecture (inspired by Roslyn), which allows for:
- Efficient Immutability: Share nodes across different versions of the tree without copying.
- Lossless Syntax Trees: Retains all trivia (whitespace and comments), enabling faithful code formatting and refactoring of LLVM IR files.
- Type Safety: Strongly-typed "Red" nodes provide a convenient and safe API for tree traversal and analysis.
🛠️ Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Dependencies
~5–10MB
~105K SLoC