Skip to content

KHN190/Abrase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

201 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Abrase

zero dependencies leak free rustc 1.85+ playground MIT

CI codecov crates.io

Abrase (.abe, abbreviated Abe) is a Rust-inspired language. Abrase source compiles to Polka bytecode, which runs on the Myriad runtime.

It features:

  • Strong typed
  • Algebraic effects
  • Region memory lifecycle design - no GC, leak free
  • Linter & Debugger

It can be added to any Rust application. See wiki.

Try it now in browser.

Transpile to Rust is WIP.

Installation

cargo install abrase-cli

# and use
abrase run hello.abe
abrase disasm examples/nqueens.abe

Or download pre-compiled GitHub Releases.

Language Overview

effect Metric {
  op record(msg: String) -> Unit
}

fn fib(n: Int) -> <Metric> Int {
  Metric.record("entering fib({n})");
  if n < 2 { n } else { fib(n - 1) + fib(n - 2) }
}

fn main() -> Int {
  handle fib(10) {
    return v       => v,
    Metric.record msg => {
      println(msg);
      resume(())
    }
  }
}

Benchmarks

Generally 1.3~2x better than CPython. On specific smaller tasks, could be ~10x faster. See Wiki / Optimizations.

Reproduce with hyperfine.

Polka — bytecode design

  • 46 opcodes, 4 bytes each. Data & opcode are aligned.
  • 128 registers per frame.

See Wiki / Bytecode Spec.

Read about the blog here.

About

Rust inspired language for language models.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages