QLang is a simple, line-by-line command language for learning quantum computing. You type readable commands, and the QubitPage® OS interpreter builds and runs the circuit:
ENTANGLE q0 q1 # H on q0, then CNOT q0 → q1 (a Bell pair)
MEASURE q0 q1
RUN 4096 # expect roughly 50% "00" and 50% "11"
GHZ 4 # 4-qubit GHZ state
GROVER 5 3 # Grover search for item 5 among 3-qubit states
TELEPORT # textbook teleportation circuit
It's aimed at students and newcomers, who can run their first circuits in the browser without learning Python or Qiskit first. It isn't meant to replace OpenQASM, Qiskit or Cirq for research work.
This repository contains the language documentation, example programs and qlang_runtime.js, a small browser SDK that sends QLang code to a QubitPage® OS server. The interpreter itself lives in QubitPage-OS (src/quantum_kernel.py).
Running locally means circuits run in the Stim simulator. The OS also has a code path that can submit circuits to IBM Quantum with your own IBM token.
| Repository | Description |
|---|---|
| QLang | ← This repo: language docs, examples, browser SDK |
| QuBIOS | QEC & entanglement toolkit, simulation plus experiments on IBM hardware (report) |
| QubitPage-OS | Browser platform that hosts the QLang interpreter |
Quantum
| Command | Example | Meaning |
|---|---|---|
CIRCUIT <name> <n> |
CIRCUIT demo 3 |
New circuit with n qubits |
H X Y Z S T <q> |
H 0 |
Single-qubit gates |
CNOT CZ SWAP <a> <b> |
CNOT 0 1 |
Two-qubit gates |
TOFFOLI <a> <b> <c> |
TOFFOLI 0 1 2 |
Controlled-controlled-X |
MEASURE <q…> | ALL |
MEASURE ALL |
Add measurements |
RUN [shots] |
RUN 1024 |
Execute the current circuit |
ENTANGLE, SUPERPOSE |
ENTANGLE 0 1 |
Shortcuts for Bell pair / Hadamard |
BELL, GHZ <n>, GROVER <t> <n>, TELEPORT |
GHZ 4 |
Ready-made textbook circuits |
USE <backend>, BACKENDS |
USE stim |
Choose / list backends |
EXPORT <qasm|json|svg> |
EXPORT qasm |
Export the circuit |
Scripting helpers: VAR, LET, PRINT, IF … THEN, LOOP, FOR … IN … TO, ARRAY, MATRIX, MATH, FUNCTION, PROGRAM, IMPORT, ENCODE/DECODE, HASH, RANDOM, QRNG, PLOT, HISTORY, CLEAR.
Full reference: docs/language-spec.md
<script src="src/qlang_runtime.js"></script>
<script>
QBP.execute("BELL").then(r => console.log(r));
QBP.simulate("ghz3", { shots: 1024 }).then(d => QBP.renderResult("out", d.data || d));
</script>qlang_runtime.js needs a running QubitPage® OS backend (it calls /api/qplang/* and /api/quantum/*).
QLang is an educational project in active development:
- Each line is interpreted on its own (no full parser/compiler yet). A grammar, parser and OpenQASM 3 output are on the roadmap.
- Some example files use a
GATE H q0form that the current interpreter doesn't handle. UseH 0/CNOT 0 1until the examples are updated. QRNGandRANDOMsample a simulator, so on a local backend they're classical pseudo-random numbers, not certified quantum randomness. Don't use them for cryptographic keys.QFTandWHILEare listed in the in-app help but aren't implemented yet.OPTIMIZEandBENCHMARKare helper/demo commands, not research-grade optimizers.
- Formal grammar + parser, with clear error messages and line numbers
- OpenQASM 3 export, verified against Qiskit
- Examples tested in CI against the interpreter
- Optional IBM Quantum runs from the browser, using the user's own token
MIT. See LICENSE.

