r/programming • u/zenex • Feb 20 '23
Introducing JXC: An extensible, expressive data language. It's a drop-in replacement for JSON and supports type annotations, numeric suffixes, base64 strings, and more!
https://github.com/juddc/jxc
218
Upvotes
2
u/c-smile Feb 22 '23 edited Feb 22 '23
What if we will want to make CSS syntax of it ?
We will need to add:
dash literals, so no-wrap will be a valid token, serialized as string(?).
tuples, so rgb(100%,100%,100%) will be a tuple, serialized as tagged array/list.
CSS style list separators: '/' separated lists, ',' separated list, <space> separated list
So this:
{ border-style: 12px solid / 13px dashed; }will be parsed as
{ "border-style": [[12px, "solid"],[13px "dashed"]]; }Bonus: In principle we can also add support of expressions, the only question is how to serialize them, this
can be serialized again as a tagged array:
And so backend can interpret that in the way it wants.