| Crates.io | oak-llvm-ir |
| lib.rs | oak-llvm-ir |
| version | 0.0.1 |
| created_at | 2026-01-23 04:36:42.060111+00 |
| updated_at | 2026-01-23 04:36:42.060111+00 |
| description | High-performance incremental LLVM IR parser for the oak ecosystem with flexible configuration, supporting low-level intermediate representation analysis. |
| homepage | https://github.com/ygg-lang/oaks |
| repository | https://github.com/ygg-lang/oaks |
| max_upload_size | |
| id | 2063436 |
| size | 70,965 |
High-performance incremental LLVM IR parser for the oak ecosystem with flexible configuration, optimized for LLVM intermediate representation processing.
Oak LLVM is a robust parser for LLVM IR (Intermediate Representation), designed to handle complete LLVM syntax including modern specifications. Built on the solid foundation of oak-core, it provides both high-level convenience and detailed AST generation for LLVM IR analysis and code generation.
Basic example:
use oak_llvm_ir::{LlirParser, LLvmLanguage};
use oak_core::SourceText;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let parser = LlirParser::new();
let source = SourceText::new(r#"
define i32 @add(i32 %a, i32 %b) {
entry:
%sum = add i32 %a, %b
ret i32 %sum
}
"#);
let result = parser.parse(&source);
println!("Parsed LLVM IR successfully.");
Ok(())
}
use oak_llvm_ir::{LlirParser, LLvmLanguage};
use oak_core::SourceText;
let parser = LlirParser::new();
let source = SourceText::new(r#"
define i32 @multiply(i32 %a, i32 %b) {
entry:
%product = mul i32 %a, %b
ret i32 %product
}
"#);
let result = parser.parse(&source);
println!("Function definition parsed successfully.");
use oak_llvm_ir::{LlirParser, LLvmLanguage};
use oak_core::SourceText;
let parser = LlirParser::new();
let source = SourceText::new(r#"
%Person = type { i32, [10 x i8], i8* }
%ListNode = type { i32, %ListNode* }
"#);
let result = parser.parse(&source);
println!("Type declarations parsed successfully.");
use oak_llvm_ir::{LlirParser, LLvmLanguage};
use oak_core::SourceText;
let parser = LlirParser::new();
let source = SourceText::new("define i32 @test() { ret i32 0 }");
let result = parser.parse(&source);
println!("Token parsing completed.");
use oak_llvm_ir::{LlirParser, LLvmLanguage};
use oak_core::SourceText;
let parser = LlirParser::new();
let source = SourceText::new(r#"
define i32 @invalid(
%result = add i32 %a %b
// Missing closing parenthesis and return
"#);
let result = parser.parse(&source);
if let Some(errors) = result.result.err() {
println!("Parse errors found: {:?}", errors);
}