Schrödinger’s Companion — a modern, type-safe quantum systems programming language.
QCLang is a high-level programming language designed to bridge the gap between classical systems programming and quantum circuit execution.
It features a Rust-inspired syntax, a strict affine type system for quantum safety, and compilation to OpenQASM 2.0.
/\_/\
( o.o ) Q U A N T U M C A T
> ^ < Schrödinger’s Companion
-
Hybrid Control Flow
Seamlessly mix classical logic (if,for,while) with quantum operations. -
Quantum Safety (Affine Types)
Compile-time enforcement of the No-Cloning Theorem:- Prevents quantum variable reassignment
- Prevents use-after-measurement
-
Modern, Familiar Syntax
Strong typing, structs, tuples, and type aliases inspired by Rust. -
QIR & Optimizing Backend
Generates optimized OpenQASM 2.0 (QIR phase in progress). -
Detailed Diagnostics
Helpful compile-time errors with actionable hints.
- Rust (latest stable)
- Cargo
git clone https://github.com/Asmodeus14/qclang.git
cd qclang
cargo install --path .Prebuilt binaries and versioned releases are available for download.
👉 Download from GitHub Releases: https://github.com/Asmodeus14/qclang/releases
Each release includes:
qclangCLI binary- Release notes
- Supported platform details
This is the recommended way to install QCLang if you don’t want to build from source.
Compile a .qc file to OpenQASM:
qclang compile my_circuit.qc --showRun syntax checks only:
qclang check my_circuit.qcfn main() -> int {
// Initialize quantum register
qreg q[2] = |00>;
// Apply gates (affine: no reassignment)
H(q[0]);
CNOT(q[0], q[1]);
// Measurement consumes the qubits
let r1: cbit = measure(q[0]);
let r2: cbit = measure(q[1]);
return 0;
}See syntax.md for the full language specification.
src/lexer.rs— Tokenizer (Logos)src/parser.rs— Recursive descent parsersrc/semantics/— Type system & ownership checkssrc/qir/— Quantum Intermediate Representationsrc/codegen/— OpenQASM 2.0 backend
Contributions are welcome!
Please see CONTRIBUTING.md for guidelines.
This project is especially friendly to:
- Compiler enthusiasts
- Quantum computing researchers
- Systems programmers
Licensed under the Apache License 2.0.
See the LICENSE file for details.