An open API service indexing awesome lists of open source software.

https://github.com/paiml/ruchy

Ruchy, a systems-oriented scripting language that transpiles to Rust.
https://github.com/paiml/ruchy

data notebooks repl ruchy rust science scripting wasm

Last synced: 2 months ago
JSON representation

Ruchy, a systems-oriented scripting language that transpiles to Rust.

Awesome Lists containing this project

README

          


[![CI](https://github.com/paiml/ruchy/actions/workflows/ci.yml/badge.svg)](https://github.com/paiml/ruchy/actions/workflows/ci.yml)


ruchy

Ruchy


Modern Language for Data Science and Scientific Computing


License
Crates.io
[![Documentation](https://docs.rs/ruchy/badge.svg)](https://docs.rs/ruchy)
Tests

---

A modern, expressive programming language for data science and scientific computing, featuring a self-hosting compiler, comprehensive tooling, and enterprise-grade quality standards.

## Table of Contents

- [Installation](#installation)
- [Quick Start](#quick-start)
- [Features](#features)
- [Language Features](#language-features)
- [Core Commands](#core-commands)
- [Safety & Concurrency](#safety--concurrency)
- [WebAssembly](#webassembly)
- [MCP Server](#mcp-server)
- [Contributing](#contributing)
- [License](#license)

## Features

- **Self-Hosting Compiler**: Compiles Ruchy source to native binaries via Rust transpilation
- **Interactive REPL**: Full-featured read-eval-print loop for exploratory programming
- **Pattern Matching**: Algebraic data types with exhaustive match expressions
- **Labeled Loops**: Named loop control with break/continue to outer scopes
- **Async/Await**: First-class async support with tokio runtime
- **Thread Safety**: All globals are thread-safe by default via `LazyLock>`
- **WebAssembly**: Compile to WASM for browser and edge deployment
- **MCP Server**: Model Context Protocol integration for Claude
- **16,102 Tests**: Comprehensive test suite with zero clippy warnings

## Installation

```bash
cargo install ruchy
```

## Quick Start

```bash
# Start interactive REPL
ruchy

# Run a script
ruchy script.ruchy

# Evaluate expression
ruchy -e "println(1 + 2)"

# Compile to binary
ruchy compile script.ruchy -o myapp
```

## Language Features

```ruchy
// Variables and functions
let name = "Ruchy"
fun greet(who) {
println(f"Hello, {who}!")
}
greet(name)

// Pattern matching
let value = Some(42)
match value {
Some(x) => println(f"Got {x}"),
None => println("Nothing"),
}

// Labeled loops (v4.0)
'outer: for i in 0..10 {
for j in 0..10 {
if i * j > 50 {
break 'outer
}
}
}

// Collections
let numbers = [1, 2, 3, 4, 5]
let doubled = numbers.map(|x| x * 2)
println(f"Doubled: {doubled:?}")
```

## Core Commands

| Command | Description |
|---------|-------------|
| `ruchy` | Start interactive REPL |
| `ruchy ` | Run a Ruchy script |
| `ruchy -e ""` | Evaluate expression |
| `ruchy compile ` | Compile to binary |
| `ruchy transpile ` | Transpile to Rust |
| `ruchy check ` | Syntax check |
| `ruchy lint ` | Lint code |
| `ruchy fmt ` | Format code |
| `ruchy test ` | Run tests |

## Safety & Concurrency

Ruchy generates **100% safe Rust code** with full concurrency support:

- Thread-safe globals via `LazyLock>`
- Full async/await support (tokio runtime)
- Channels, atomics, and all Rust concurrency primitives
- Zero unsafe code in generated output

```ruchy
// Thread-safe by default
let mut counter = 0

fun increment() {
counter = counter + 1 // Thread-safe
}

// Async functions
async fun fetch(url: String) -> String {
let response = http::get(url).await?
response.text().await
}
```

## WebAssembly

```bash
# Compile to WASM
ruchy wasm compile script.ruchy -o output.wasm

# Run WASM module
ruchy wasm run output.wasm
```

## MCP Server

Ruchy provides a Model Context Protocol server for Claude integration:

```bash
cargo install ruchy --features mcp
```

Add to Claude Desktop config:
```json
{
"mcpServers": {
"ruchy": {
"command": "ruchy",
"args": ["mcp"]
}
}
}
```

## Quality Standards

- **16,102 tests** passing
- **Zero clippy warnings**
- **200-point falsification** validation framework
- **Toyota Way** quality principles
- **PMAT A+** code standards

## Documentation

- [Language Specification](docs/SPECIFICATION.md)
- [Development Roadmap](docs/execution/roadmap.yaml)
- [Ruchy Book](https://github.com/paiml/ruchy-book) - Comprehensive guide
- 🤖 [Coursera Hugging Face AI Development Specialization](https://www.coursera.org/specializations/hugging-face-ai-development) - Build Production AI systems with Hugging Face in Pure Rust

## Contributing

Contributions are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) guide for details.

## MSRV

Minimum Supported Rust Version: **1.75**

## See Also

- [Cookbook](https://github.com/paiml/ruchy-cookbook)

## License

MIT License - see [LICENSE](LICENSE) for details.

## Author

Noah Gift - [github.com/paiml/ruchy](https://github.com/paiml/ruchy)