buzz

buzz

A small/lightweight statically typed scripting language

Guide Reference Try it Latest release open in new window

Statically typed

Find out bugs in your IDE rather than in production

JIT compiled

Uses MIR, a fast and lightweight JIT compiler

Unambiguous

No implicit behavior or unexpected type coercion

Small in size and complexity

Does not take much space on your drive or in your mind

Interoperability with C

Call C functions easily with FFIs and embed buzz with its C API

Fibers

Single threaded cooperative multitasking

import "std";

fun fibonacci(int n) > void *> int? {
    var n1 = 0;
    var n2 = 1;
    int? next = null;

    foreach (var _ in 0..n) {
        _ = yield n1;
        next = n1 + n2;
        n1 = n2;
        n2 = next!;
    }
}

fun main([str] args) > void {
    const N = if (args.len() > 0)
            std.parseInt(args[0]) ?? 10
        else
            10;

    foreach (var n in &fibonacci(N)) {
        std.print("{n}");
    }
}