Rhea is simple programming language, created for example language interpreter.
Like the rest of my project names Rhea associated with Saturn - she is second largest moon of Saturn.
You can see the grammar of the language in detail here. Rhea has 4 syntax statements:
You can declare a function with the fn
keyword like rust:
fn name(arg1, arg2) = arg1 + arg2;
In rhea you are required to declare your variables before using. You can do it with let
keyword like rust or js:
let a = 2;
you can not initialize your variables, then they will be initialized to zero:
let a;
After the declaration you can assign another value to your variable:
a = 3;
You can call the function, for example you can call the built-in function print
:
print(2);
If your function takes more than one argument, arguments are separated by a comma:
fn mul(a, b) = a * b;
print(mul(2, 3));
Rhea has 4 operators: +
, -
, *
, /
.
All statements in Rhea must end with a semicolon.