The Q Programming Language Q is a minimal, dependency-free programming language and compiler targeting x86-64 and arm64 with ultra-fast builds and tiny binaries. Features High performance ( ssa and asm optimizations) and optimizations) Fast compilation (<100 μs for simple programs) Tiny executables ("Hello World" is ~600 bytes) Multiple platforms (Linux, Mac and Windows) Zero dependencies (no llvm, no libc) Installation Warning q is under heavy development and not ready for production yet. Please read this. Feel free to contact me if you are interested in helping out. Build from source: git clone https://git.urbach.dev/cli/q cd q go build Install via symlink: ln -s $PWD /q ~/.local/bin/q Usage Run hello example: q examples/hello Build an executable: q build examples/hello Build for another architecture: q build examples/hello --arch arm q build examples/hello --arch x86 Build for another operating system: q build examples/hello --os linux q build examples/hello --os mac q build examples/hello --os windows Build with verbose output: q build examples/hello --verbose Language specification The work is currently being focused on the correctness of the compiler and the proper code generation for all architectures and operating systems. The language syntax is highly volatile at this point but you can take a look at the examples or the tests to get a perspective on the current status. Documentation for all language features will follow once the core systems are stable. Source overview This section is for contributors who want a high-level overview of the source code structure. Packages arm - arm64 architecture asm - Generic assembler ast - Abstract syntax tree cli - Command line interface codegen - SSA to assembly code generation compiler - Compiler frontend config - Build configuration core - Defines Function and compiles tokens to SSA and compiles tokens to SSA cpu - Types to represent a generic CPU data - Data container that can re-use existing data dll - DLL support for Windows systems elf - ELF format for Linux executables errors - Error handling that reports lines and columns exe - Generic executable format to calculate section offsets expression - Expression parser generating trees fs - File system access global - Global variables like the working directory linker - Frontend for generating executable files macho - Mach-O format for Mac executables memfile - Memory backed file descriptors pe - PE format for Windows executables scanner - Scanner that parses top-level instructions set - Generic set implementation sizeof - Calculates the byte size of numbers ssa - Static single assignment types token - Tokenizer types - Type system verbose - Verbose output x86 - x86-64 architecture Typical flow FAQ How tiny is a Hello World? arm64 x86-64 🐧 Linux 646 bytes 582 bytes 🍏 Mac 49.3 KiB 12.5 KiB 🪟 Windows 1.7 KiB 1.7 KiB This table often raises the question why Mac builds are so huge compared to the rest. The answer is in these few lines of their kernel code. None of the other operating systems force you to page-align sections on disk. In practice, however, it's not as bad as it sounds because the padding is a zero-filled area that barely consumes any disk space in sparse files. Which platforms are supported? arm64 x86-64 🐧 Linux ✔️ ✔️ 🍏 Mac ✔️ * ✔️ 🪟 Windows ✔️ * ✔️ Those marked with a star need testing. Please contact me if you have a machine with the marked architectures. How is the assembly code quality? The backend uses an SSA based IR which is also used by well established compilers like gcc , go and llvm . SSA makes it trivial to apply lots of common optimization passes to it. As such, the quality of the generated assembly is fairly high despite the young age of the project. Which security features are supported? PIE All executables are built as position independent executables supporting a dynamic base address. W^X All memory pages are loaded with either execute or write permissions but never with both. Constant data is read-only. Read Execute Write Code ✔️ ✔️ ❌ Data ✔️ ❌ ❌ How do I use it for scripting? The compiler is actually so fast that it's possible to compile an entire script within microseconds. #!/usr/bin/env q import io main() { io.write("Hello ") } Create a file with the contents above and add permissions via chmod +x . Now you can execute it from anywhere. The generated machine code runs directly from RAM if the OS supports it. Any editor extensions? There is one for VS Code but is only has syntax highlighting so far. You can clone the vscode-q repository into your extensions folder. Neovim support is planned. How do I pronounce the name? /ˈkjuː/ just like q in the English alphabet. FAQ: Contributors How do I run the test suite? Run all tests: go run gotest.tools/gotestsum@latest Generate coverage: go test -coverpkg = ./... -coverprofile = cover.out ./... View coverage: go tool cover -func cover.out go tool cover -html cover.out How do I run the benchmarks? Run compiler benchmarks: go test ./tests -run = '^$' -bench = . -benchmem Run compiler benchmarks in single-threaded mode: GOMAXPROCS = 1 go test ./tests -run '^$' -bench . -benchmem Generate profiling data: go test ./tests -run = '^$' -bench = . -benchmem -cpuprofile cpu.out -memprofile mem.out View profiling data: go tool pprof --nodefraction = 0.1 -http = :8080 ./cpu.out go tool pprof --nodefraction = 0.1 -http = :8080 ./mem.out Is there an IRC channel? #q on irc.urbach.dev. License Please see the license documentation. Copyright © 2025 Eduard Urbach