kdl-zig is a KDL 2.0.0 parser/serializer that passes the full official test suite. It supports direct struct decoding/encoding and a DOM API.
(Zig 0.15.2+)
kdl-zig is a KDL 2.0.0 parser/serializer that passes the full official test suite. It supports direct struct decoding/encoding and a DOM API.
(Zig 0.15.2+)
Very nice! I look forward to trying it!
I’m planning to use KDL for my next project, and had recently bookmarked another Zig KDL library. Now I’m curious how they compare.
Edit: Looks like kdl-zig parses files all at once into Zig structs, and zig-kdl processes them bit by bit as a stream of tokens.
Appreciated, and correct on the differences there. I am currently rewriting this to be a stream consuming a reader, then emitting events, but the API will effectively stay the same. This should be pushed tomorrow.
Currently I use this for personal projects loading config files. It works, but open to feedback on direction, architecture, API or features.
I just learned about KDL from this post and I love it. That’s finally a config language I’d like to use.
However, one comment on your code, you should use the new std.Io.Reader interface instead of the old generic one. It both simplifies the code, allows you to peek (which might be helpful to a parser). For me, I’d like to use your library with async file I/O, but don’t want to read the whole file up front.
Can I suggest you add a link (probably at the very top of your README) pointing to a page that explains what KDL is? For example, https://kdl.dev/?
Noted on both counts. The latest version addresses streaming. It now takes in std.Io.Reader and std.Io.Writer for parameters. There are examples in the README for the streaming API.
It’s also a bit presumptuous to assume somebody already knows the format, and I have there is a link KDL.dev and a short explanation/example of it as well.