Oak COBOL Parser
High-performance incremental COBOL parser for the oak ecosystem with flexible configuration, optimized for legacy system analysis and mainframe development.
🎯 Overview
Oak COBOL is a robust parser for COBOL, designed to handle complete COBOL syntax including legacy and modern features. Built on the solid foundation of oak-core, it provides both high-level convenience and detailed AST generation for legacy system analysis and mainframe development.
✨ Features
- Complete COBOL Syntax: Supports all COBOL features including legacy 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
Program Parsing
use ;
let parser = new;
let source = new;
let result = parser.parse;
println!;
Data Division 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:
- Program: Root container for COBOL programs
- IdentificationDivision: Program identification information
- EnvironmentDivision: Environment and configuration settings
- DataDivision: Data definitions and working storage
- ProcedureDivision: Program logic and procedures
- Statement: Various COBOL statement types
- Expression: Arithmetic and conditional expressions
📊 Performance
- Streaming: Parse large COBOL 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 COBOL integrates seamlessly with:
- Legacy System Analysis: Analyze and understand legacy COBOL codebases
- Mainframe Development: Build tools for mainframe development environments
- Migration Tools: Convert COBOL code to modern languages
- IDE Support: Language server protocol compatibility for COBOL
- Documentation Tools: Extract documentation from COBOL source code
📚 Examples
Check out the examples directory for comprehensive examples:
- Complete COBOL program parsing
- Data division analysis
- Procedure division extraction
- Integration with development workflows
🤝 Contributing
Contributions are welcome!
Please feel free to submit pull requests at the project repository or open issues.