On Monday, 29 August 2016 at 11:27:44 UTC, Basile B. wrote:
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.
Right. With these limitations, it might also be useful for
writing static analysis tools, coding guidelines checkers, ...
If someone wants to write a tool that tells me which functions
and methods are not reachable from main(), or could be declared
pure nothrow @nogc, i would be more than happy to use it :)