[ prog / sol / mona ]

prog


Marvin Minsky - The Beauty of the Lisp Language

259 2020-10-14 11:13

>>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.

301


VIP:

do not edit these