The Circuit Description Language — .cdl, the format PinBench saves a circuit
in — as a plain Dart package: a reader, a writer, and the data in between.
import 'package:pinbench_cdl/pinbench_cdl.dart';
final circuit = CdlParser.parse(source); // text -> CircuitData
for (final part in circuit.parts) print('${part.id}: ${part.type}');
final text = CdlWriter.write(circuit); // CircuitData -> textIt depends on nothing but meta — no Flutter, and nothing else of PinBench's.
That is the point of it being a package of its own: a VS Code extension, a
linter, a converter or a script can read and write .cdl exactly as the app
does. test/architecture/layering_test.dart in the app fails if it stops being
pure Dart.
lib/
pinbench_cdl.dart the API
src/
cdl_parser.dart CdlParser — text -> CircuitData
cdl_writer.dart CdlWriter — CircuitData -> text
circuit_data.dart CircuitData, PartData, WireData, CdlPoint
doc/
CDL.md the format: grammar, every field, the invariants
A .cdl names parts by type (LED, ArduinoUno) and gives each an id; it
does not say what an LED is. Properties come back exactly as the file spells
them — color: red, resistance: 4k7 — with no idea which ones a properties
panel shows or how a colour is capitalized there.
Turning a document into placed parts on a canvas, and back, is the app's side:
lib/cdl/ in pinbench_parts.
CdlWriter.write(CdlParser.parse(text)) reproduces a document the writer
produced, byte for byte. The app keeps its code editor and its canvas in sync by
regenerating one from the other; if a file came back even slightly differently,
it would open already marked as changed. test/cdl_test.dart pins it here, and
the app runs every shipped template through the full canvas round-trip.
Specified in doc/CDL.md — a Slint-flavoured element document
with // comments and bare PascalCase type tokens:
Circuit {
led_red := LED { position: (-30, -220); color: red; }
Wire { from: led_red.anode; to: uno.13; color: red; }
}
Don't confuse it with .pdl
(pinbench_pdl): a .cdl is one saved
circuit, a .pdl describes a kind of part.