O'Reilly logo

Mastering Rust by Vesa Kaihlavirta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required