Oak Ada Parser
High-performance incremental Ada parser for the oak ecosystem with flexible configuration, optimized for embedded systems and safety-critical applications.
🎯 Overview
Oak Ada is a robust parser for Ada 2012, designed to handle complete Ada syntax including SPARK annotations and modern features. Built on the solid foundation of oak-core, it provides both high-level convenience and detailed AST generation for Ada analysis and tooling.
✨ Features
- Complete Ada 2012 Syntax: Supports all Ada features including modern specifications
- SPARK Support: Handles SPARK annotations and contracts
- 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
Package Parsing
use ;
let parser = new;
let source = new;
let result = parser.parse;
println!;
Procedure 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;
// Token information is available in the parse result
Error Handling
use ;
let parser = new;
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:
- Package: Root container for Ada packages
- Procedure: Ada procedures
- Declarations: Variable, constant, type declarations
- Statements: Assignment, if, loop, case statements
📊 Performance
- Streaming: Parse large Ada 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-ada integrates seamlessly with:
- Static Analysis: Code quality and security analysis
- Code Generation: Generating code from Ada AST
- IDE Support: Language server protocol compatibility
- Refactoring: Automated code refactoring
- Documentation: Generating documentation from Ada code
📚 Examples
Check out the examples directory for comprehensive examples:
- Complete Ada package parsing
- Procedure and function analysis
- Code transformation
- Integration with development workflows
🤝 Contributing
Contributions are welcome!
Please feel free to submit pull requests at the project repository or open issues.