New scripting language
Source: Dev.to
Overview
I’m currently working on a scripting language that aims to “make developers’ lives a little sweeter”. It’s called Amai, runs on a bytecode VM, and is statically typed. The current version (as of publishing this blog) includes variables, if‑else statements, basic expressions, and while loops. Development is currently solo.
Language Features
- Immutable and mutable variables (
letvsvar) - Expressions everywhere, including blocks
- Optional semicolons (recommended for disambiguation)
- Unit type
()
Example Code
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