Data parsing is a problem closely related to that of deserialization. The most common way of thinking about parsing is to start with a formal grammar and construct parsers based on that. This results in a bottom-up parser where smaller rules parse smaller components of the whole input. A final combinatorial rule combines all smaller rules in a given order to form the final parser. This way of formally defining a finite set of rules is called a Parsing Expression Grammar (PEG). This ensures that parsing is unambiguous; that there is only one valid parse tree if parsing succeeds. In the Rust ecosystem, there are a few distinct ways of implementing PEGs, and each of those have their own strengths and weaknesses. The first ...
Parsing textual data
Get Network Programming with Rust now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.