On Sun, Jul 15, 2012 at 2:03 AM, David E. Wheeler <[email protected]> wrote:
> On Jul 14, 2012, at 7:45 PM, Marvin Humphrey wrote:
>
>> Our JSON parser is powered by the Lemon parser generator[1], with the grammar
>> file in core/Lucy/Util/Json/JsonParser.y.  As formal grammars are the topic 
>> of
>> this week's book club, I thought it might be a good time to hack on it a bit.
>
> How compliant is it?  Is this something we ought to consider breaking out
> into a separate library?  I could use a good C-based JSON parser at times…

There are a lot of good JSON parsers out there.  The spec is both simple and
coherent (unlike, say, YAML's), so writing a decent implementation is not that
hard in the grand scheme of things.

The thing is, C doesn't provide either hash table or bounded array data
structures natively -- so any JSON library has to either provide those itself
or add a dependency on a library that does.  By rolling our own JSON library,
we were able to optimize it for Clownfish data structures.  Had we not done
that, we would have had to translate between somebody else's data structures
and Clownfish's, which would have slowed things down and increased the size of
our compiled shared object.

So for *us*, a custom rig is a surefire winner over adding a dependency.  But
from the perspective of other potential users, our implementation wouldn't
offer any advantages over, say, Jansson.

    http://www.digip.org/jansson/

Maybe Jansson does what you need?

Marvin Humphrey

Reply via email to