DMD front-end can be used as a library with Dub

Basile B. via Digitalmars-d digitalmars-d at puremagic.com
Mon Aug 29 04:27:44 PDT 2016


On Monday, 29 August 2016 at 10:42:23 UTC, Alexander Breckel 
wrote:
> I just tried to use the DMD frontend as a Dub package in my own 
> project to parse and analyze D files and it ... just worked. 
> The dub.json for dmd is fairly small and doesn't require any 
> changes to the code. This might be common knowledge, but I was 
> completely unprepared for this :)
>
> Please note: This is "only" the dmd frontend (lexer, parser, 
> semantic passes, CTFE). Code generation will be more 
> complicated.

Thx, that's interesting from an IDE developer perspective.

However since DMD is a "single shot" program, using it as library 
could introduce memory problems. Also string handling is C style, 
unlike libdparse, which is truly written in D. However libdparse 
does nothing more than producing the AST, which becomes 
problematic with "static if" expressions, mixins, etc.


More information about the Digitalmars-d mailing list