DEV Community

ta
ta

Posted on

New scripting language

I'm currently working on a scripting language that aims to "make developers' lives a little sweeter". It's called Amai, it runs on a bytecode VM and is statically typed. Right now, I'm working on it solo. The current version (as of publishing this blog) has variables, if-else statements, basic expressions, and while loops. There's no documentation right now but the average Amai code looks like:

let x = 10; // immutable
var y = 10; // mutable

x += 1; // will error
y += 2; // OK

while y > 0 do y -= 1; // while
// you can also do blocks
while y < 10 do {
    y += 1;
}

// everything is an expression, even blocks
// though if you want to make multi-statement bodies, you'll have to use blocks
let z = if x == 10 then 1 else 2; // if-else
let w = if x == 10 then {
    let r = 10;
    r + 2
} else {
    let e = 12;
    e + x
};

// note: semicolons are just a separator, it can be optional
// but is recommended to disambiguate when parsing
let x = 10
let y = 2 // OK. parsing won't mess up (at least in this version of Amai)

let u = (); // unit
Enter fullscreen mode Exit fullscreen mode

Here's the GitHub repo

Top comments (0)