X-R-G-B / Leviator

Make our own language

Home Page:https://x-r-g-b.github.io/Leviator/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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
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

About

Make our own language

https://x-r-g-b.github.io/Leviator/

License:Other


Languages

Language:Haskell 94.9%Language:Shell 1.7%Language:PowerShell 1.6%Language:Makefile 1.2%Language:HTML 0.5%Language:C++ 0.1%