Skip to main content

Overview

Mux is a statically-typed, reference-counted programming language combining simplicity with safety.

Introduction​

Mux (fully "MuxLang") is designed with the following principles:

  • Java-style explicit typing with local type inference
  • Python-style collection literals
  • Rust-style pattern matching with guards
  • Curly-brace syntax and no semicolons
  • Minimal trait/class model using is instead of implements
  • Built-in result<T,E> and optional<T> for error handling

Key Features​

Static Type System​

Mux uses strict static typing with no implicit type conversions. All type conversions must be explicit.

type_inference.mux
Loading...

No Semicolons​

Statements are terminated by end-of-line only:

no_semicolons.mux
Loading...

Pattern Matching​

Rust-style pattern matching with guards:

pattern_matching.mux
Loading...

Memory Safety​

Reference counting provides deterministic memory management without manual allocation or garbage collection pauses.

Language Sections​

Explore the detailed language documentation:

  • Types - Primitive types, conversions, and the type system
  • Variables - Variable declarations, constants, and type inference
  • Functions - Function definitions, parameters, and return types
  • Control Flow - If/else, loops, match statements
  • Classes - Classes, interfaces, and object-oriented features
  • Enums - Tagged unions and pattern matching
  • Generics - Generic functions and classes
  • Collections - Lists, maps, sets, and collection methods
  • Error Handling - result and optional types
  • Memory - Reference counting and memory model
  • Modules - Import system and code organization

Lexical Structure​

  • Case-sensitive identifiers: letters, digits, _, not starting with a digit
  • Whitespace separates tokens. Newlines usually end statements; expressions can also span lines inside delimiters or after a binary operator.
  • Comments:
    • Single-line: // comment
    • Multi-line: /* comment */
  • Statement termination: by end-of-line only (no semicolons)
  • Underscore placeholder: _ can be used for unused parameters, variables, or pattern matching wildcards

Keywords​

func, returns, const, auto, class, interface, enum, match, if, else, for, while, break, continue, return, import, is, as, in, true, false, common, where, none, some, result, optional, ok, err

Type System Principles​

Critical Design Decisions:

  • NO dynamic typing
  • NO implicit type conversions
  • NO runtime reflection
  • All generics must monomorphize at compile time
  • Interfaces support static bounds and owned dyn<Interface> values

Getting Help​