Skip to content

Eatgrapes/Rusty-JavaC

Repository files navigation

Rusty-JavaC

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.

Why

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.

Pipeline

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

Use It

As a library:

cargo add rusty-javac

Or in Cargo.toml:

rusty-javac = "VERSION"

Build

Requirements:

  • Rust 1.85+
  • cargo
git clone https://github.com/Eatgrapes/Rusty-JavaC.git
cd Rusty-JavaC
cargo build --locked

Status

Some parts of Java are still incomplete. See TODO.md for the current backlog.

Contributing

First Thanks!We welcome any PRs Read CONTRIBUTING.md before opening a PR.

License

MIT

About

A Java code compiler implemented in pure rust(WIP)

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors