Oak VHDL Parser
High-performance incremental VHDL parser for the oak ecosystem with flexible configuration, optimized for hardware description and digital circuit design.
🎯 Overview
Oak VHDL is a robust parser for VHDL, designed to handle complete VHDL syntax including modern features. Built on the solid foundation of oak-core, it provides both high-level convenience and detailed AST generation for hardware description and digital circuit design.
✨ Features
- Complete VHDL Syntax: Supports all VHDL features including modern specifications
- Full AST Generation: Generates comprehensive Abstract Syntax Trees
- Lexer Support: Built-in tokenization with proper span information
- Error Recovery: Graceful handling of syntax errors with detailed diagnostics
🚀 Quick Start
Basic example:
use ;
use ;
📋 Parsing Examples
Entity Parsing
use ;
use ;
let language = default;
let parser = new;
let mut session = default;
let source = new;
let result = parser.parse;
println!;
Architecture Parsing
use ;
use ;
let language = default;
let parser = new;
let mut session = default;
let source = new;
let result = parser.parse;
println!;
Package Parsing
use ;
use ;
let language = default;
let parser = new;
let mut session = default;
let source = new;
let result = parser.parse;
println!;
🔧 Advanced Features
Token-Level Parsing
use ;
use ;
let language = default;
let parser = new;
let mut session = default;
let source = new;
let result = parser.parse;
// Token information is available in the parse result
Error Handling
use ;
use ;
let language = default;
let parser = new;
let mut session = default;
let source = new;
let result = parser.parse;
if let Err = result.result
🏗️ AST Structure
The parser generates a comprehensive AST with the following main structures:
- VhdlSource: Root container for VHDL source files
- DesignUnit: VHDL design units (entity, architecture, package, etc.)
- Entity: Entity declarations with ports and generics
- Architecture: Architecture implementations with statements
- Process: Process statements with sensitivity lists
- SignalDeclaration: Signal and variable declarations
- ConcurrentStatement: Concurrent statements (assignments, instances, etc.)
- SequentialStatement: Sequential statements within processes
📊 Performance
- Streaming: Parse large VHDL files without loading entirely into memory
- Incremental: Re-parse only changed sections
- Memory Efficient: Smart AST node allocation
- Fast Recovery: Quick error recovery for better IDE integration
🔗 Integration
Oak VHDL integrates seamlessly with:
- Hardware Design: Building hardware design tools
- Simulation: Creating simulation and verification tools
- Synthesis: Front-end for synthesis tools
- IDE Support: Language server protocol compatibility for VHDL
- Educational Tools: Building VHDL learning environments
📚 Examples
Check out the examples directory for comprehensive examples:
- Complete VHDL design unit parsing
- Hardware description analysis
- Integration with development workflows
🤝 Contributing
Contributions are welcome!
Please feel free to submit pull requests at the project repository or open issues.