Skip to content

Latest commit

 

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rune ᚱ

A high-performance bytecode programming language and stack-based virtual machine written in native Go.

let fib = fn(n) {
  if (n <= 1) {
    return n;
  }
  return fib(n - 1) + fib(n - 2);
};

let result = fib(10);
print("fib(10) =", result);

Features

  • Native Binary: Compiles to a single standalone executable (rune.exe / rune) with zero external runtime dependencies.
  • Pratt Parser: Top-down operator precedence climbing parser for expressions and control flow.
  • Stack-Based Virtual Machine: Compact bytecode instructions (OpConstant, OpAdd, OpJump, OpCall, OpClosure, etc.).
  • Lexical Scoping & Closures: Full closure upvalue capture with free variable resolution.
  • Data Structures: First-class arrays [1, 2, 3] and hash maps {"key": "value"}.
  • Interactive REPL: Live terminal shell with syntax coloring and dynamic disassembler.

Installation

Windows (PowerShell)

irm https://raw.githubusercontent.com/yanzyuyu/rune/main/install.ps1 | iex

Linux / macOS

curl -fsSL https://raw.githubusercontent.com/yanzyuyu/rune/main/install.sh | bash

Via Go

go install github.com/yanzyuyu/rune/cmd/rune@latest

Usage

Interactive REPL

rune

Execute a Script

rune run script.rn

Inspect Bytecode Instructions

rune disasm script.rn

Language Overview

Variables

let x = 10;
const PI = 3.14159;

Functions & Closures

let makeMultiplier = fn(factor) {
  return fn(x) {
    return x * factor;
  };
};

let double = makeMultiplier(2);
print(double(21)); // 42

Conditionals

if (x > 0) {
  print("positive");
} else {
  print("non-positive");
}

Arrays & Maps

let list = [1, 2, 3];
let item = first(list);
let extended = push(list, 4);

let person = {"name": "Rune", "version": 1};
let name = person["name"];

License

MIT

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages