Boost logo

Boost :

Subject: Re: [boost] Library for configuration file parsing
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-12-01 18:32:40


Marsh Ray wrote:
> On 12/01/2010 11:08 AM, Robert Ramey wrote:
>> It results in a
>> better defined, more complete, more robust, more correct
>> and cheaper to maintain and upgrade final product.
>
> I would like to be able to say that from my own experience.

I'm basing my comments on my experience using a spirit xml
parser for the serialization library input. I didn't (and still don't
think parsing xml should be that hard. When I was faced with
it my reaction was dread at having to do a small recurrsive descent
or state machine parser for the umpteenth time.

> When I had tried it, I referred to the calculator examples a lot. But
> they calculate the result and return just that! I wanted to build
> something very close to the parse tree, but had significant trouble
> figuring out how to construct the node types and pass them upwards.

I'll confess that using spirit was a lot harder than I thought it was going
to be. This was mainly due to the fact the that declarative approach
was sort of new to me. Then there was usage of things what I wasn't
really familiar with at the time functors, binders, etc. But I also wanted
to become familiar with these things. I did - with a little help - manage
to get it working and was was extremely pleased with the result. There
was the grammar displayed in a formal verifiable way totally separate
from the other code - of which there was very little. It was much easier
to be confident that it was correct - assuming spirit actually worked
- which apparently it does.

> The features for automatically constructing the return value were the
> most promoted by the documentation. It seemed to work great for things
> like ints and doubles, things that have an obvious primitive
> representation in C++. But the automatic facility seemed to just get
> in the way as soon as I wanted to return custom structs. There was the
> XML DOM example, but it was not simple enough for me.
>
> Thanks, I'm joining the Spirit list now.

lol - I never hoped to be THAT persuasive. You might take a look
at the xml_grammer code in the serialization library. I think it shows
how valuable this tool can be. I turned a messy job into a work of
art. Also note this made it easy to support a wide character version
with ease. Finally, note that I have had my complaints and criticisms of
spirit
so I'm not really considered a member of the spirit "booster" team.

I just took a look at the spirit parser cited in a previous email. This
seems pretty good. I reminds me of my own experience - lots of
cryptic functors and stuff and at the end - a very simple to understand
listing of the actual JSON grammar. So it's a lot of work to setup
but easy to maintain. Actually I see that he includes a JASON
writer as well. If I had nothing else to do, I might be inclined to
just make json_?archive classes out of these.

Robert Ramey


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