Skip to content

Commit

Permalink
Update to use the last part of the project glados at epitech
Browse files Browse the repository at this point in the history
  • Loading branch information
Saverio976 committed Dec 19, 2023
1 parent 8ff83b3 commit e72a96b
Show file tree
Hide file tree
Showing 45 changed files with 673 additions and 1,476 deletions.
261 changes: 193 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,194 @@
# koaky

A Blazzing Light Lisp Interpreter

## Features

- Condition
- [x] `if`
- [x] `eq?`
- [x] `diff?`
- [x] `<`
- [x] `>`
- [x] `>=`
- [x] `<=`
- Operator
- [x] `+`
- [x] `-`
- [x] `*`
- [x] `div`
- [x] `mod`
- Type
- [x] `Integer`
- [x] `Boolean`
- [x] `Symbol`
- Function
- [x] `lambda`
- [x] `define`
- Error Handling
- [x] Error handling at execution time
- [x] Nice error message at execution time
- [x] Error handling at parsing time
- [ ] Nice error message at parsing time

## Install

2 methods to use this interpreter:
- from available binary
- build from source

### From Available Binary

- Download the binary for your platform in the latest release.

### Build From Source

- Clone this repository: <https://github.com/X-R-G-B/koaky.git>
- Install stack: <https://docs.haskellstack.org/en/stable/>
- `cd`'d in the repository you just cloned
- Run: `stack build --copy-bins --local-bin-path .`
- The binary will be available with the name `koaky-exe.exe`:windows `koaky-exe`:linux `koaky-exe`:macos

## Usage

```
Usage: koaky-exe [OPTION]
Interpret Lisp
With no options, koaky reads from standard input.
Options:
-h, --help
Display this help and exit
-v, --version
Output version information and exit
-f FILE, --file FILE
Read FILE and Interpret it
-
Read from standard input and Interpret it
# Leviator

The opinionated programing language

## Documentation

-- **Comentary**

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

-- **Variables Declaration**

```python
@Int a = 1;
@String b = "hello";
```

-- **Variables Assignment**

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

- **Built-in Types**

```
@Bool a = True;
@Bool b = False;
@Int c = 1;
@List[Int] d = [1, 2, 3];
@Char e = 'a';
@String f = "hello";
@List[Char] g = ['a', 'b', 'c'];
```

- **Built-in Global Variables**

```c
@List[String] ARGS = ["programfilepath", "arg1", "arg2"];
```

- **Function Declaration**

```rust
fn add(a: Int, b: Int) -> Int
{
// the next line is the `return`
<- 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;
};
```

- **Built-in Functions**

```c
// print to stdout
print("hello");
// print to stderr
printErr("hello");
// get a line from stdin
getLine();
// transform a type to a string
str(1);
// get the type of a value in string format
type(a);
// call a function with string
call("add", [1, 2]);
```
- **Generic Functions**
```rust
fn add[A](a: A, b: A) -> A
{
<- a + b;
};
```

- **Generic Functions Call**

```rust
add[Int](1, 2);
```

- **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;
};
```

```c
@List[Int] lst = [1, 2, 3];
foreach (a in lst)
{
if (a == 2)
{
break;
}
};
```
- **Imports**
```c
// Circular imports are not allowed
#"path/to/file.lvt"
```

- **Entrypoint**

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

- **Operators**

```
a + b
a - b
a * b
a / b
```

- **Structs**

```c
struct Point
{
a: Int,
};
```

- **Generic Structs**

```c
struct Rect[A]
{
a: A,
};
```
61 changes: 0 additions & 61 deletions app/Args.hs

This file was deleted.

21 changes: 0 additions & 21 deletions app/Main.hs

This file was deleted.

Loading

0 comments on commit e72a96b

Please sign in to comment.