v0.2.62 - active development

flexible syntax,
strict about state

Rye is a very high-level, function-centric language with no keywords, strict state handling, and rich failure values - designed for predictable, composable programs and interactive use. Rye is a programming and interaction language. It is written in memory-safe Go and has first-class tasks for concurrent work.

no keywords code-as-data 41 datatypes strict state no null multiple DSLs table datatype console / REPL++ interaction language embeds in Go
rye
; all active words are just functions with arguments
probe ?print ; [Builtin(1): print value]
probe ?if ; [Builtin(2): if condition block]

blk: { print } .concat "Hello Rye"
if 2 > 1 blk ; Hello Rye

; expressions compose linearly
range 1 10
|filter { .math/is-prime }
|map fn { n } { 1 / n }
|sum |probe ; [Decimal: 1.176190]

; no null, rich failures, in-flow failure handling
person -> "user"
|fix { "Anonymous" } |print

; constant and immutable by default
name: "Tango" ; set-word - constant
age:: 42 ; mod-word - variable

; fully runtime homoiconic and explorable

A few ideas, taken seriously

Rye is shaped by a small number of principles rather than a large bag of features. These determine how the language behaves and why it feels different.

Flexibility

Everything is an expression

All constructs - control flow, assignment, I/O - return a value. Code composes linearly with the pipe, op and dot-words, reducing intermediate state and variable noise.

; assign and print inline apples: print 12 ; prints 12, assigns 12 ; compose without temporaries range 1 10 |filter { .math/is-prime } |map fn { n } { 1 / n } |sum
Consistency

Functions are all you need

Rye has no keywords and no special forms. if, loop, fn, try, return are all built-in functions, just like print - meaning you can inspect, replace, or build your own.

probe ?fn ; prints the builtin's docs ; your own control structure if-joe: fn { n code } { if n = "Joe" { do code } } if-joe "Joe" { print "Hey" }
Immutability

Constants by default

Words defined with : are constants and cannot be redefined. Mutation requires a mod-word ::, which is visually explicit and intentionally costly. Rare functions that mutate end with !

name: "Tango" name: "Cash" ; Error: can only set once name:: "Cash" ; Error: can't mod constant var 'month "January" ; Creates a variable month:: "February" ; Creates of modifies
var 'age 24 inc! 'age ; increments in place
Explicit failure

No Null - rich Failures

Functions return a value or a Failure. Failures carry a message, type, and status code. Unhandled failures escalate to errors, forcing resolution before they cause invisible bugs.

; missing key = Failure, not nil person -> "surname" |fix { "Doe" } |print ; prints Doe ; failures nest and carry context Read %user.txt |^check "Couldn't read user file"
Homoiconicity

Code is data

Rye code is made of Rye values. Blocks of code can be passed, stored, combined, and introspected - without a macro system or eval quirks.

thats-true: { capitalize "that's true" } do thats-true ; "That's true" ; combine blocks as data print-it: { print } ++ thats-true if 1 > 0 print-it ; prints That's true
Explicit modification

Strict scope isolation

You cannot modify variables in outer or nested scopes directly. Mutation across scopes requires explicit functions ending in !, making side effects visible and intentional.

var 'name "EU" country: context { change-name!: fn { n } { .change! 'name } } ; country/name:: "X" - doesn't exist country/change-name! "France" ; OK

What Rye looks like in practice

