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
- Settings header -
#settingslines at the top of the main file (stripped before gate parsing, but applied to the run). - Prepended layer - default gate library (H, X, CX, SWAPSEQ, …). Editable via the layer tabs in the simulator; changes persist per session.
- Main layer - your algorithm.
- 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.
#importexpands during preprocess of the combined body (imports do not belong insidegate { }blocks).