Q logo

The Q Programming Language

Features ยท Quickstart ยท Examples ยท Links

A minimal, dependency-free language that compiles to tiny, fast machine code.

## Features - ๐Ÿš„ **High performance** - comparable to Rust and Zig. - ๐Ÿš€ **Fast compilation** - 5-10x faster than most compilers. - ๐Ÿ“ฆ **Lightweight executables** - 1 KB for simple programs. - ๐Ÿ” **Static analysis** - integrated linter catches common mistakes. - ๐Ÿ›ก๏ธ **Pointer safety** - pointers cannot be nil. - โ™ป๏ธ **Resource safety** - use-after-free is a compile error. - ๐Ÿง  **Simple syntax** - control flow is easily understood. - ๐Ÿ’ฌ **Friendly errors** - clear and concise compiler messages. - ๐ŸŒ **General purpose** - apps, servers, games, kernels, etc. - ๐Ÿงฉ **Multiple architectures** - x86-64 and arm64. - ๐Ÿ–ฅ๏ธ **Multiple platforms** - Linux, Mac and Windows. - ๐Ÿ“– **Readable source** - less than 1% of LLVM's code size. - ๐Ÿง˜ **Zero dependencies** - no external tools or libraries. ## Quickstart > [!WARNING] > Q is in early development. Design and implementation are changing continuously. ### Install ```shell git clone https://git.urbach.dev/cli/q cd q go build ln -s $PWD/q ~/.local/bin/ ``` ### Run ```shell q examples/hello ``` ### Build ```shell q build examples/hello ``` Cross-compile with `-os`: ```shell q build examples/hello -os windows ``` ### Inspect ```shell q ssa examples/hello # SSA form q asm examples/hello # Assembly output ``` ## Examples ### hello ```q import io main() { io.write("Hello\n") } ``` ### echo ```q echo() { buffer := new(byte, 4096) loop { n, _ := io.read(buffer) if n == 0 { return } io.write(buffer[..n]) } } ``` ### fibonacci ```q fibonacci(n int) -> int { if n <= 1 { return n } return fibonacci(n - 1) + fibonacci(n - 2) } ``` ### fizzbuzz ```q fizzbuzz(x int) { switch { x % 15 == 0 { io.write("FizzBuzz") } x % 5 == 0 { io.write("Buzz") } x % 3 == 0 { io.write("Fizz") } _ { io.write(x) } } } ``` See more in the [examples](../examples) directory. ## Links ### Docs - [Motivation](motivation.md) - [Design](design.md) - [Reference](reference.md) - [FAQ](faq.md) ### Project - [Source](source.md) - [Changes](changes.md) - [Security](security.md) - [Contributing](contributing.md) - [License](https://urbach.dev/license) ### Editors - [VS Code](https://git.urbach.dev/extra/vscode-q) - [Zed](https://git.urbach.dev/extra/zed-q) ### Community - [IRC](https://irc.urbach.dev/#q) - [Discord](https://discord.gg/4q3DJFsTvB) ### Donate - [GitHub](https://github.com/sponsors/akyoto) - [Kofi](https://ko-fi.com/akyoto) ## Copyright ยฉ 2025 Eduard Urbach