https://github.com/ammarbinfaisal/sahl
a programming language with channels and coroutines/threads
https://github.com/ammarbinfaisal/sahl
bytecode compiler language vm
Last synced: 5 months ago
JSON representation
a programming language with channels and coroutines/threads
- Host: GitHub
- URL: https://github.com/ammarbinfaisal/sahl
- Owner: ammarbinfaisal
- License: mit
- Created: 2022-07-24T04:09:00.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-06-22T04:13:15.000Z (almost 2 years ago)
- Last Synced: 2024-06-22T16:14:44.123Z (almost 2 years ago)
- Topics: bytecode, compiler, language, vm
- Language: C
- Homepage:
- Size: 4.71 MB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 30
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# sahl



a programming language with channels and coroutines
## meaning
sahl means easy. This is the easiest statically typed language I could come up with. It could be called easy before but it has become bloated now as I am adding or planning to add all sort of stuff.
## usage
- install rust, llvm, clang
- `make` to compile the compiler and the virtual machine
- then use **./sahlc -o exe code.sahl** to compile a sahl file to native code
- or use **./run_byte.sh code.sahl** to run a sahl file on the virtual machine
## features
- c interop
- type inference
- garbage collected
- haskellesque type constructors
- green threads (only in vm)
- channels
## docs
[DOCS.md](DOCS.md)
## vscode extension
### install
```bash
cp -r ext ~/.vscode/extensions/sahl
```
**only supports syntax highlighting for now**
## history
Initially I made the virtual machine in rust. It was slow so I rewrote the codegen in rust to emit bytes instead of rust enums/structs and then run the bytecode on a virtual machine I wrote in c. Since, the language is statically typed I thought compiling it to native code would be a nice idea so I started writing that using llvm but paused. I also wrote [`sahl_aot.go`](https://github.com/ammarbinfaisal/sahl/blob/828d8bef82ec3a40083cd938c6ec40deef4355f7/sahl_aot.go) to convert the bytecode to assembly but stopped. I wrote [x86 codegen](https://github.com/ammarbinfaisal/sahl/blob/e9b49e7f2993197614458ea86f697bda1f120d47/frontend/src/asm.rs) which operated on the ast. Abandoned that soon after. Then reorganized the source to use [three-addr-code](https://github.com/ammarbinfaisal/sahl/pull/40) and a register based vm. After that picked up native codegen using llvm from the three-addr-code.
Right now there is a virtual machine, native code generation with llvm and transpilation to go.