A programming language

>luxv0.8.3

A small language built to be a great first one, and then to be outgrown. Every feature is the simplest version of something shared by Rust, Swift, and Go, so what you learn here carries straight over when you move on.

curl -LsSf https://anderix.com/lux/install | sh

macOS or Linux, no Rust toolchain needed. Have Rust already? cargo install luxc. Already installed? lux update gets the latest.

The whole language fits on one page

Most first languages are big. You spend your early weeks stepping around the parts you are not ready for. lux takes the opposite bet: it is small on purpose. The few hard ideas it leaves out — ownership, classes, goroutines — are the very lessons the bigger languages exist to teach, so leaving them out is not hiding anything. It is drawing a clean line at the edge of what a first language should carry.

What is left is the shape every procedural language shares. Variables, arithmetic, strings, if and while, functions and recursion, for ... in over ranges and arrays, your own types as structs and enums, and pattern matching that the compiler forces you to finish. There is no null: a value that might be missing is an Option, and one that might fail is a Result, so the two situations that sink beginners are ideas you handle rather than traps you fall into.

func greet(name: string) {
    print("Hello,", name)
}

greet("world")

The reference travels inside the binary

Once lux is installed, the tutorial is a command away. lux learn opens a menu of short topics; each one is a single screen that prints the idea, a runnable example, and an experiment to try. Add more to any topic for the deeper why, the universal name for the concept, and where it goes in Rust, Swift, and Go. When a program hits an error, the diagnostic points you at the card that explains it, so you learn the idea at the moment you need it.

lux learn               # the menu
lux learn enums         # one topic, as a card
lux learn enums more    # the deeper level
lux learn basics        # the shapes every language shares
lux learn tour          # the whole language

Run it, or turn it into a real language

lux run interprets a program directly — the fastest loop from typing to seeing output. When you are ready to see what your program looks like grown up, lux convert prints it as real source in Rust, Swift, or Go, each leaning on what that language already has, and lux build compiles the Rust translation to a native binary. The same few pages you learned here become idiomatic code in three of the languages worth moving on to.

lux run hello.lux              # interpret it
lux convert rust hello.lux     # print it as Rust
lux convert swift hello.lux    # ...or Swift
lux convert go hello.lux       # ...or Go
lux build hello.lux            # compile to a binary

A world you can open and change

lux crawl writes a small, playable text adventure into a folder and tells you how to play it. The whole world is one world.lux it leaves behind — the rooms, the doors, the torch in the cellar are all there in plain lux, yours to change. It is the first step from using a program to building one, and lux learn crawl walks through how it works.