Skip to main content

Interpreter

The interpreter processes Circuitscript in four stages, each consuming the output of the previous one:

Execution ──▶ Annotation ──▶ Layout ──▶ Render ──▶ SVG / PDF / HTML / KiCad schematic

└──▶ Netlist ──▶ KiCad netlist (.net) / ngspice netlist (.cir)
  1. Execution — The code is parsed and run, producing an intermediate representation (IR): a simplified script of the connections between components, pins, nets, and wires.
  2. Annotation — Reference designators (for example R1, C2, U3) are assigned to each component and recorded in the IR.
  3. Layout — The annotated IR is handed to the layout engine, which sizes and positions the components, wires, and other elements.
  4. Render — The layout engine's output feeds the render engine, which produces the graphical result: SVG, PDF, an interactive HTML viewer, or a KiCad schematic file — see Output formats.

The netlist outputs — KiCad .net and ngspice .cir — branch after Annotation: they need connectivity but not layout or rendering, so only the first two stages run.