Oak Groovy Parser
High-performance incremental Groovy parser for the oak ecosystem with flexible configuration, optimized for build systems and dynamic language applications.
🎯 Overview
Oak Groovy is a robust parser for Apache Groovy, designed to handle complete Groovy syntax including modern language features and DSL capabilities. Built on the solid foundation of oak-core, it provides both high-level convenience and detailed AST generation for Groovy analysis and tooling.
✨ Features
- Complete Groovy Syntax: Supports all Groovy features including closures, builders, and dynamic typing
- DSL Support: Handles domain-specific languages and Groovy-specific constructs
- 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!;
Closure 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: Groovy class definitions
- Method: Method and function definitions
- Closure: Groovy closure expressions
- Statement: Assignment, control flow, and expression statements
- Expression: Method calls, literals, and operators
📊 Performance
- Streaming: Parse large Groovy 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-groovy integrates seamlessly with:
- Build Systems: Gradle and other build tool analysis
- Static Analysis: Code quality and security analysis
- Code Generation: Generating code from Groovy AST
- IDE Support: Language server protocol compatibility
- Refactoring: Automated code refactoring
- Documentation: Generating documentation from Groovy code
📚 Examples
Check out the examples directory for comprehensive examples:
- Complete Groovy class parsing
- Closure and DSL analysis
- Build script processing
- Integration with development workflows
🤝 Contributing
Contributions are welcome!
Please feel free to submit pull requests at the project repository or open issues.