Offering Access to Parser
Jacob Carlborg via Digitalmars-d
digitalmars-d at puremagic.com
Thu Feb 11 01:46:58 PST 2016
On 2016-02-11 05:22, cy wrote:
> Well yes, that's my point. AST macros don't need any new special syntax
> or language support, just access to the compiler's syntax parser. Then
> you can use normal mixins to get the code you want.
Well, language support _is_ required. Perhaps not new syntax though.
In my macro DIP [1] basically the only difference is that one use the
"macro" keyword when declaring a function, then "mixin" is not necessary
on the call site. Plus parsing the input is not necessary, that's
handled automatically. That's all, the rest is just AST manipulation
using CTFE.
[1] http://wiki.dlang.org/DIP50
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list