Warning
This project is still under heavy development. It is not intended to replace the official Java compiler yet.
Rusty-JavaC is a Java compiler written in Rust.
The official Java compiler is written in Java. While this is great for self-hosting, it can be slow and memory-intensive in some cases. Rust provides several advantages for a compiler project:
- Performance: Rust's zero-cost abstractions and lack of a garbage collector allow for a faster compilation process.
- Safety: Rust's ownership model ensures memory safety and thread safety, reducing bugs in the compiler itself.
- Modern Tooling: Leveraging Cargo and the Rust ecosystem makes it easier to manage dependencies and build cross-platform binaries.
The compiler is one Cargo package with stages split into modules under src/:
Java source
-> lexer
-> parser
-> ast
-> hir lowering
-> type and call resolution
-> bytecode generation
-> JVM .class file
As a library:
cargo add rusty-javacOr in Cargo.toml:
rusty-javac = "VERSION"Requirements:
- Rust 1.85+
- cargo
git clone https://github.com/Eatgrapes/Rusty-JavaC.git
cd Rusty-JavaC
cargo build --lockedSome parts of Java are still incomplete. See TODO.md for the current backlog.
First Thanks!We welcome any PRs Read CONTRIBUTING.md before opening a PR.