Boost logo

Boost :

From: Glen Fernandes (glen.fernandes_at_[hidden])
Date: 2020-09-18 18:25:25


On Thu, Sep 17, 2020 at 3:31 PM Vinícius dos Santos Oliveira wrote:
> A short introduction to pull parsers vs push parsers
>
> The act of parsing an incoming stream will generate events from a
> predefined set. Users match the generated events against rules to trigger
> actions. For the following JSON sample:
>
> { "foo" : 42 , "bar" : 33 }
>
> One of such event streams could be:
>
> begin_object -> string_key -> number -> string_key -> number -> end_object
>
> The essential difference between pull parsers and push parsers is how this
> event stream is delivered. A push parser (a.k.a. SAX parsers) uses the
> callback handler model. A pull parser (a.k.a. StAX parsers) stores the
> current parsing state and allows the user to query this state.
>
> Essentially every push parser has an implicit pull parser that doesn't get
> exposed to the user. This is to say that a push parser would be implemented
> in the lines of:
[snip]
> ## Review questions
>
>> Please be explicit about your decision (ACCEPT or REJECT).
>
> REJECT.

Hi Vinícius,

It took me a while to come to terms with the terminology ("pull
parser"), but eventually I reached the same page.

I am interested in a JSON pull parser as you've described it. But I
would want a library that is part of Boost - i.e. one that has been
through a formal review, and whose presence in Boost would result in
future maintenance and contributions etc.

Are you writing such a library with the intent of contributing it to Boost?

I understand that what Boost.JSON offers is a higher level
abstraction. i.e. Boost.JSON could be implemented on top of such a
JSON pull parser library. But that higher level abstraction is what
many users want, correct?

I said above I'd be in the market for a JSON pull parser. I prefer to
have my own types, not reuse a DOM type provided by a library. I would
think Boost should have both:

* A library that offers boost::json::value for the people that want that
* A library that has a pull parser for people like me

I know that one of your complaints was that Boost.JSON "does too
little". But aside from these other JSON-related use cases that it
does not cover, for what it does, it wasn't clear what the objection
was.

i.e. It sounded like your major objection to Boost.JSON was just that
it did not ship with the lower level pull parser.

Glen


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk