Friday, March 25, 2016

First followup on macros and resource management

It's been a while since I wrote Macros and Resource Management in this blog. I've been busy.
I guess that what I was wanting is a macro that can be called like the C preprocessor (CPP for short) to do the job.
It seems almost certain that CPP cannot do the job. I'm not sure about the alternatives at the present time like m4. It looks like a template engine like Jinja2 cannot do the job (or at least the basic features don't allow for it). If you want to correct me on this that's more than fine.
So would I have to write my own preprocessor?

Another idea is to write a program in a language that looks a lot like C, but is really something else
(like Lisp or Prolog) and write a preprocessor in the language to do the preprocessing.

I suppose I should also look at the subject of Multistage Programming to see what has been said on this. I asked an expert on Multi-Stage programming called Charles Consel (from Bordeaux) if there has been any layer on top of C that would allow the generation of C, but he replied that there only have been a few brittle prototypes.


No comments:

Post a Comment