Skip to content

An implementation of a featherweight muse interpreter written in Rust.

Notifications You must be signed in to change notification settings

kodokoto/featherweight-muse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Featherweight muse

An implementation of a featherweight muse interpreter written in Rust.

Featherweight muse is a simple language that acts as 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

Getting Started

Pre-requisites

Install

cargo install

Usage

cargo run -- <options> <file>

Options

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

Test

To run all tests:

cargo test

Example

cargo run tests/swap.mu

Syntax

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

About

An implementation of a featherweight muse interpreter written in Rust.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages