XSD schema compiler that generates BDE-compliant C++ message types for BlazingMQ.
Replaces Bloomberg's internal bas_codegen.pl with a standalone Python tool so external contributors can regenerate protocol types without proprietary dependencies.
Parses Bloomberg-style XSD schemas and emits C++ header/source pairs following BDE coding standards. Handles sequences, choices, hybrid types, self-referential cycles (via NullableAllocatedValue), forward declaration ordering, and alignment-based member layout.
One schema in, two files out:
bmqp_ctrlmsg.xsd (1,792 lines) → bmqp_ctrlmsg_messages.h (39,030 lines)
bmqp_ctrlmsg_messages.cpp (17,677 lines)
python -m blazingmq.codegen \
--package bmqp_ctrlmsg \
--msgComponent messages \
--output-dir src/groups/bmq/bmqp/ \
bmqp_ctrlmsg.xsd
XSD → parser → model → resolver → emitter_{h,cpp}
↑ ↑ ↑
hybrid.py naming.py emit_{enum,sequence,choice}.py
ordering.py formatting.py
writer.py
parser builds a typed IR (Schema, ComplexType, EnumType, Field). resolver maps XSD types to C++ types, detects self-referential cycles via DFS, and determines allocator requirements. ordering topologically sorts types and orders members by alignment. Emitters produce formatted output through a Writer abstraction.
Output is diffed line-for-line against Bloomberg's checked-in generated files across 6 production schemas. Zero divergence.
Apache 2.0