logo

🐲 Leviator

The opinionated programing language



Leviator is compiled to wasm binary format.

[!NOTE]
This is a student project (EPITECH school). It is not intended to continue this project.

Language Syntax

[!IMPORTANT]
StringView are not supported.

[!IMPORTANT]
There is no list/array in this language.

  • Comentary
// This is a comment
  • Alias
alias A = Int;
  • Variables Declaration
@Int a = 1;
@StringView b = "hello";
  • Variables Assignment
a = 1;
b = "hello";
  • Built-in Types
@Bool a = True;
@Bool b = False;
@Int c = 1;
@Char e = 'a';
@StringView f = "hello";

There is a Void type that can be used to return nothing.

  • Function Declaration
#![allow(unused)]
fn main() {
fn add(a: Int, b: Int) -> Int
{
    // the next line is the `return`
    <- a + b;
};

export fn sub(a: Int, b: Int) -> Int
{
    <- a - b;
};
}
  • Function Call
#![allow(unused)]
fn main() {
add(1, 2);
}
  • Function Polymorphism
#![allow(unused)]
fn main() {
fn add(a: Int, b: Int) -> Int
{
    <- a + b;
};

fn add(a: Float, b: Float) -> Float
{
    <- a + b;
};

fn add(a: Int, b: Int, c: Int) -> Int
{
    <- a + b + c;
};
}
  • Conditions
if (a == 1)
{
    // do something
};

if (a == 1)
{
    // do something
}
else
{
    // do something else
};
  • Loops
@Int i = 0;
while (i < 10)
{
    // do something
    i = i + 1;
};
  • Entrypoint
#![allow(unused)]
fn main() {
// If you don't have this function, the program will not be run
export fn start() -> Int
{
    <- 0;
};
}
  • Operators
a + b
a - b
a * b
a / b
a == b
a != b
a < b
a <= b
a > b
a >= b
  • Priority of Operators
// realy peticuliar buut we use { for ( and } for )
{a + B} * c