Is there a hex "editor" out there that handles structured data and works as a compiler/decompiler tool? That is, it can take a text description of structured binary data and turn it into the actual binary data, and the reverse? For example, (inventing syntax wildly) given the definition uint16_be = count(myArray); uint16_be myArray[] and the input { 16, 17, 18 }, you'd get the bytes 00 03 00 10 00 11 00 12; if you fed those bytes into the reverse tool with the same definition, you'd get the text { 16, 17, 18 }.
To be clear: I want structured input and output, not just streams of hex. xxd won't cut it.
Several hex editors have data templates which address the structured binary-to-text problem, but that doesn't let me go the other way, and I want something that works as a command-line tool so I can use it in builds. If you're an old enough Mac developer, you might remember Rez and DeRez; what I want is basically that, but to operate on plain files. Any suggestions?