An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# sahl

![badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/ammarbinfaisal/2bc57fe31c6d742b25defe3549e78433/raw/tests.json)
![badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/ammarbinfaisal/2bc57fe31c6d742b25defe3549e78433/raw/aot.json)
![badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/ammarbinfaisal/2bc57fe31c6d742b25defe3549e78433/raw/go.json)

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.