Oak Verilog Parser
High-performance incremental Verilog parser for the oak ecosystem with flexible configuration, optimized for hardware description and verification.
🎯 Overview
Oak Verilog is a robust parser for Verilog, designed to handle complete Verilog 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 verification.
✨ Features
- Complete Verilog Syntax: Supports all Verilog 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 ;
📋 Parsing Examples
Module Parsing
use ;
let parser = new;
let source = new;
let result = parser.parse;
println!;
Sequential Logic Parsing
use ;
let parser = new;
let source = new;
let result = parser.parse;
println!;
🔧 Advanced Features
Token-Level Parsing
use ;
let parser = new;
let source = new;
let result = parser.parse;
println!;
Error Handling
use ;
let parser = new;
let source = new;
let result = parser.parse;
if let Some = result.result.err else
🏗️ AST Structure
The parser generates a comprehensive AST with the following main structures:
- VerilogSource: Root container for Verilog source files
- Module: Verilog module definitions
- Port: Module port declarations
- Declaration: Variable and net declarations
- Statement: Procedural statements and blocks
- Expression: Various expression types including operators
- Instance: Module instantiation
📊 Performance
- Streaming: Parse large Verilog 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 Verilog integrates seamlessly with:
- Hardware Design: Building hardware design tools
- Verification: Creating verification and simulation tools
- Synthesis: Front-end for synthesis tools
- IDE Support: Language server protocol compatibility for Verilog
- Educational Tools: Building Verilog learning environments
📚 Examples
Check out the examples directory for comprehensive examples:
- Complete Verilog module 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.