ImportC can now automatically run the preprocessor

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Mon May 16 05:00:31 UTC 2022


On Monday, 16 May 2022 at 03:12:47 UTC, Walter Bright wrote:
> I'm not going to pretend this can ever be a complete 100% 
> solution, after all:
>
>     #define BEGIN {
>     #define END }
>
> What can one do with that? Phooey.

Just do the right thing. Build macro expansion into the lexer and 
tag tokens from macros. Then sort it out in the parser an 
remaining ambiguities in semantic analysis.

> I've talked with Atila about how dpp handles it. dpp looks for 
> general patterns, and replaces those with generic D

Sounds like a hack. Think instead in terms of C grammar 
productions and how they match with D.

> But I still don't understand - why mixin this stuff? Why would 
> someone want to type C code into a D source file?

The problem isnt why, but that it will make code less readable 
and only be understood by the inner hardcore.

You really need to set up a list of requirements for what is 
needed in terms of usability for regular D users otherwise 
forkit’s concerns will materialize...




More information about the Digitalmars-d mailing list