nom for parser combinators and zero-copy parsing

4689
0

Nom is a parser combinator library for building parsers from small, composable functions. It's byte-oriented and zero-copy, making it ideal for binary protocols, config files, or log parsing. I define parsers for tokens (like tag("GET") or digit1), then combine them with map, tuple, alt, etc. The IResult type represents parse success/failure with remaining input. Nom parsers are pure functions, so they're easy to test and reuse. For text parsing, nom is faster than regex in many cases. The learning curve is steeper than regex, but the composability and performance are worth it for complex grammars.