[erlang-questions] fast JSON parser in C

Chris Anderson jchris@REDACTED
Wed Jul 23 01:29:43 CEST 2008

I'm considering wrapping one of the many fast JSON parsers written in
C, using the Erlang FFI. I'm still just learning how the pieces fit
together - got to hello world via this tutorial:

The first hurdle I've found is that it might not be all the efficient
to use C for a JSON parser, as the communication between Erlang and C
function is limited to buffers. If communication is essentially
limited to strings, I'll end up writing a parser in Erlang for
whatever I concoct on the C side... so I may be better off working to
speed up some of the existing pure Erlang JSON parser implementations.

But perhaps I'm missing something. Is there a way to construct complex
Erlang data structures (nested tuples and lists, with binary, atom,
integer and float components) directly inside C, and then return the
constructed object to Erlang where it can do things like participate
in pattern matchers, etc?


Chris Anderson

More information about the erlang-questions mailing list