3 ms·
I wrote a JSON-Parser in C with minimal validation in ~250 LOC that does not allocate memory, but leaves the type check and conversion to the user. https://gith
by areop 12y ago
I wrote a JSON-Parser in C with minimal validation in ~250 LOC that does not allocate memory, but leaves the type check and conversion to the user.
https://github.com/vurtun/json https://github.com/vurtun/json
- huhtenberg 12y agoThat's a very nice code.
- klibertp 12y agoThis is absolutely beautiful. I didn't know you could get an address of a label in C or to do a goto to an address from variable instead of a literal label. Is this new in C, or was it always there?
- dietrichepp 12y agoIt's a GCC extension. https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
- techdragon 12y agoIs there an equivalent for Clang/LLVM?
- cjcole 12y agoYes. http://blog.llvm.org/2010/01/address-of-label-and-indirect-branches.html http://blog.llvm.org/2010/01/address-of-label-and-indirect-b... A venerable interpreter implementation trick.
- codehero 12y agoUnfortunately it won't port to IAR, which is a shame. I don't understand why pointers to labels never made it to the C spec; it's one of the (equivaling) features that actually makes assembler look elegant.
- rxi 12y agoThat test.c file looks familiar!
- areop 12y agoYeah I was looking for unit test macros and found your project. I added your project as a reference in the README for clarification of the origin.
- jeremie 12y agoIt would be nice if the README mentioned it was originally based on my https://github.com/quartzjer/js0n https://github.com/quartzjer/js0n :)
- areop 12y agoAdded your project as a reference. Sorry for the missing reference I originally never planned to make the project known publicly and therefore never added the references.