!! Problem
Problems of Hachoir syntax:
- Hachoir parser are very close classic parser code: it's like a list of read(type, length)
- It's hard to convert an Hachoir parser to another syntax (C struct or any other parser syntax)
Requirements:
- need arithmetic operations: a+b, a-b, a*b, a/b (integer divison), a%b
- need (sometimes) to call Python function: alignValue() or many functions when creating a field description
- need to be able to get other field attribute (brother or parent)
More complex requirements:
- what about loop on range?
for index in range(n):
...
- what about loop with condition?
while self.current_size < self.size:
...
while True:
offset = UInt32(self, "offset[]")
yield offset
if offset.value == 0:
break
- what about test (if)?
if self["has_comment"].value:
yield CString(self, "comment")
Haypo: "On my mind, it's not possible or at least very complex"
!! Existing syntax for binary parsers