Skip to content

Repository files navigation

Mux Logo

Mux

The Programming Language For Everyone

Version License Documentation Status Sonar Quality Gate Coverage

Mux is a statically-typed, reference-counted programming language that combines Python's readability, Go's simplicity, and Rust's type safety into one cohesive package. Write fast, safe, and maintainable code without the complexity.


Why Mux?

  • Simple & Readable: Clean syntax without semicolons, Python-like readability with Go-inspired minimalism
  • Type Safe: Strong static typing with no implicit conversions. Catch errors at compile time
  • Fast & Native: LLVM-powered compilation delivers native performance
  • Memory Safe: Reference-counted memory management provides safety without GC pauses or complex ownership
  • Modern Features: Full-featured with generics, interfaces, tagged unions, and pattern matching
  • Developer Friendly: Helpful error messages, built-in tooling, and comprehensive documentation

Quick Start

Installation (One-Line)

curl -fsSL https://raw.githubusercontent.com/muxlang/mux-compiler/main/scripts/install.sh | sh

Full installation guide | Other options

Your First Program

Create hello.mux:

func main() returns void {
    print("Hello, Mux!")
}

Run it:

mux run hello.mux

Documentation

The full language reference, guides, and standard-library docs live at mux-lang.dev:

For how the compiler and runtime work internally (design rationale, the value model, codegen, memory), see the muxlang/mux-context knowledge hub.


Installation

Choose the method that works best for you:

Option 1: Prebuilt Binaries (Recommended)

The fastest way to get started. No Rust and no LLVM development libraries required - but you do need clang matching the linked LLVM major (22), since Mux calls it to link every program it compiles. The installer runs mux doctor when it finishes and names anything missing.

Linux & macOS:

curl -fsSL https://raw.githubusercontent.com/muxlang/mux-compiler/main/scripts/install.sh | sh

Windows (PowerShell):

iwr -useb https://raw.githubusercontent.com/muxlang/mux-compiler/main/scripts/install.ps1 | iex

Custom installation directory:

MUX_INSTALL_DIR=/usr/local/bin MUX_LIB_DIR=/usr/local/lib sh install.sh

Option 2: crates.io (frozen)

mux-lang was published to crates.io through 0.6.0. That channel is no longer updated: cargo install mux-lang needs a Rust toolchain and the exact LLVM 22 development libraries, then compiles the LLVM bindings from scratch, making it the slowest route to a working compiler. Use Option 1, or build from source below.

Option 3: Build from Source

For contributors and those who want the latest features:

git clone https://github.com/muxlang/mux-compiler
cd mux-compiler
./scripts/bootstrap-dev.sh   # Installs LLVM 22 automatically
./scripts/dev-cargo.sh build

Verify Installation

mux version            # Check compiler and runtime versions
mux doctor             # Validate runtime dependencies
mux doctor --dev       # Validate LLVM 22 and clang for development

Quick Example

Mux combines familiar syntax with powerful features:

// Error handling with Result types
func divide(int a, int b) returns result<int, string> {
    if b == 0 {
        return err("division by zero")
    }
    return ok(a / b)
}

// Pattern matching with exhaustive checking
func main() returns void {
    auto result = divide(10, 2)

    match result {
        ok(value) {
            print("Result: " + value.to_string())
        }
        err(error) {
            print("Error: " + error)
        }
    }
}

More examples: see test_scripts/ or the Language Guide.


How it works

.mux --> lexer --> parser --> semantics --> LLVM codegen --> .ll --> clang --> native binary
                                                                   (links libmux_runtime)

The compiler emits LLVM IR and invokes clang to produce a native binary that links the runtime (reference counting, strings, collections, stdlib). Use mux run -i <file.mux> to view the generated IR. The deeper design notes (value representation, monomorphization, the object system, memory model) live in muxlang/mux-context.


Contributing

Mux is an open-source project and welcomes contributions! Whether you're adding features, fixing bugs, improving documentation, or testing, your help is valuable.

Profiling

Profiling is done with external tools so it stays decoupled from the compiler and runtime. See the Setup page for platform-specific guidance.


Project Status

⚠️ Alpha Stage: Mux is actively being developed. Expect breaking changes and incomplete features as we work toward a stable release.

  • Current Version: 0.6.0

Versioning

The compiler version lives in mux-compiler/Cargo.toml (CARGO_PKG_VERSION) and is the canonical "Mux version" - there is no separate version file.

  • When releasing, bump version in mux-compiler/Cargo.toml, update the badge and the - **Current Version:** line above, then run cargo build to refresh Cargo.lock.
  • The runtime is a git dependency on muxlang/mux-runtime main, pinned to one commit by Cargo.lock; mux version reports both, with the locked commit as build metadata.
  • Full release steps: muxlang/mux-context.
  • License: MIT
  • Maintainer: Derek Corniello

Runtime ABI Note

The runtime uses a unified representation for optional<T> and result<T, E> at the FFI level (boxed Value pointers). Compiler-generated code and FFI should treat optionals/results as *mut Value and use the runtime discriminant helpers when inspecting variants. See error-handling.


Related repositories

Repo What it is
mux-runtime Runtime + standard library linked by compiled programs
mux-website Docs site (mux-lang.dev) and the language reference
mux-website-api Compile/run API behind the playground
tree-sitter-mux Tree-sitter grammar + highlight queries
mux-syntax-highlighting TextMate grammar, VSCode extension, canonical syntax spec
mux-context Cross-repo architecture, design rationale, glossary, releases

License

Mux is licensed under the MIT License.

About

Mux: a strong, statically typed, Go-like language with Rust-inspired safety and LLVM-powered speed.

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages