Qubi Programming Language

Qubi is the line-oriented language behind the Qubibyte circuit simulator. You write gates, loops, and measurements; the compiler figures out scheduling, validates wire usage, and drives the visual builder.

Become Qubi Certified

Earn the official Certificate of Proficiency for the Qubi Programming Language. Take a 25-question exam (multiple choice, fill-in-the-code, and build-a-circuit challenges with instant feedback) and score 80% or higher to earn a printable, shareable certificate signed by Qubibyte's Founder & CEO.

Start the certification exam →

What you get out of the box

Every simulator session ships with a prepended gate library (Hadamard through SWAPSEQ) so H 0 and CX [0,1] work without imports. You can layer your own gate { } blocks, pull in files with #import, and tune behavior with #settings lines that stay in sync with the Settings panel.

Readable syntax

One instruction per line. Comments, preprocessor directives, parametric gates, and braced LOOP blocks; no semicolons required.

Real expressions

LOOP counts, wire indices, and matrix cells accept sqrt, round*, **, pi, e, wire synonyms like visiblemax, and user name = expr variables.

Automatic scheduling

Pack independent gates into the same column when wires do not clash. Seven scheduling modes from strict line-by-line to full parallelism.

Parametric sweeps

Bracket syntax like <0..5> and <H,X> steps through wire indices, gates, and angles from the circuit builder without copying the whole file.

Classical control flow

if / elseif / else blocks branch on measured bits (c[i]) or scalar conditions. LOOP accepts both fixed counts and while-style headers.

Bitstring literals

0b… and 0x… literals, len(), tolist(), and bitwise ops feed wire lists and conditions, useful for oracle-style circuits.

The Simulator UI section walks through every tab in the Quantum Circuit Simulator (Circuit Builder, Data Analysis, Gate Creator, Parametric Sweep, NMR, and more). See Parametric Sweeps for combo stepping and derived variables (k = j+2).

How a file is structured

A typical program stacks four layers (see Editor Layers):

  1. Settings header: optional environmental header lines parsed first
  2. Prepended layer: optional prepended code (used for built-in gate library)
  3. Main editor: your code
  4. Appended layer: optional trailing code (often empty)
#settings MaxQubits 8
#settings Scheduling "always"

H 0
CX [0,1]
MEASURE (0,1)

Removed legacy syntax

Older tutorials may mention #define macros or @desc / @examples line tags. Those are gone; define gates with gate NAME { desc: … examples: … } instead. The validator will point you at the line if old syntax slips in.

Try it: Use Open in Simulator buttons throughout these docs to load snippets straight into the editor.