Weekly Programming Challenge - making our own data format
Hi everyone! There was no coding challenge last week, so I decided to make one this week. If someone wants to make his own challenge, wait few days and post it. I'm running out of ideas and I'd like to keep these challenges running on Tildes.
Everyone here knows data formats - I'm talking about XML or JSON. The task is to make your own format. The format can be as compact as possible, as human-readable as possible, or something that's really unique. Bonus points for writing encoder/decoder for your data format!
How do you handle long texts? Various unicode characters? Complex objects? Cyclic references? It's up to you if you make it fast and simple, or really complex.
I'm looking forward to your data formats. I'm sure they will beat at least csv. Good luck!
Unfortunately I don't quite have the time to approach this one this week, but it looks amazing fun...
So instead, as a little inspiration for others, what about a minimal INI parser... For sh?
It's been published before here (about 7 weeks ago?), and well... I created it for a device that could only run busybox with no room for anything else.
It's kinda awful, but translates INI into variables with a standard name mangling:
This will translate an INI file like:
Into this:
Which your script can then eval, and you can check that the appropriate values exist.
It's slightly insane, but rather fun.
Challenge accepted.
At uni after a lecture extolling the virtue of the water language we came up with an xml image schema.
It was a long time ago so I can only give you the gist of it but something like:
Ahh good times.