-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to use the last part of the project glados at epitech
- Loading branch information
1 parent
8ff83b3
commit e72a96b
Showing
45 changed files
with
673 additions
and
1,476 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; | ||
``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.