Skip to content
kryptaminePublic

About

Rune programming language

Resources

Stars

6 stars

Watchers

1 watching

Forks

Repository files navigation

Rune

A small, dynamically typed scripting language with a bytecode VM, shipped as a single static binary.

CI status Latest release Documentation MIT licence

Documentation · Download · Examples

Inspired by JavaScript, Python, Rust and Swift. Written in Go: the AST is compiled to register bytecode and run by a VM.

Rune example

api   ✓ up
auth  ~ slow, 830ms
cdn   ✗ gone
db    ✗ HTTP 503
cache ✗ number() cannot parse "ok" as a number.

Features

  • immutable by default (let / let mut), compile-time const
  • value semantics: arrays, maps, sets and structs copy lazily, mut parameters are inout
  • structs and enums with fields, impl methods
  • blocks give their last expression: fun sq(x) { x * x }, if c { a } else { b }, block match arms
  • match on literals, ranges (200..300, 500..), types, structs, arrays and enums, exhaustive over enum variants; the same nested patterns in let, parameters and if x is { status: 200, body }; spread, rest
  • membership x in xs (a range without making it), slices xs[1..], s[..-1]
  • nil-safe chains a?.b ?? c; return / break / continue / throw as expressions
  • try/catch by error type, a block that gives a value like if; defer
  • modules with export / import
  • standard library: string, regex, math, json, http, time, fs, io, os
  • built-in formatter: rune fmt

Install

Download the archive for your platform from the releases page: Linux, macOS and Windows, on amd64 and arm64. Each holds a single rune binary; put it somewhere on your PATH.

# macOS on Apple silicon; swap the version and platform for yours
curl -LO https://github.com/kryptamine/rune/releases/download/v0.4.0/rune-0.4.0-darwin-arm64.tar.gz
tar -xzf rune-0.4.0-darwin-arm64.tar.gz
sudo mv rune-0.4.0-darwin-arm64/rune /usr/local/bin/
rune version

checksums.txt next to the archives lists their SHA-256 sums.

From source

Needs Go 1.27+.

git clone https://github.com/kryptamine/rune && cd rune
make build

Quick start

echo 'print("hello, world!");' > hello.rn
rune run hello.rn

More programs in examples/. The documentation covers the language and the standard library.

Editor support

Neovim syntax highlighting lives in extras/nvim.

Development

make test          # run the test suite
mdbook serve docs  # preview the docs locally

License

MIT

About

Rune programming language

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages