2018-01-13 10:00 GMT-03:00 Oliver Adams via Boost
* Pull parsers are composable. For instance, you could insert a URL pull parser directly into an HTTP pull parser.
Composability is a big issue with push parsers, so removing obstacles to that would greatly simplify some things. For certain types of information, though, it doesn't seem like composition is important.
Composability is not always important. I've written a HTTP pull parser[1], but you won't always use the power to compose abstractions. However, it's really impressive what you can do with pull parsers. For instance, HTTP is the type of format where you parse incomplete messages. The idea of reparsing from the beginning is not really feasible because you usually won't maintain past data. Given these conditions, look at how powerful an HTTP pull parser is, where you can copy the parser and use it to "look ahead" (or backtracking if you will). I've wrote an example where I compose the parser and you can kind of assume field names and field values are always present together in the stream: https://github.com/BoostGSoC14/boost.http/commit/9908fe06d4b2364ce18ea9b4162... I don't really care about this specific example. I just like to notice how powerful this style really is. If I am to advertise for one style or another (and we're talking about HTTP parsers), I'll emphasize other characteristics. [1] https://vinipsmaker.github.io/asiohttpserver/ -- VinÃcius dos Santos Oliveira https://vinipsmaker.github.io/