What’s Rye? Dynamic programming language focused on fluid expressions, still in development.
What’s it for? It was made for backend/server-side/CLI jobs, but also got GUI frameworks recently.
Rye console demos:
Spreadsheets •
Exploring JSON •
HN / Somafm in console •
Testing vectors •
TODO in a REPL •
Per projectPer builds •
Eyr dialect (bold are new)
Rye is a high level, homoiconic dynamic programming language based on ideas from Rebol, flavored by Factor, Linux shell and Go. It's still in development, but we are focused on making it useful as soon as possible.
It's written in Go and could also be seen as Go's scripting companion as Go's libraries are very easy to integrate, and Rye can be embedded into Go programs as a scripting or a config language.
I believe that as a language becomes higher level it starts bridging the gap towards user interfaces. Rye has great emphasis on interactive use where we intend to also explore that.
Rye console (REPL) features many interesting syntax highlighting, history, tab completition and many console specific functions that help you navigate and introspect the language and environment you are shaping
Short Rye examples
"Hello World" .replace "World" "Mars" |print
; prints "Hello Mars"
"12 8 12 16 8 6" .load .unique .sum
; returns 42
switch 'cow { dog { "woof" } cow { "mooo" } cat { "meow" } }
; returns mooo
regexp "([0-9][a-z])" |submatch? "-7--x3--0k-r--"
; returns 0k
{ "Anne" "Joan" "Adam" } |filter { .first = "A" }
|for { .print }
IO, Spreadsheet, HTTP client
read\lines %data.txt |with
{ .length? .print , .tail 5 |print }
load\csv %ryebots.csv |where-equal 'level 7
|column? 'score |avg
get https://ryelang.org |write* %page.html
|reader |parse-html { <a> [ .attr? 'href |print ] }
HTTP, SMTP server
http-server ":8082"
|handle "/" new-static-handler %public_html
|serve
http-server ":8081"
|handle "/time" fn { w r } { .write to-string now }
|serve
handler: fn { mail from to origin } {
printv from "new mail from {}" }
smtp-server ":25" |serve ?handler "demo"
Dialects
dict { name: "anakin" } |validate {
name: required calc { .capitalize }
score: optional 0 integer }
; returns { name: "Anakin" score: 0 }
; Rye like Rebol or Lisp has no operator precedence.
; But it has Math dialect which has it and more.
math { 2 + 2 * sqrt ( 12 + ( 24 / 3 ) ) }
; returns 42
rye .args .first :id
open sqlite://data.db
|query { select * from operator where id = ?id }
GUI
do\in fyne {
lab: label "I'm Waiting ..."
btn: button "Click here" does { lab .set-text "Finally ..." }
box: v-box [ lab layout-spacer btn ]
with app .window "Button" {
.resize size 200.0 100.0 ,
.set-content box ,
.show-and-run
}
}
do\in fyne {
app .window "Percentage Clock" :win
cont: v-box [
label "This Year [days]" :ly
progress-bar :py
label "This month [days]"
progress-bar :pM
label "Today [hours]"
progress-bar :ph
label "This hour [minutes]"
progress-bar :pm
label "This minute [seconds]"
progress-bar :ps
]
m-of: ?multiple-of
is-leap-year: fn { y } { all { y .m-of 4 not y .m-of 100 not y .m-of 400 } }
days-in: fn { y } { .is-leap-year .either { 366 } { 365 } }
go fn\par { } current {
forever {
with n:: now {
.year? ::y |concat* "Year " |set-text* ly ,
.year-day? / days-in y |set-value* py ,
.day? / days-in-month? n |set-value* pM ,
.hour? / 24 |set-value* ph ,
.minute? / 60 |set-value* pm ,
.second? / 60 |set-value* ps
sleep 500
}
}
}
win |resize size 300.0 200.0 |set-content cont |show-and-run
}
If examples above made you interested, you can delve deeper into the Rye language and Rye runtime. You have two sources for that, both are still work-in-progress, so check back later for more and better content:
Meet Rye | Focuses on Rye language, it's basics, concepts and components |
Rye Cookbook | Focuses on practical uses and specific technologies |
Function reference | Basic documentation and simple examples for many core functions |
Rye can run on Linux, Mac OS or Windows. Rye also runs in a web-browser (Wasm) and Docker. Rye could be compiled for mobile (Android and OSx).
You can try a (work in progress) browser-based Rye console right now by clicking a button on top-right of this page.
x86 64 | arm 64 | arm v6 | wasm | |
---|---|---|---|---|
Linux | v0.0.26 | v0.0.26 | v0.0.26 | |
Mac OS | v0.0.26 | v0.0.26 | - | |
Windows | v0.0.26 | v0.0.26 | - | |
/ | v0.0.26 |
Homebrew | brew install ryelang |
Docker | docker pull ghcr.io/refaktor/rye:latest |
Rye's Github repository is where everything happens. You are welcome to visit it, read it, star it, post issues, contribute ...
Since Rye uses Go, building it from source is very simple. Follow instructions in the README.
Rye's main binary comes with core language functions and also a lot of bindings and technologies already included. At least in a very basic level. Below are some examples of already included technologies:
AWS Bcrypt BSON Crypto FT search Goroutines HTML parser HTTP servers JSON MySQL Psql Postmark Regexp SMTP server SXML SQLite
Rye can be extended internally or externally. Two bigger external extension are developed in their own repositories:
Fyne GUI framework | Rye-fyne repository | Download: Linux MacOS Windows |
Gio UI framework | Rye-gio repository | |
Ebitengine game engine | Rye-ebitengine repository | |
Ryegen | Ryegen repository |
Github Blog Reddit Old blog Asciinema Youtube
Rye tries to explore some maybe absurd dualities:
• Information about testing was added to Cookbook: Improving Rye : One source of truth [2024-11-19]
• New sections were added to the Cookbook: Deployment and Improving Rye [2024-10-27]
• First version of Rye-Gio posted on Github Gioui is a Golang immediate mode UI library [2024-10-07]
• Added Cookbook > Rye binary showing commands and flags that make Rye binary much more versatile [2024-10-03]
• Binaries for GUI library Rye-Fyne available on Releases page [2024-10-01]
Thank you for visiting this site and reading to the end. If you see any potential here, don't be a stranger, join, star or subscribe us on github, reddit, youtube, ... or just send me an email!
Especially github is usually updated every few days! If you want to contribute in any way, even better, there are always open tasks to complete, from docs, tests, examples, to Go coding.