/Leviator

Make our own language

Primary LanguageHaskellOtherNOASSERTION

logo

🐲 Leviator

The opinionated programing language



Documentation

  • 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
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
add(1, 2);
  • Function Polymorphism
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
// 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