⚠️ ** This project in still in development and API is not stable. Use it at your own risk.
A JSON Parser Implemented with Zig Using Parser Combinator with C API
This is a toy project for myself to experiment with parser combinator and a more or less functional programming style.
This is largely inspired by Tsoding's json parser in
Haskell
Under the hood, we use zig's comptime
feature to generate parser combinator with zero runtime cost.
git clone https://github.com/Tesseract22/jigson.git
cd jigson
zig build
, which would generate:
zig-out/lib/libjson.so
zig-out/bin/json
, a minimal working example for reading a file and parsing it into json
zig-out/bin/c_example
, a minimal working example for using the src/c/json.h
header and linking with libjson.so
in C
To run tests,
zig test src/json.zig
To read a json file by supplying command line arguments,
zig run src/json.zig -- [path/to/json]
- Provide line and column number
xx:yy
when encountering an error - More comprehensive tests
- Stable C API
- Auto generating header with zig
-emit-h
option (currently manually created) - Benchmarking
- Support for escape characters (e.g.,
'\"'
in string)