speakeasy
speakeasy copied to clipboard
consider integration with fox-it/dissect.cstruct for structure declarations
https://github.com/fox-it/dissect.cstruct is a project the implements a parser for a subset of C for structure declaration (and parsing). it looks pretty natural to use. i wonder if we could use dissect.cstruct
as a speakeasy.struct
frontend so that its even easier to import structures from MSDN, etc.
speakeasy.struct.Struct.from_c("""
struct some_struct {
uint8 field_1;
char field_2[SOME_CONSTANT];
char field_3[field_1 & 1 * 5]; // Some random expression to calculate array length
Example field_4[2];
};
""")
uses dissect.cstruct
to parse the string and then translate and return a speakeasy.struct
Very cool, it looks like we could also easily dynamically set the pointer size.