@wolf480pl @andrewg Surely one would use a well-tested parser generator and exhaustively test its output anyway, right?
Other formal verification may also be useful.
@wolf480pl @andrewg Surely one would use a well-tested parser generator and exhaustively test its output anyway, right?
Other formal verification may also be useful.
@wolf480pl @andrewg Yeah, in various languages.
They won't necessarily be optimized in whatever silly intrinsic-using ways doing it manually might, but they will be correct when provided with a correct grammar.
@wolf480pl @andrewg everparse seems like a promising one.
Racket (slopped lang) has its own.
Hammer is possibly dead but existed.
BinaryParser exists, seemingly not slopped.
Kaitai Struct would count.
Common Lisp has several and the gigamonkeys book does a reasonable job of hinting at how one would implement one.
@wolf480pl @andrewg Erlang also has its bitstring syntax, but that has limited support for context-sensitive decoding, so one would have to parse up to a branching point the syntax can't address directly, then match on that accordingly with more bitstrings.
@lispi314
TLVs are context-sensitive right?
@wolf480pl Lengths are the kind of things that can be directly addressed by referring to previously-matched areas.
I was thinking more of complex formats where the value might determine whether a number of other fields are present at all.
The kind of thing that protobuf was made for, in other words.
TLV requires too much trust in arbitrary external inputs to use it directly for bitstring syntax (one can definitely match on it though).
@rakoo @andrewg @wolf480pl PEGs are typically considered to be for the text-only source parsing use-case.
This is more general.