Layout tree text representation
Summary
The hardware layout tree needs a text representation that can be hand-edited. From the poll it is very clear that a mixed representation is favored.
I was at first considering JSON as the input format, but there are two caveats:
- Comments are not supported
- "Flat" representations are not supported natively and have to be implemented on top of the parser
For these reasons I'm now gearing towards YAML. It brings in another dependency, yaml-cpp
(the library is great despite terrible lack of documentation). YAML natively supports anchors and type hints, so we could write eg:
%YAML 1.2
---
# The VFATs
.vfat-42: &vfat-42 !vfat
id: abcd-efgh
location: 0
.vfat-24: &vfat-24 !vfat
id: ijkl-mnop
location: 1
# This chamber is used elsewhere in the document with *chamber-123
.chamber-123: &chamber-123 !chamber
id: GE11-CERN-0001
location: 12
children:
- !optohybrid_fpga
id: something here
- *vfat-42
- *vfat-24
...
Unfortunately YAML anchors can't work between multiple files.