SUB — Simple Universal Builder

A small language toolchain: one .sb source, compiled to native x86-64 machine code, interpreted live, or transpiled to 13 languages.

curl -fsSL https://raw.githubusercontent.com/subhobhai943/sub-lang/main/installer/install.sh | sh

Features

Three tools in one toolchain. Real compilation, real interpretation, real transpilation — no wrappers.

Native compiler — subc

Emits x86-64 machine code and writes the ELF executable itself. No assembler, no linker, no libc — a compiled SUB program is a self-contained static binary a few kilobytes in size.

Direct interpreter — subi

Runs .sb programs instantly, with an interactive REPL. The interpreter is the specification every backend agrees with, and CI diffs each backend against it.

13-target transpiler — sub

One command generates idiomatic Python, JavaScript, TypeScript, C, C++, Rust, Go, Java, Kotlin, Swift, Ruby, x86-64 Assembly, and CSS from a single AST.

Classes & objects

Clean OOP with class, fields, .new construction and member access — lowered idiomatically on every backend.

Pattern matching

switch/case over ints, strings and floats with multi-value clauses and no fall-through — a case runs its body and nothing else.

Standard library

Four modules — math, arrays, strings, io — written in SUB, verified through every backend, loaded with import.

Declarative UI tree

First-class ui.* syntax for windows, labels, buttons and inputs — one tree, many renderers.

Packages everywhere

Windows .msi, Linux .deb/.rpm, macOS .pkg, FreeBSD pkg, Arch, Alpine, AppImage — and a universal curl | sh.

Download

Direct links to the latest release. Your platform has been highlighted.

Windows

x86_64 · MSI installer

Download .msi

macOS

Apple Silicon · .pkg installer

Download .pkg tar.gz

Linux

Debian/Ubuntu · .deb

Download .deb deb arm64 .rpm rpm arm64 tar.gz

FreeBSD

pkg(8) package · amd64

Download .pkg tar.gz

All assets & release notes · SHA-256 checksums

Code examples

One canonical spelling: let, fn, null, brace-delimited blocks. Older spellings still compile, with a deprecation note.

hello.sb
let name = "World"
let greeting = "Hello, " + name

println(greeting)

fn add(a, b) {
    return a + b
}

println(add(10, 20))
$ subc hello.sb && ./hello Hello, World 30
switch.sb
let choice = 2

switch choice {
    case 1:
        println("First choice")
    case 2, 3:            # one clause, several values
        println("Second choice")
    default:
        println("Other choice")
}
$ subi switch.sb Second choice
point.sb
class Point {
    let x = 0
    let y = 0
}

let p = Point.new
p.x = 10
p.y = 20

println(p.x)  # 10
println(p.y)  # 20
$ subi point.sb 10 20

Transpilation targets

Ten of the thirteen targets are executed and diffed against the interpreter in CI, on every push.

  • Pythonverified in CI
  • JavaScriptverified in CI
  • TypeScriptverified in CI
  • Cverified in CI
  • C++verified in CI
  • Rustverified in CI
  • Goverified in CI
  • Javaverified in CI
  • Kotlinverified in CI
  • Swiftverified in CI
  • Rubyverified in CI
  • x86-64 Assemblygenerated
  • CSSgenerated
transpile
$ sub program.sb rust    # -> program.rs
$ sub program.sb go      # -> program.go
$ sub program.sb python  # -> program.py

Quick start

Up and running in under a minute.

  1. Install

    Grab a release for your platform, or use the universal installer:

    curl -fsSL https://raw.githubusercontent.com/subhobhai943/sub-lang/main/installer/install.sh | sh

    Or build from source: make.

  2. Run it

    Interpret a script, or drop into the REPL:

    $ echo 'println("hello")' > hello.sb
    $ subi hello.sb
    hello
  3. Go native

    Compile straight to machine code, or out to any target:

    $ subc hello.sb -o hello
    $ ./hello
    $ sub hello.sb rust