Construct is a python module for defining arbitrary data structures. Once a data structure (aka, "construct") is defined, it can be used to both parse raw data into an object and build an object into raw data.
Unlike most parsers, it works at the bit-level, so you don't need to worry about parsing individual bits or unaligned fields.
Construct library supports Fields, Unions, Structs and Repeaters; Adapters and Validators; Switches, Pointers and other Meta -constructs.
Here are some key features of "Construct":
· Symmetrical -- constructs can be used to parse as well as to build
· Bit-level -- can parse and build individual bits, not only bytes
· Ready -- lots of predefined primitives and common protocols definitions, which you can easily use
· Extensible -- you can easily write user-defined constructs by simply by subclassing
· Fast -- benchmarks on my machine show ~160KB/sec can be parsed, fast enough for most situations, and perhaps pysco can improve that
· Declarative -- no procedural code needed for most situations
What's New in This Release:
· Construct2 is a rewrite of the library, making it faster and much slimmer.
· The library is now byte-oriented instead of bit-oriented, so it uses eight times less memory.
· It can parse files directly from the disk.
· Meta constructs now use lambda instead of eval.
· Textual processing (context free grammar) was added.
· On-demand parsing was added.
· Thorough unit tests were added.
· A full online tutorial is available.