Skip to content

Commit

Permalink
Merge pull request #24 from X-R-G-B/main
Browse files Browse the repository at this point in the history
Main
  • Loading branch information
Saverio976 authored Jan 26, 2024
2 parents 162bb55 + 833c711 commit 912d1f5
Showing 1 changed file with 157 additions and 3 deletions.
160 changes: 157 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,158 @@
# Koaky
<div>
<img src="https://github.com/X-R-G-B/Leviator/assets/87119012/acc77ef3-b39f-4c40-b882-d7e0b0fdefb6" alt="logo" width="150" align="left">
<h1>🐲 Leviator</h1>
<p>The opinionated programing language</p>
<br><br>
<p><i>Leviator is compiled to wasm binary format.</i></p>
</div>

This is a new amazing programming language
made in Haskell.
> [!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**

```c
// This is a comment
```

- **Alias**

```
alias A = Int;
```

- **Variables Declaration**

```hs
@Int a = 1;
@StringView b = "hello";
```

- **Variables Assignment**

```hs
a = 1;
b = "hello";
```

- **Built-in Types**

```hs
@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**

```rust
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**

```rust
add(1, 2);
```

- **Function Polymorphism**

```rust
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**

```c
if (a == 1)
{
// do something
};

if (a == 1)
{
// do something
}
else
{
// do something else
};
```

- **Loops**

```c
@Int i = 0;
while (i < 10)
{
// do something
i = i + 1;
};
```

- **Entrypoint**

```rust
// If you don't have this function, the program will not be run
export fn start() -> Int
{
<- 0;
};
```

- **Operators**

```python
a + b
a - b
a * b
a / b
a == b
a != b
a < b
a <= b
a > b
a >= b
```

- **Priority of Operators**

```c
// realy peticuliar buut we use { for ( and } for )
{a + B} * c
```

0 comments on commit 912d1f5

Please sign in to comment.