4 ms·
Lisp macros (that the article is talking about) work with the same input and output language, not with two different languages/representations as is written. Ma
by kazinator 9y ago
Lisp macros (that the article is talking about) work with the same input and output language, not with two different languages/representations as is written. Macros can expand to other macros and even to themselves. It's an iterative process in which the intermediate pieces of tree have fewer and fewer macros until none are left. Other than not using macros, the target code is in the same language.
(In C, the preprocessing phase also works with the same input and output language. It's not a tree data structure, but rather a sequence of preprocessor tokens. Tokens in, tokens out. Parsing is then done in the next phases of translation. Macros have to do some light parsing in order to delimit the argument lists, of course, and to identify the operators like the token pasting ##, stringification # and whatever, plus to handle the preprocessing directives and #if expressions with arithmetic.)