String manipulation
"Hello World" .replace "World" "Mars" |print ; Hello Mars
Sum of unique numbers in a string
"12 8 12 16 8 6" .load .unique .sum ; returns 42
Switch / pattern matching
switch 'cow { dog { "woof" } cow { "mooo" } cat { "meow" } } ; returns mooo
Filter a collection
{ "Anne" "Joan" "Adam" } |filter { .first = "A" } |for { .print }
Regexp extraction
regexp "([0-9][a-z])" |Submatch? "-7--x3--0k-r--" ; returns 0k
Primes - functional pipeline
range 1 10 |filter { .math/is-prime } |map fn { n } { 1 / n } |sum |probe ; [Decimal: 1.176190]
Read file - count lines, show tail
Read\lines %data.txt |with { .length? .print .tail 5 |print }
Load CSV, query average
Load\csv %ryebots.csv |where-equal 'level 7 |column? 'score |avg
Fetch page, save, extract links
Get https://ryelang.org |Write* %page.html |reader |Parse-html { <a> [ .Attr? 'href |print ] }
HTTP JSON fetch in a task
task: spawn does { Get https://httpbin.org/get |parse-json -> "headers" -> "User-Agent" |print } print "Loading ..." await task
Serve a static folder
http-server ":8082" |Handle "/" new-static-handler %public_html |Serve
Respond with current time
http-server ":8081" |Handle "/time" fn { w r } { .Write to-string now } |Serve
SMTP server - print on new mail
handler: fn { mail from to origin } { printv from "new mail from {}" } smtp-server ":25" |Serve ?handler "demo"
SQL query with dialect
rye .Args? .first :id Open sqlite://data.db |Query { select * from operator where id = ?id }
Validation dialect
dict { name: "anakin" } |validate { name: required calc { .capitalize } score: optional 0 integer } ; { name: "Anakin" score: 0 }
CLI dialect - flags, options, positionals
; argv simulated as a block args: { "--verbose" "-o" "out.txt" "in.txt" } spec: { program "mytool" -v|verbose flag -o|output string required input: string required } res: parse-args args spec print res."verbose" ; true print res."input" ; in.txt
CLI + validation - checked options
spec: { -p|port integer check { >= 1024 } "must be >= 1024" } parse-args { "--port" "80" } spec |fix { .format-parse-errors |print } ; Error: --port must be >= 1024
Math dialect (with operator precedence)
; Rye normally has no precedence ; math dialect adds it math/calc { 2 + 2 * ( 12 + ( 24 / 3 ) ) } ; returns 42
GUI with Fyne (Go binding)
fyne: import\go "fyne" widget: import\go "fyne/widget" lab: widget/label "Waiting ..." btn: widget/button "Click" does { lab .set-text "Done!" } app/new .window "Demo" |.set-content container/vbox [lab btn] |.show-and-run
A simple rule engine
rules: [ context { condition: { temp > 0 |and level < 70 } action: { print "OPEN" } } ] temp: 23 , level: 45 for rules { ::rule if do rule/condition rule/action }

Tasks add explicit completion and outcomes on top of goroutines and channels. The task API is currently experimental; use channels and mutexes to coordinate shared mutable data.

Start work, collect the result
task: spawn-with 21 fn { number } { sleep 1000 number * 2 } await task |printv "Result: {}" ; Result: 42
Start a batch, then collect in order
worker: fn { n } { n * 2 } await-all map { 10 20 30 } { .spawn-with ?worker } |display ; { 20 40 60 }
Scoped tasks join on exit
with-tasks { spawn does { spawn does { sleep 100 print "Grandchild finished" } } } print "All scoped tasks finished"
Channels and select still work
news: channel 0 producer: spawn-with news fn { out } { send out "BREAKING NEWS" } read news |print await producer

What do you get

Single Go binary

Rye compiles to a single binary. Go libraries integrate seamlessly - Rye can embed or extend any Go program as a scripting or config language.

Memory safe by default

Rye is implemented in Go, so programs inherit garbage collection and memory safety: no manual memory management, no dangling pointers, no pointer arithmetic or buffer overruns. Bad memory access is not part of the Rye programming model.

Task-based concurrency

spawn, spawn-with, await, await-all and with-tasks give concurrent work an explicit outcome. The task runtime owns completion, so there is no counter to increment too late or done call to forget. Currently experimental.

Interactive console

Syntax highlighting, history, tab completion, and environment exploration tools are built into the REPL. Designed for iterative development.

Multiple DSLs

Validation, CLI, Math, SQL, and HTML dialects are built-in. The same code-as-data foundation lets you build your own domain-specific languages.

Batteries included

HTTP servers, SMTP, SQL databases, tables, HTML/XML, Markdown and more ship in the main binary. Larger integrations are opt-in with build tags and Go extensions.

Download & install

Rye runs on Linux, macOS, and Windows. Also available for WASM (browser), Docker, Alpine, Android, and iOS.

Install via shell on Linux or macOS systems
curl -fsSL https://ryelang.org/install.sh | sh
Copied to clipboard
Platform x86 64-bit ARM 64-bit WASM
Linux v0.2.62 ↓ download ↓ download ↓ wasm
macOS v0.2.62 ↓ download ↓ download =/=
Windows v0.2.62 ↓ download / =/=
Homebrew
brew install ryelang
Arch Linux (AUR)
yay -S ryelang
Docker
docker pull ghcr.io/refaktor/rye:latest

Building from source is straightforward with Go. See the README on GitHub for instructions.