[Issue 5051] dmd flag for partial compilation (similar to just running preprocessor in C/C++)

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Oct 14 06:12:54 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=5051

Andrei Alexandrescu <andrei at erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |bootcamp
                 CC|                            |andrei at erdani.com

--- Comment #10 from Andrei Alexandrescu <andrei at erdani.com> ---
That would be an interesting project. I'm envisioning it as a standalone
program called e.g. "dlower" that lowers D code into a smaller subset of D.
Possible flags for that program:

--expand-mixins = expand all possible mixins in the code

--lookup = execute lookup on all symbols and write the full symbol, e.g.
writeln becomes .std.stdio.writeln

--operators = explicitate all user-defined operators, e.g. a + b becomes
a.opBinary!"+"(b)

--omit-function-bodies = do not output function bodies, .di style

--specialize-templates = write specialized versions for all templates used
within the module (this is likely to be tricky)

--scope = lower all scope statements into try statements

--foreach = lower all foreach statements into for statements

--explicit-import = specify the exact symbols needed for each import statement
(which means: if no symbols, the import is redundant - easy to mark as a
warning by a subsequent tool)

--static-if = evaluate all static ifs possible (this mostly makes sense if
--specialize-templates is also present)

--versions = lower code using version(), i.e. make the unused branch disappear

--omit-comments = make all comments disappear

--omit-nondoc-comments = make only non-documentation comments disappear

--ctfe = evaluate all possible CTFEs (tricky)

The tool should generate compilable D code with the same semantics as the input
and #line directives pointing to the input.

Such a tool would make possible a bunch of others. I'll talk to the graduate
students, maybe someone will take this.

--


More information about the Digitalmars-d-bugs mailing list