1 unstable release
Uses new Rust 2024
| 0.1.1 | Mar 16, 2026 |
|---|
#1999 in Programming languages
Used in 2 crates
(via rajac-compiler)
95KB
2.5K
SLoC
rajac
rajac is an alternative Java compiler written in Rust.
Note: This project is still in development and not ready for use.
Overview
This project aims to provide a high-performance, memory-efficient Java compiler implementation using modern Rust practices. The compiler is designed to be modular and extensible while maintaining compatibility with standard Java bytecode.
Features
- Fast compilation: Optimized for performance with Rust's zero-cost abstractions
- Memory efficient: Careful memory management using
SharedStringand other optimizations - Modular architecture: Clean separation of concerns across multiple crates
- Java compatibility: Generates standard bytecode compatible with JVM
Architecture
The project is organized as a Cargo workspace with the following main crates:
rajac-compiler- Main compiler entry pointrajac-ast- Abstract syntax tree definitionsrajac-parser- Java source code parsingrajac-lexer- Tokenization of Java source coderajac-bytecode- Bytecode generation and manipulationrajac-diagnostics- Error reporting and diagnosticsrajac-symbols- Symbol table and type resolutionrajac-classpath- Classpath handlingrajac-base- Shared utilities and typesrajac-verification- Compiler correctness verification
Getting Started
Prerequisites
- Rust 1.70+ (recommended latest stable)
- Java runtime for testing compiled output
Building
# Build in debug mode (faster compilation)
cargo build
# Build in release mode (optimized binary)
cargo build --release
Running the Compiler
# Compile Java source files (debug mode)
cargo run -p rajac-compiler -- <source-directory>
# Compile Java source files (release mode)
cargo run --release -p rajac-compiler -- <source-directory>
Development
Running Tests
# Run all tests
cargo test
# Run tests with output
cargo test -- --nocapture
# Run specific crate tests
cargo test -p rajac-parser
Code Quality
Run the code quality checks:
./scripts/check-code.sh
This will run formatting, linting, and tests to ensure code quality.
Project Structure
- Each struct, enum, and trait has its own file
- Tests are colocated with the code they test
- Documentation follows question-driven format
- Use
SharedStringinstead ofStringfor struct fields
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Run
./scripts/check-code.shto verify quality - Commit using conventional commit format
- Submit a pull request
Status
This is an active development project.
Dependencies
~19–26MB
~388K SLoC