An implementation of a featherweight muse interpreter written in Rust.
Featherweight muse is a subset of muse, a programming language that I'm working on. It is designed to test and evaluate the type system of muse, which implements compile-time memory management through borrow checking. The formalisation of featherweight muse can be seen in this paper.
Currently, featherweight muse supports the following:
- Variable declarations
- Function declarations
- Function calls
- Assignment
- Heap allocation
- Mutable/Immutable references
- Borrow checking system
- Ownership system
- Lifetime system
- Auto-dereferencing
cargo install
cargo run -- <options> <file>
Options:
-h, -help Display help
-l, -lex Display lexer output
-p, -parse Display parser output
-t, -typecheck Display typecheck output
-e, -eval Display eval output
To run all tests:
cargo test
cargo run tests/swap.mu
fn swap(mut ref a: int, mut ref b: int) {
let mut tmp = a
a = b
b = tmp
}
let mut x = 10
let mut y = 20
swap(x, y)
let mut heap_x = box x