Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/amirrezaask/loki
Loki, Simple experimental compiler that generates native binaries
https://github.com/amirrezaask/loki
Last synced: 4 days ago
JSON representation
Loki, Simple experimental compiler that generates native binaries
- Host: GitHub
- URL: https://github.com/amirrezaask/loki
- Owner: amirrezaask
- Created: 2022-04-25T18:53:07.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-07-30T02:52:57.000Z (3 months ago)
- Last Synced: 2024-08-02T17:39:37.911Z (3 months ago)
- Language: Rust
- Homepage:
- Size: 750 KB
- Stars: 51
- Watchers: 4
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Loki
Loki is an experimental programming language that I am building both to learn more about compilers and test ideas about language design.
## Disclaimer
Since I don't find rust to be a productive language anymore I am now trying to implement a similar langauge in GO which I will open source soon.## Installation
```bash
git clone https://github.com/amirrezaask/loki.git
cd loki
cargo install --path .
# if you have added cargo bins inside your path you can use loki command.
```## How It works
Loki compiler consists of multiple stages of compilation:
- Lexer: produce a stream of tokens for each input file.
- Parser: produces an IR structure for each file.
- Type checker and inference: type inference and checking of the IR happens here.
- Bytecode: lowering language features into simpler constructs happen here.
- Backend code generation: this will produce code that gets compiled or assembled using a third party toolchain.
* C: Done.## Todos
- Loki main should wrap user main function so we handle return int and stuff.
- Default values for structs
- Defer: *each function that have a defer usage, will have a label at the end (with a guard) so when user does return we first jump to defer run the instructions and then we come back and return.
- Unions
- Type table in output binary + access through #type() directive that will result in the type of the expression.
- Definitions of #load that will make exported symbols accessible from a namespace.
- LLVM
- If and while and for to not require parens in parser. ( Parser has ambiguity due to expr { means initialize , so we should change initialize syntax if we want this.)
- Generics