>>254
Stop annoying everyone and just do this in C: https://lisper.in/reader-macros
>>257
Your eagerness to avoid falling into the trap that C cannot and doesn't have anything along the lines of reader macros in Lisp, should be proof enough that you have failed. I'd say give up, but you don't seem to understand :/
But I'll take the bait, even though everyone knows you'll either say "who needs that" or
I want something like this to compile:
#include <json.h>
#include <stdio.h>
int main()
{
JSON object = [
1, 2, 3, { "complex": 5, "object": [6, 7, 8] }, [[9], 10]
];
printf("%d", object[2]);
}
So:
1. & 2. The specific example of a reader macro that parses JSON has been given and extensively explained.
3. You need to parse JSON as is in the source code, into a native data structure that can be used in C. See above example.
>>259
Just a a reminder, the point is to dynamically modify and extend the parser, and transform miscellaneous code into anything else.
Think of how `'(1 2 3)` is actually `(quote (1 2 3))`, and `'` doesn't have to be define in Lisp itself, but is "created" as part of the language. That is a good example for the beauty of Lisp, imo.
If the goal is to parse JSON, i don't need to create JSON-specific source code
I'm sorry kid, the goal is as stated in >>260 to extend the parser. JSON is just an example, I picked it because I knew there was already an article that explained and implemented it, so I didn't have to do so, just for you.
Now, we're awaiting your "Yes, you're right /prog/, there are things that Lisp can do that C can't, due to it's set of strange limitations", thank you :^)
>>263-166
No, it starts with "Yes, you're right /prog/, ...". There's no need for you to write down your autistic screeching, just because of a little embarrassing mistake ;)
We forgive you!
>>268
The ability to dynamically create, enable and disable them, during the run time, without having to recompile anything. But we're over that, we want to focus on helping you.
So, say after me: "Yes, you're right /prog/, ...". You can do it!