/Rat

Primary LanguageANTLRMIT LicenseMIT

Rat

Rat is a high-level functional programming language with compilation to Microsoft Intermediate Language (MSIL).

Main fature is chaining methods with | and & operatiors. For example:

let div a, b = if b != 0 a / b else Err

print (toString & (div | 0) (...))

Same rust example code:

fn div(a: f32, b: f32) -> Result<f32> {
    match b {
        0 => Err(),
        _ => a / b
    }
fn main() {
    println!("{}", div(...).or_else(0));
    }
}

Rat 0.1 features

Features are needed to bootstrapping.

Fucntion

let foo a, b = a + b

Operations

To numerical types:

  • binary: +, *, /, %
  • unary: -
  • ternary: if condition then_branch else else_branch

To functuins:

  • | - TODO description
  • & - TODO description

Extern block:

Extern DotnetMath:
    Math.Cos
    Console.Abs

Extern DotnetMath:
    Console.Writeline
    Console.Readley