CreatorSiSo/rym
Personal programming language project
⚠️ This is just a hobby project. It is very far from being production ready! ⚠️
Rym is a statically typed programming language inspired by Rust, Swift, Python and others.
It focuses on ease of use and should just work™.
Big thanks to Robert Nystrom and his book crafting interpreters which inspired me to start and continue working on this language.
fn main() ~Io {
for i in 0..=100:
println(game(i));
}
fn game(x: Uint) String => {
const rule = fn(acc, num, word) =>
if (x mod num) == 0 then acc ++ word else acc;
const default_rule = fn(acc) =>
if acc == "" then acc else x.to_string();
"".rule(3, "Fizz")
.rule(5, "Buzz")
.rule(7, "Splash")
.default_rule()
}
fn main() ~Io, Result[(), Error] {
let msg = "Hello World";
println(msg);
let mut num = 2/4 * (10 - 1);
println("Number:", num);
const msg = msg + "!";
println("Combined:", msg, num);
}
Early returns when unwrapping Tryables
fn main() Result[String, SpecificError] {
let chained = maybe_error().try;
// Same as:
let expanded = match maybe_error():
| Ok(val) => Ok(val.to_string()),
\ err => return err;
// ...
Ok(chained)
}
The language should be as powerful as possible while only providing a small set of consistent features. (Kind of like Go)
Apart from that Rym just gets used to try out a bunch of my ideas... I am trying my best to combine all of them in a meaningful manner =)
TODO
The project is split into many crates that are part of one Cargo workspace:
crates/rymx ⇒ command line tool for executing .rym files and to run the repl
For now just cargo test, there is no special setup.