RustC โ€“ Rust Compiler Android App

RustC app interface showing Rust code editor and compiler output

RustC โ€“ Rust Compiler Android App

**RustC** is an advanced **Android compiler application** built for **Rust**, providing a dynamic environment for writing, compiling, and analyzing Rust code directly on your mobile device. It features a robust backend that exposes compiler internals like **token streams**, **Abstract Syntax Trees (AST)**, **symbol tables**, and **Control Flow Graphs (CFG)**.

โœจ Key Features & Compiler Insights

Real-time Rust Compilation

Compile and execute **Rust code** on a powerful backend, receiving immediate feedback and error messages.

Code Editor & Syntax Highlighting

Offers a feature-rich code editor with **syntax highlighting** for Rust, ensuring a comfortable coding experience.

Token Stream Visualization

Visualize the raw **token stream** generated by the Rust compiler, aiding in understanding the lexical analysis phase.

AST & CFG Exploration

Explore the **Abstract Syntax Tree (AST)** and **Control Flow Graph (CFG)** of your Rust code via intuitive tree renderers and graph views.

Symbol Table & LLVM IR Viewing

Inspect the **symbol table** and generated **LLVM IR** to gain deeper insights into Rust's compilation process.

State Persistence

Utilizes **Jetpack DataStore** to persist your last edited code snippet and language preferences locally.

// Rust Example: Hello World with a function
fn main() {
    let message = "Hello from RustC!";
    println!("{}", message);
}

// LLVM IR snippet for a simple integer addition
%add.result = add i32 10, 20

๐Ÿ›  Advanced Technical Architecture

Frontend (Android)

Kotlin

Jetpack Compose

Material Design 3

Compose Navigation

Jetpack DataStore

Backend (Cloud)

Rust (Compiler Core)

Express.js (Node.js for API)

Docker (Multi-stage builds)

Railway (Deployment)

Compiler Tooling & IPC

Rust **`cargo`** (Build System)

Rust **`rustc`** (Actual Compiler)

Rust **`syn`** (Parsing procedural macros)

Rust **`serde`** (Serialization/Deserialization)

Node.js **`child_process.spawn()`**

Communication & Data Viz

Retrofit (HTTP Client)

JSON (Data Exchange)

LLVM IR (Intermediate Representation)

Custom Tree Renderers

Graph Views (for CFG)

๐ŸŽฏ Ideal For & Optimized Experience

  • Compiler Construction Learners: Provides a hands-on platform to visualize and understand different stages of the Rust compilation process.
  • Rust Developers: Offers a portable environment to test Rust snippets and understand their underlying structure.
  • Computer Science Students: An excellent educational tool for learning about programming language design and implementation.
  • Clean MVVM Architecture: Organized following modern MVVM patterns for robust, scalable, and maintainable code.
  • Centralized Dependencies: Manages project dependencies effectively using `libs.versions.toml`.
  • Optimized UX: Built for Android SDK 35 with **Material3 UI elements** and **animated transitions** for a smooth, intuitive user experience.