0

I have to deal with a buffer of bytes. This buffer can have multiple grammars (A, B, C, .. , etc).

For example: AxxxxBxxxxACxxx

where x's are dirty bytes and I would like to skip them. (They don't match any grammar)

I want to know if it is possible to use kaitai-struct to parse those grammars skipping the dirty bytes.

4

1 回答 1

1

No, it's not possible, and it's generally not an objective of Kaitai Struct.

Whole idea of binary parsing is generally very different from classic parsing theory, as binary formats are designed to be machine-readable and thus are typically non-ambiguous. Binary parsers typically are very straightforward and do not employ "state", "backtracking", "recursive descent", grammars as a representation of internal state machine, etc.

于 2019-03-11T22:02:46.370 回答