Oak Vala Parser
High-performance incremental Vala parser for the oak ecosystem with flexible configuration, optimized for GObject-based application development and GNOME ecosystem integration.
🎯 Overview
Oak Vala is a robust parser for the Vala programming language, designed to handle complete Vala syntax including modern object-oriented features and GTK bindings. Built on the solid foundation of oak-core, it provides both high-level convenience and detailed AST generation for Vala analysis and tooling.
✨ Features
- Complete Vala Syntax: Supports all Vala features including modern specifications
- GObject Integration: Handles GObject type system and signals
- 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
Class Parsing
use ;
let parser = new;
let source = new;
let result = parser.parse;
println!;
Interface 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:
- Class: Class definitions with inheritance
- Interface: Interface definitions
- Method: Method and function definitions
- Property: Property definitions with getters/setters
- Signal: Signal definitions for event handling
- Namespace: Namespace declarations
- Statements: Assignment, if, loop, try statements
- Expressions: Binary, unary, method call expressions
📊 Performance
- Streaming: Parse large Vala 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-vala integrates seamlessly with:
- Static Analysis: Code quality and security analysis
- Code Generation: Generating C code from Vala AST
- IDE Support: Language server protocol compatibility
- Refactoring: Automated code refactoring
- Documentation: Generating documentation from Vala code
📚 Examples
Check out the examples directory for comprehensive examples:
- Complete Vala class parsing
- Interface and implementation analysis
- Property and signal handling
- Integration with GTK applications
🤝 Contributing
Contributions are welcome!
Please feel free to submit pull requests at the project repository or open issues.