So we now have the basic infrastructure in place to start seeing what parser builders give us over the take/skip fluent style of parsing that we developed previously, and so far it’s pretty promising.
However, on Point-Free we like to frequently ask the question “What’s the point?” so that we can bring things back down to earth and make sure that what we are doing is really worth it. In the case of result builders there is a strong inclination to use this new Swift feature to tackle problems that don’t really need a comprehensive DSL or builder syntax. Do parsers really meet the requirements necessary to justify using result builders?
And we think definitely, yes. So far we have only parsed a simple textual format, but the dividends really start to pay when we tackle more complex problems. This gives us more opportunities to clean up noise and have the parsers tell a more concise story, and gives us a chance to create new parsing tools that leverage builder syntax.
So, Let’s start flexing those muscles by taking a look at some of the parser demos that come with the library to see what other cool things there are to discover.
If you didn’t know this already, the library comes with a large collection of parsers and benchmarks. If we expand the swift-parsing-benchmark directory we will find 16 different benchmarks that test a variety of things. There are a lot of fun things in these benchmarks, including and arithmetic expression parser, a binary data parser, an HTTP parser, a router, and a lot more.