2 ms·
You can get quite far with a preprocessor that's completely unaware of the semantics of the code. Or that trusts the programmer to use the macros on constructio
by zetalyrae 5y ago
You can get quite far with a preprocessor that's completely unaware of the semantics of the code. Or that trusts the programmer to use the macros on constructions of the right type.
Even parsing C "correctly" is a huge problem, since the syntax is ambiguous and the ambiguity can only be resolved by keeping a symbol table that tracks what kind of thing a symbol is.
So there's a huge pragmatic force to keep a strict separation between a type-unaware preprocessor and a full-blown compiler frontend.
(I considered using clang to dump the C AST when building cmacro, but concluded it would be too unwieldy.)