Skip to content
paimlPublic

About

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

Topics

Resources

Contributing

Security policy

Stars

62 stars

Watchers

2 watching

Forks

Latest commit

 

History

3,931 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ruchy

Ruchy

CI Crates.io Documentation License: MIT

Ruchy is a programming language with Python-like syntax. A program runs in the built-in interpreter, or is transpiled to Rust and compiled to a native binary.

This README is checked by contracts/ruchy-readme-v1.yaml: every example below is a file under examples/readme/ that CI runs against the ruchy binary built from the same commit.

Install

The current version is a pre-release, so name it explicitly:

cargo install ruchy --version 5.0.0-beta.2

Plain cargo install ruchy installs the latest stable release instead.

Quick start

ruchy examples/readme/hello.ruchy
ruchy -e "println(1 + 2)"
ruchy check examples/readme/match.ruchy
ruchy transpile examples/readme/collections.ruchy
ruchy compile examples/readme/collections.ruchy -o collections

Running ruchy with no arguments starts the REPL.

Examples

Functions and f-strings (examples/readme/hello.ruchy):

let name = "Ruchy"
fun greet(who) {
    println(f"Hello, {who}!")
}
greet(name)

Pattern matching (examples/readme/match.ruchy):

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

Labeled loops (examples/readme/loops.ruchy):

let mut found = 0
'outer: for i in 1..10 {
    for j in 1..10 {
        if i * j > 50 {
            found = i * j
            break 'outer
        }
    }
}
println(f"First product over 50: {found}")

Collections (examples/readme/collections.ruchy):

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

Commands

ruchy --help lists every subcommand. The ones used most:

Command Description
ruchy run Run a script (also ruchy <file>)
ruchy repl Start the interactive REPL
ruchy check Check syntax
ruchy transpile Transpile to Rust
ruchy compile Compile to a native binary
ruchy lint Lint a file
ruchy test Run @test functions
ruchy wasm Compile to a WebAssembly module

Documentation

MSRV

Minimum supported Rust version: 1.91.

License

MIT. See LICENSE.

About

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

Topics

Resources

Contributing

Security policy

Stars

62 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages