It's worth considering the other direction - write the struct definition in json or xml, or dicts in python source or whatever, and generate the C structs and the associated functions and data from that.
Go slightly further and write out function types like that and you get something equivalent to swig, where instead of parsing C and trying to emit wrappers for other languages from that framework, you have the data in native lua tables that you emit code from.
To memorize text verbatim, you might find value in learning GMS. Mattias Ribbing has a course (search on coursio.io for his name) called "First Steps to a Complete Master Memory" and a follow-up course. This course is like the abridged version of GMS. To summarize in one sentence: GMS has you make palaces/journeys constructed from objects and their parts and you attach mnemonics to the parts. It is effective, but requires a decent amount of training. There is a second course called Pmemory (phenomenal memory) that has disappeared from the internet except for certain torrent websites. GMS (via Pmemory) was brought to the English-speaking world by an "interesting" character, but it was not invented by this character. I would suggest digging into the Pmemory material if you are serious, even though it can be a little confusing and overly prescriptive. But yes, I was able to memorize theorems and mathematical formulae verbatim. The time/energy cost was too high to maintain in my schedule, but I look forward to returning to the system in the future.