[webkit-dev] JSON native parser

Adam Barth abarth at webkit.org
Tue Mar 10 21:44:33 PDT 2009


On Mon, Mar 9, 2009 at 11:34 PM, Ariya Hidayat
<ariya.hidayat at trolltech.com> wrote:
>> Those efforts have mostly stalled.  If you're interested in helping
>> out, that would be much appreciated.  :)
>
> Adam, I am willing to help. Where and how do I start?

Great!  There are a couple of folks interested in working on this, so
we should be careful to avoid duplicating effort.

I would start by reading the JSON RFC (it's pretty short):

http://www.ietf.org/rfc/rfc4627.txt

Next, I would read Firefox's implementation:

http://mxr.mozilla.org/mozilla-central/source/js/src/json.cpp

For the precise JavaScript API, please see the ECMAScript 3.1 spec:

http://wiki.ecmascript.org/doku.php?id=es3.1:json_support

We want to match Firefox's (and IE's) behavior exactly.  Then I would
look at our https://bugs.webkit.org/show_bug.cgi?id=20031 which has
some possibly useful code.  If that code isn't useful, feel free to
throw it away.

Maciej recommends we implement this feature using our existing JSC
lexer and a bison grammar.  I believe JSC already uses a bison grammar
for JavaScript, so it might be worth adapting that for JSON.

Adam


More information about the webkit-dev mailing list