Rye Language

Dynamic high level programming language with a few odd ideas. Still in development.

Focused on interactive use, Linux command line, backend and information (pre)processing.

Rye snippets

Change Hello World to Hello Mars and print it.
"Hello World" .replace "World" "Mars" |print
; prints "Hello Mars"
Find the Sum of unique numbers in a string.
"12 8 12 16 8 6" .load .unique .sum
; returns 42
If the given string is Jim, print Hello Jim.
"Jim" .when { = "Jim" } { .printv "Hi {}" }
; returns Hi Jim
Extract combination of one number and one letter from string.
regexp "([0-9][a-z])" |submatch? "-7--x3--0k-r--"
; returns 0k
Print out names starting with A.
{ "Anne" "Joan" "Adam" } |filter { .first = "A" }
|for { .print } 

IO, Spreadsheet, HTTP client

Read a file, print the number of lines and the last 5 lines.
read\lines %data.txt |with
{ .length? .print , .tail 5 |print }
Load a CSV, get average score of all players of level 7.
load\csv %ryebots.csv |where-equal 'level 7
|column? 'score |avg
Load a webpage, save it to a file, print out all the links.
get https://ryelang.org |write* %page.html
|reader |parse-html { <a> [ .attr? 'href |print ] }

HTTP, SMTP server

Serve folder over HTTP
new-server ":8082"
|handle "/" new-static-handler %public_html
|serve
Web server that responds with current time.
new-server ":8081"
|handle "/time" fn { w r } { .write to-string now }
|serve
Start smtp server and print notification on new email.
handler: fn { mail from to origin } {
printv from "new mail from {}" }
new-smtpd ":25" |serve ?handler "demo"
      

Dialects

Validation dialect
dict { name: "anakin" } |validate { 
   name: required calc { .capitalize } 
   score: optional 0 integer }
; returns { name: "Anakin" score: 0 }	  
Math dialect.
; Rye like Rebol or Lisp has no operator precedence.
; But it has Math dialect which has it and more.
math { 2 + 2 * ( 12 + ( 24 / 3 ) ) }
; returns 42
SQL dialect.
rye .args .first :id
open sqlite://data.db
|query { select * from operator where id = ?id }

So what is Rye

Rye is a high level, homoiconic dynamic programming language based on ideas from Rebol, flavored by Factor, Linux shell and Golang. It's still an experiment in language design, but it should slowly become more and more useful in real world.

It features a Golang based interpreter and shell and could also be seen as (modest) Go's scripting companion as Go's libraries are easy to integrate, and Rye can be embedded into Go programs as a scripting or config language.

I believe that as a language becomes higher level it starts touching the user interface boundary, Rye has great emphasis on interactive use (Rye shell) where we will explore that.

Docs

To learn how Rye really works and can be used check (work in progress) Meet Rye. Out of unit tests we also generate a function reference with examples.

Where

Rye can currently run on your Linux or Mac OS desktop. Rye also runs in your web-browser (Wasm) and Docker. Rye could be compiled for mobile (Android and OSx) and Windows.

Focus is on command-line / backend use, but we are experimenting with a multiplatform GUI Fyne in Rye-front project.

You can try a (work in progress) Rye shell right now by clicking a button on top-right of this page.

Downloads

x86 64arm 64arm v6
Linuxv0.0.15 v0.0.15 v0.0.15
Mac OSv0.0.15 v0.0.15

Wasm: v0.0.15

Docker: docker pull ghcr.io/refaktor/rye:latest

Development

Rye's Github repository is where everything happens. Please visit it, read it, star it, post issues, contribute ...

Since Rye uses Go, building it from source is very simple. Instructions are on the README.

Rye integration with frontent (GUI) toolkit Fyne happens in Rye-front repository.

Community

Reddit page · Old blog · New blog · Github

Thank you

Thank you for visiting us and reading to the end. If you see any potential here, don't be a stranger, join us on reddit or github!