Oak JASMIN Parser
High-performance incremental JASMIN parser for the oak ecosystem with flexible configuration, optimized for JVM bytecode assembly and analysis.
🎯 Overview
Oak JASMIN is a robust parser for JASMIN, designed to handle complete Java assembler syntax including modern features. Built on the solid foundation of oak-core, it provides both high-level convenience and detailed AST generation for JVM bytecode processing and analysis.
✨ Features
- Complete JASMIN Syntax: Supports all JASMIN 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 ;
use ;
📋 Parsing Examples
Class Parsing
use ;
use ;
let mut session = default;
let parser = new;
let source = new;
let result = parser.parse;
println!;
Method Parsing
use ;
use ;
let mut session = default;
let parser = new;
let source = new;
let result = parser.parse;
println!;
🔧 Advanced Features
Token-Level Parsing
use ;
use ;
let mut session = default;
let parser = new;
let source = new;
let result = parser.parse;
println!;
Error Handling
use ;
use ;
let mut session = default;
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:
- JasminProgram: Root container for JASMIN programs
- ClassFile: JASMIN class definitions
- Method: Method definitions with bytecode instructions
- Field: Field definitions with types and access modifiers
- Instruction: Individual bytecode instructions
- ConstantPool: Constant pool entries
- Attribute: Class and method attributes
📊 Performance
- Streaming: Parse large JASMIN 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 JASMIN integrates seamlessly with:
- JVM Analysis: Build JVM bytecode analysis tools
- Compiler Development: Generate JVM bytecode from high-level languages
- Reverse Engineering: Support reverse engineering workflows
- IDE Support: Language server protocol compatibility for JASMIN
- Educational Tools: Build JVM bytecode learning environments
📚 Examples
Check out the examples directory for comprehensive examples:
- Complete JASMIN class parsing
- Bytecode instruction analysis
- Constant pool management
- Integration with development workflows
🤝 Contributing
Contributions are welcome!
Please feel free to submit pull requests at the project repository or open issues.