nom

Our first stop in checking out various Rust parsing libraries is nom. It's actually a parser combinator library, which refers to the fact that every parser can be combined with another. So, instead of writing a full parser for a language using some parser definition language such as EBNF, with parser combinators, you can write small and reusable parsers and combine them together.

nom plays into many of Rust's strengths, providing strong typing parsers with zero-copy semantics. This means that using nom will cause no more memory allocations than a corresponding optimal handwritten one would. nom uses macros quite lot to achieve more ergonomic usage and for optimizing code by precomputing things at compile-time.

It accepts input in any ...

Get Mastering Rust now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.