Ruchy
A systems-oriented scripting language that transpiles to zero-cost Rust, combining Python's ergonomics with Rust's performance guarantees.
// Ruchy: Write like Python, run like Rust
fun analyze
Why Ruchy?
The Problem: Python's ease-of-use comes at a 50-100x performance cost. Rust's performance requires managing lifetimes, traits, and complex syntax.
The Solution: Ruchy provides Python-like syntax that mechanically transforms to idiomatic Rust, achieving:
- <10ms REPL startup for interactive development
- Zero runtime overhead - compiles to native Rust
- Direct Cargo integration - use any Rust crate unchanged
- Native DataFrame operations via Polars
Key Features
🚀 Multiple Execution Modes
# Interactive REPL with JIT compilation
|> filter() |)
# Script execution
# AOT compilation to native binary
📊 DataFrame-First Design
// DataFrames as primary collection type
let df = df!
let top_performers = df
|> filter
|> sort
🎯 Zero-Cost Abstractions
// Ruchy source
fun process
// Generated Rust (identical performance)
🔍 Gradual Verification
// Start dynamic
fun quick_prototype = process
// Add types when ready
fun production
// Add proofs when critical
fun critical_sort
Installation
Via Cargo (Recommended)
Pre-built Binaries
Download the latest release for your platform from GitHub Releases:
Linux/macOS:
# Download the binary (replace URL with your platform)
Windows:
Download ruchy-windows-amd64.exe from the releases page.
From Source
Quick Start
1. Create a Ruchy Script
// hello.ruchy
fun greet = println
fun main
2. Run It
3. Compile to Native
Language Tour
Pattern Matching
match value
Actor Concurrency
actor Counter
let counter = spawn Counter
counter ! Increment
let count = counter ? Get // Synchronous ask
Pipeline Operators
data
|> validate
|> transform
|> aggregate
|> visualize
Property Testing
fun prop_sort_idempotent
Performance
Benchmarks on AMD Ryzen 9 5900X, 32GB RAM:
| Operation | Python 3.11 | Ruchy | Rust (baseline) |
|---|---|---|---|
| DataFrame (10M rows) | 1,240ms | 89ms | 87ms |
| Fibonacci(40) | 34,000ms | 420ms | 415ms |
| JSON parsing (100MB) | 890ms | 62ms | 59ms |
| HTTP server (req/sec) | 8,500 | 185,000 | 192,000 |
Binary size: 1.8MB (including minimal runtime)
Compilation: 10k LOC in ~2s (incremental: ~200ms)
Architecture
Source (.ruchy) → Parser → Type Inference → Rust AST → rustc → Native Binary
↓ ↓ ↓
REPL Type Errors Optimization
Type System
- Bidirectional type checking with Hindley-Milner inference
- Row polymorphism for extensible records
- Refinement types with SMT verification
- Gradual typing with runtime boundary checks
Memory Model
- Affine types with escape analysis
- Automatic
Rc/Arcinsertion where needed - Zero allocations for stack-bound values
- Copy-on-write for value semantics
Ecosystem Integration
Using Rust Crates
// Any Rust crate works directly
import sleep
import get
import *
async fun fetch_and_analyze
In Cargo Projects
# Cargo.toml
[]
= "1.0"
[]
= "1.0"
// build.rs
MCP (Model Context Protocol) Support
Native integration for AI/LLM tools:
actor Analyzer
Quality Enforcement
Integrated PMAT quality gates ensure Toyota Way standards:
)
)
)
Documentation
- Language Guide - Complete language reference
- Standard Library - Built-in functions and types
- Cargo Integration - Using Ruchy in Rust projects
- Actor Model - Concurrency and message passing
- Performance Tuning - Optimization strategies
Contributing
We welcome contributions! See CONTRIBUTING.md for:
- Development setup
- Architecture overview
- Testing requirements
- Code style guide
Roadmap
v0.5 (Current)
- Core parser and type inference
- Basic Rust transpilation
- REPL with incremental compilation
- DataFrame operations
v1.0 (Q2 2025)
- Full actor system
- Property testing integration
- LSP implementation
- Stabilized syntax
v2.0 (Q4 2025)
- WASM target
- GPU compute kernels
- Distributed actors
- Formal verification
License
MIT - See LICENSE for details.
Acknowledgments
Ruchy synthesizes ideas from:
- Rust - Ownership, zero-cost abstractions
- Python - Simplicity, readability
- Elixir - Actor model, fault tolerance
- Swift - Progressive disclosure, value semantics
- Kotlin - Null safety, smart casts
- F# - Type providers, computation expressions
Built with obsessive attention to performance and correctness.