Editor Layers

Your program is not just the main editor buffer. Qubi concatenates layers before compile, and error line numbers map back to the layer you edited.

The four pieces

  1. Settings header - #settings lines at the top of the main file (stripped before gate parsing, but applied to the run).
  2. Prepended layer - default gate library (H, X, CX, SWAPSEQ, …). Editable via the layer tabs in the simulator; changes persist per session.
  3. Main layer - your algorithm.
  4. Appended layer - optional trailing snippet (experiments, shared teardown, etc.).
// Main file only - prepended library is injected automatically
#import extra.qubi

H 0
CX [0,1]

Why it matters

  • Built-in gates live in the prepended layer, not in your file - keeps algorithms short.
  • Compiler errors on built-in gates point at the prepended layer line when you open that tab.
  • #import expands during preprocess of the combined body (imports do not belong inside gate { } blocks).