OmniLang

A statically typed playground for compiler nerds. Build SSA pipelines, target multiple backends (C, VM, Cranelift), and experiment with a batteries-included standard library—all written in Go.

Why OmniLang?

Modern Pipeline

Go frontend featuring lexer, parser, type checker, and SSA MIR builder. Inspect every stage or emit MIR for custom tooling.

SSA MIR Go Toolchain Type System

Multi-backend Runtime

Switch between the C backend, VM interpreter, or experimental Cranelift bridge. Pick the right trade-off for speed vs. iteration time.

C VM Cranelift

Standard Library

Batteries-included modules: `std.io`, `std.string`, `std.math`, collections, OS helpers, networking, testing, and dev utilities.

std.io std.net std.testing

Dev Experience

VS Code extension, CLI tooling (`omnic`, `omnir`, `omnipkg`), and automated packaging via GitLab CI make hacking pleasant.

VS Code CLI CI/CD

Quick Start

git clone https://github.com/omni-lang/omni.git
cd omni
make build      # build compiler + tools
make test       # run language + stdlib tests
import std

func main():int {
    std.io.println("Hello, OmniLang!")
    return 0
}

Compile & Run

# Native executable (C backend)
./bin/omnic hello.omni -o hello
./hello

# Fast VM execution
./bin/omnir hello.omni

# Inspect MIR
./bin/omnic hello.omni -emit mir

Example Gallery

Like Python’s “Beginner’s Guide”, these snippets show what real OmniLang code looks like: interactive I/O, structured data, asynchronous tasks, and testing helpers bundled with the toolchain.

Hello, CLI

import std

func main():int {
    std.io.print("Name: ")
    let name = std.io.read_line()
    std.io.println("hey " + name + " 👋")
    return 0
}

Data Structures

struct Todo { id:int text:string done:bool }

func main():int {
    var todos:array = []
    todos.push(Todo{id:1, text:"learn SSA", done:false})
    for t in todos {
        if !t.done {
            std.io.println("TODO #" + t.id.to_string() + ": " + t.text)
        }
    }
    return 0
}

Async-style Tasks

import std.net

func fetch(url:string):string {
    let res = std.net.http.get(url)
    return res.body
}

func main():int {
    let docs = fetch("https://example.com/docs")
    std.io.println("downloaded " + docs.len().to_string() + " bytes")
    return 0
}

Testing Helpers

import std.testing as t

func add(a:int, b:int):int { return a + b }

test "adds numbers" {
    t.assert_equal(add(2, 2), 4)
}

Language Highlights

Type System

Primitives (`int`, `float`, `bool`, `string`, `char`), arrays, maps, user-defined `struct`/`enum`, and type inference with `let` defaults.

Control Flow

`if`, `switch`, `for` (classic + range), `defer`, early `return`, logical ops, and SSA-friendly constructs.

Functions

First-class functions, multiple return values, and explicit mutability via `var`.

Testing

`omnir` drives end-to-end suites in `omni/tests/e2e` plus a dedicated `std.testing` module for assertions and fixtures.

Tooling & Docs

VS Code Extension

Located in vscode/omni: syntax highlighting, snippets, simple completions, and inline diagnostics powered by `omnic`.

CLI Trio

`omnic` (compiler), `omnir` (runner/test harness), and `omnipkg` (packager) cover the full workflow from prototype to release.

Documentation

Dive deeper via the in-repo README and the reference material under docs/.

Source Guide

Explore standard library modules in omni/std/ and examples/tests in omni/tests/.

Get Involved

OmniLang’s active development happens on a private GitLab instance and is mirrored to GitHub for easy browsing. Contributions, experiments, and wild ideas are welcome—this is a playground for compiler explorers.

Browse the GitHub mirror →

Open Source Compiler R&D Community