Skip to content

CreatorSiSo/rym

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rym

Disclaimer

⚠️ This is just a hobby project. It is very far from being production ready! ⚠️

Intro

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.

Examples

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)
}

About

Name

  • Rusty ⇒ Heavily borrows 🙃 from Rust
  • Multi-paradigm ⇒ Mix of object oriented, procedural and functional programming
  • Programming Language ⇒ because thats what it is

Goals

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 =)

  • Features
    • Static (but inferred) type system
    • Data types
      • struct
      • enum (tagged union)
      • union (set of types)
    • Traits? Interfaces?
    • Iterators
    • Zig like comptime
  • Nice developer experience
    • Informative errors and warnings
    • Tools
      • Compiler
      • First party REPL
      • Package manager

Installation

TODO

Project Structure

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

Tests

For now just cargo test, there is no special setup.

Todos

  • add benchmarking capabilities

Inspired by

  • Rust: Empowering everyone to build reliable and efficient software.
  • OCaml: TODO
  • F#: TODO
  • Swift: A Swift is a high-performance system programming language.
  • HVM: A massively parallel, optimal functional runtime in Rust
  • Unison: A friendly programming language from the future (statically-typed, functional)
  • Fused Effects: A fast, flexible, fused effect system for Haskell

Other languages written in Rust

  • Boson: Hybrid programming language written in Rust.
  • Mun: Programming language empowering creation through iteration.
  • Tao: Statically-typed functional language with polymorphism, typeclasses, algebraic effects, sum types, pattern-matching, first-class functions, currying, good diagnostics, and much more!
  • Rhai: Embedded scripting language for Rust.
  • Rune: Embeddable dynamic programming language for Rust.