Is it possible to use DMD as a library to compile strings at runtime?

Saurabh Das saurabh.das at gmail.com
Sat Feb 1 03:21:41 UTC 2020


On Friday, 31 January 2020 at 14:25:30 UTC, Basile B. wrote:
> On Friday, 31 January 2020 at 11:19:37 UTC, Saurabh Das wrote:
>> [...]
>
> Fundamentally DMD as a library is a front-end. Jitting is to 
> the backend side.
> You'll be able to lex and parse the source to get an AST, to 
> perform the semantic passes on this AST and that's all.
>
> Then to run this code you would need to make an AST visitor 
> that will generate the binary code to execute. Even using a 
> specialized library with jitting abilities, such as LLVM-d [1] 
> or libfirm-d [2], this would be *quite* a journey.
>
> [1] https://github.com/MoritzMaxeiner/llvm-d
> [2] https://gitlab.com/basile.b/libfirm-d

Thank you. That's enough to get me started tinkering!

Saurabh


More information about the Digitalmars-d-learn mailing list