Compiler plugins?

Rel relmail at rambler.ru
Sun Mar 8 18:37:49 UTC 2020


I want to try out making some code obfuscation and protection 
stuff for my D code base. Ideally I'd like to take the AST 
(abstract syntax tree) or some other intermediate representation 
of a module and transform it at compile time.

Do we have any option to hook into one of D's compilers pipe line 
and transform the AST or some other intermediate representation? 
Or is my task somehow can be solved with metaprogramming?

As of now one thing I can think of is emmiting LLVM IR with LDC, 
transform it and then compile to native code. This may work, but 
having a way to modify the AST for example looks more appealing, 
as the AST is kinda a much more higher level representation and D 
specific.


More information about the Digitalmars-d mailing list