DIP 50 - AST macros
luka8088
luka8088 at owave.net
Fri Nov 22 01:44:14 PST 2013
On 21.11.2013. 8:28, Jacob Carlborg wrote:
> On 2013-11-20 23:25, luka8088 wrote:
>>
>> The point of this example is that mixin() accepts Ast instead of string.
>> That way, we parse our DSL to D Ast and give it straight to the compiler
>> and everything is done only once!
>
> So how is this different except for my proposal, except the use of q{}
> and "mixin"?
>
What we currently have:
custom syntax ---> custom parser ---> custom code generator ---> D
syntax (as string)
D syntax (as string) ---> mixin ---
\
D syntax (read by compiler) -----------> D AST (held by the compiler,
unreachable) ---> compilation to binary (unreachable)
The way I see it we should allow to following:
custom syntax ---> custom parser -----
\
D syntax inside <[ ... ]> template -------> D AST (as struct)
D AST (as struct) ---> mixin ---
\
D syntax (read by compiler) --------> D AST (held by compiler)
D AST (held by compiler, reachable) ---> reflection ---> D AST (as struct)
D AST (held by compiler) ---> compilation to binary
More information about the Digitalmars-d
mailing list