
Migrating to DMD as a Library with D-Scanner
"Explore the journey of migrating from libdparse to using DMD as a library with D-Scanner. Learn about D-Scanner, its architecture, objectives, benefits, and the process of integrating the D Compiler as a library. Discover the significance and advantages of this transition for your projects and code analysis." (394 characters)
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
D-scanner: Migrating from libdparse to DMD-as-a-library
Just graduated @ POLITEHNICA Bucharest Computer Science & Engineering About me 2+ years @ Adobe Mostly in the JVM world Got into D through D-Scanner 2
What is D-Scanner? Static code analysis tool Bad practices, style checks 50+ code checks 4
D-Scanner architecture D-Scanner Libdparse Static analysis checks Lexical Analysis Warnings Syntactic Analysis Source code Visitors AST 5
Objective Dmd as a library D-Scanner Libdparse Static analysis checks Lexical Analysis Lexical Analysis Syntactic Analysis Warnings Syntactic Analysis Semantic Analysis Source code Visitors AST 6
Easier to tackle compiler updates Libdparse Implement DIP 9999 Update library version Replicate DIP 9999 DMD as a library D-Scanner 8
Semantic analysis Hard to perform Already implemented Allows more comprehensible checks 9
Benefits for dmd as a library Dmd as a library is still in its early stages The compiler interface changes Use in an important projects, gain useful insights 10
Lucian D nescu DConf '22: Integrating the D Compiler as a Library in D-Scanner https://www.youtube.co m/watch?v=JYkb3PjIn4 c 12
Where I started Work required A FEW OTHER CHECKS STARTED WITH PRS OPEN CODE 24 / 54 CHECKS ALREADY MIGRATED INFRASTRUCTURE FOR DMD AS A LIBRARY Work completed Work left 13
What Ive done Work required Finished migrating all checks Some maintenance work Work already completed Work completed by me Work left 14
Execution time ~15% 15
What Ill show you WORKFLOW DMD AS A LIBRARY CHALLENGES KEEPING UP WITH THE UPSTREAM 16
Workflow 17
Upstream fork MAKEFILE DUB FILE 18
Migrated checks Migration process Other areas parse module DMD parse module Code Code should Run DMD Select checks Select checks should Run Run checks Run checks analyze DMD analyze 19
Testing pipeline Integration tests Build Unit tests 20
Dmd as a library challenges 21
Not always intuitive NULL 22
Deleted checks FloatOperatorCheck CommaExpressionCheck IfStatementCheck DuplicateAttributeCheck 24
Keeping up with the upstream 25
Rebasing 26
GDC Issue 29
Conclusions 30
The missing 1% & future work New 100% Semantic analysis @nolint Autofix 31
Conclusions Dmd as a library is usable Public docs Test D-Scanner 32
Conclusions SCA Tools (compilers) are fun D is cool Rebasing is not fun 33
Is it a good idea to share the same codebase with the compiler? 34