From 55dc9dc4984f22bbe4b53ec7bed49f4d60f1f950 Mon Sep 17 00:00:00 2001
From: zkat
--There are two major versions of KDL. Different libraries may support one or the -other, or even provide a "hybrid" mode where both versions are attempted, since -there's no data ambiguity between v1 and v2 documents.
-
| Language | -Implementation | -v1 | -v2 | -Notes | -
|---|---|---|---|---|
| C | -ckdl | -✅ | -✅ | -- |
| C#/.NET | -Kadlet | -✅ | -✖️ | -- |
| C++ | -kdlpp | -✅ | -✅ | -part of ckdl, requires C++20 | -
| Common Lisp | -kdlcl | -✅ | -✖️ | -- |
| Crystal | -kdl-cr | -✅ | -✖️ | -- |
| Dart | -kdl-dart | -✅ | -✖️ | -- |
| Elixir | -kuddle | -✅ | -✅ | -- |
| Go | -gokdl | -✅ | -✖️ | -- |
| Go | -kdl-go | -✅ | -✖️ | -- |
| Haskell | -Hustle | -✅ | -✖️ | -- |
| Java | -kdl4j | -✅ | -✖️ | -- |
| JavaScript | -@bgotink/kdl | -✅ | -✅ | -Format/comment-preserving parser | -
| JavaScript | -@virtualstate/kdl | -✅ | -✖️ | -query only, JSX based | -
| JavaScript | -kdljs | -✅ | -✖️ | -- |
| Lua | -kdlua | -✅ | -✖️ | -- |
| Nim | -kdl-nim | -✅ | -✖️ | -- |
| OCaml | -ocaml-kdl | -✅ | -✖️ | -- |
| PHP | -kdl-php | -✅ | -✖️ | -- |
| Python | -ckdl | -✅ | -✅ | -- |
| Python | -cuddle | -✅ | -✖️ | -- |
| Python | -kdl-py | -✅ | -✅ | -- |
| Ruby | -kdl-rb | -✅ | -✖️ | -- |
| Rust | -kdl-rs | -✅ | -✅ | -Format/comment-preserving parser | -
| Rust | -knus | -✅ | -✖️ | -Serde-style derive macros (not actual Serde) | -
| Swift | -kdl-swift | -✅ | -✖️ | -- |
| XSLT | -xml2kdl | -✅ | -✖️ | -- |
* Supports both KDL v1 and v2
Nodes without children are terminated by a newline, a semicolon, or the end of a file stream:
-node1; node2; node3;
+node1; node2; node3
Values
KDL supports 4 data types:
- Strings:
unquoted, "hello world", or #"hello world"#
-- Numbers:
123.45
+- Numbers:
123.45, 0xdeadbeef, #inf, #-inf, #nan
- Booleans:
#true and #false
- Null:
#null
Strings
-It supports three different formats for string input: identifiers, quoted, and raw.
+It supports three different formats for string input: unquoted, quoted, and raw.
node1 this-is-a-string
node2 "this\nhas\tescapes"
node3 #"C:\Users\zkat\raw\string"#
@@ -571,7 +416,7 @@ some other reason have need to write "JSON in KDL", continuing to use and promote something by its creator.
What about XML?
XML is actually pretty fantastic, and has long been a standard for data
exchange across many industries. At the same time, XML is known to be very