DIP 50 - AST macros

Dicebot public at dicebot.lv
Tue Nov 12 13:16:49 PST 2013


On Tuesday, 12 November 2013 at 20:56:34 UTC, Dmitry Olshansky 
wrote:
> If we just had:
>
> //this would invoke compiler's parser at CTFE
> auto ast = "x = y;".astof
>
> and have it work at CTFE to return sensible AST (a big if btw).
>
> And then (after some manipulations):
> ast.toString() //get back a string of D code
>
> It may help code generation of D --> DSL.

Add there "foo.codeof" in the toolset and it will pretty much 
give core needed stuff.

However, it will destroy compilation times if not coupled with 
compiler internal parsing/semantic phase.

Actual "macro" keyword syntax sugar is hardly important to me.


More information about the Digitalmars-d mailing list