Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/doctorn/micro-mitten
You might not need your garbage collector
https://github.com/doctorn/micro-mitten
compile-time-garbage-collection compilers data-flow-analysis memory-management
Last synced: 21 days ago
JSON representation
You might not need your garbage collector
- Host: GitHub
- URL: https://github.com/doctorn/micro-mitten
- Owner: doctorn
- License: gpl-2.0
- Created: 2020-05-07T22:05:31.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-05-15T17:48:31.000Z (over 4 years ago)
- Last Synced: 2024-08-05T16:17:16.061Z (4 months ago)
- Topics: compile-time-garbage-collection, compilers, data-flow-analysis, memory-management
- Language: Rust
- Homepage: https://mitten-lang.org/
- Size: 90.8 KB
- Stars: 532
- Watchers: 18
- Forks: 12
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-hacking-lists - doctorn/micro-mitten - You might not need your garbage collector (Rust)
README
# `micro-mitten`
metal's too hot? wear a mitten!
[![Build Status](https://travis-ci.com/doctorn/micro-mitten.svg?token=KhJmSEzcFG1aixcpAAvB&branch=master)](https://travis-ci.com/doctorn/micro-mitten)
## `micro-mitten`??
`micro-mitten` is a bare-bones Rust-like programming language, stripped down to simplify control-flow structures and the type system.
Like Rust, `micro-mitten` offers a static approach to memory management; however, `micro-mitten`'s approach is significantly different from Rust's. Rather than depending on single ownership and a complex lifetime system, `micro-mitten` uses a series of data-flow analyses to statically approximate heap liveness. This means that it maintains the ability to insert freeing code at appropriate program points, without putting restrictions on how you write your code. The theory behind the approach is documented in [this thesis](https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-908.pdf) (Proust 2017).
Long story short, this is an attempt to see if we really can have unrestrictive compile-time garbage collection.
## How can I use it?!
The project depends on `libgc` and the LLVM-8 toolchain. Cloning this repository and running the following should get you set up with a working copy of `mmtnc` (the `micro-mitten` compiler).
```sh
./tools.sh # installs `mitten-test`, `mitten-bench`, `knit` and the language runtime
cargo install --path ./ --force # installs `mmtnc`
````mmtnc` compiles `.mmtn` files to LLVM IR (`.ll`) and just dumps the textual representation. Much more helpfully, you can get binaries directly using `knit`. To build a binary (`example`) from a source file (`example.mmtn`) use:
```sh
knit --src example.mmtn --gc-strategy=proust
```The `--gc-strategy` argument is optional, but the default is to use *no* garbage collection (your computer will hate you). The other options are `proust` (uses static memory management) and `bdw` (uses `libgc`).
## Notes
To get an idea of the language syntax, check out the examples in `src/test/`. If you get something wrong, the compiler should moan at you. Otherwise, please open an issue!
Please note, `micro-mitten` is purely a research language and its performance is not brilliant when using static memory management. For a full run-down, see [my dissertation](http://nathancorbyn.com/nc513.pdf). Most of the examples in `src/test/` will run with static memory management, but there are some notable exceptions and one or two memory leaks.