[SAOC 2024] Improving D Error Messages Weekly Update #1

Royal Simpson Pinto royalpinto007 at gmail.com
Mon Sep 23 03:59:12 UTC 2024


## Summary of Progress (September 15 – September 22)

In this first week of Milestone 1, I focused on building an 
understanding of the DMD compiler’s internals, especially how 
error handling works, as I prepare to add SARIF support. I also 
spent time getting comfortable with contributing to the DMD 
codebase and learning more about compiler design.

### What I Worked On:

1. **Learning DMD Compiler Internals:**
    Since my goal is to improve error messages, I started by 
exploring the DMD compiler’s codebase with a focus on how errors 
are processed and reported. Understanding the flow of error 
messages is key for when I integrate SARIF support, which will 
allow error reports to be serialized in a standard format. While 
it’s been a lot to absorb, I’m starting to understand how things 
are connected.

2. **Reading "Crafting Interpreters":**
    My mentor recommended the [Crafting 
Interpreters](https://craftinginterpreters.com/) book, and I’ve 
been focusing on the sections about parsing. Even though this 
book is more about interpreters, the parsing concepts are very 
similar to what happens in compilers. This is helping me get a 
handle on how compilers like DMD break down code and, more 
importantly, how errors are caught and reported during that 
process.

3. **DMD Contribution Setup:**
    Another key task this week was setting up my environment for 
contributing to DMD. I followed the D contributor guide, cloned 
the repository, and built the compiler. Along the way, I 
documented the process, so feel free to check out my notes here: 
[D Contributor Tutorial 
Notes](https://docs.google.com/document/d/1n5jV3czsi8sA1sh4EAP-jwQSAahTJDsYRVMoCSueHcg/edit?usp=sharing).

    Going through previous contributions helped me understand the 
coding standards and how typical issues are handled. I’ll be 
applying these lessons as I start implementing SARIF support.

4. **Compiler Design Playlist (in Hindi):**
    I watched a [Compiler Design 
Playlist](https://www.youtube.com/playlist?list=PL9FuOtXibFjVR-87LcU-DS-9TJcbG97_p) by Abhishek Sharma, which is in Hindi. It was great for solidifying my understanding of the basic theory behind compilers, such as lexical analysis and syntax parsing. Even though this is theoretical, it has helped me connect the dots between compiler theory and the real code I’m working on in DMD.

5. **Attending DConf Virtually:**
    I also attended **DConf 2024** virtually, which ran from 
September 18th to 20th. This was a fantastic opportunity to get a 
better sense of the community and see the latest projects and 
features being developed in the D language.

### Challenges:

- **Understanding Error Handling and the DMD Codebase:**
   One of the main challenges I faced this week was getting a 
clear understanding of how error handling is managed within the 
DMD compiler. While I’ve been able to pinpoint the key areas 
where errors are generated and processed, the system is quite 
complex and tightly integrated into the broader DMD codebase. It 
will take more time and exploration to fully grasp how everything 
fits together. Additionally, navigating the DMD codebase itself 
has been a learning curve. There’s a lot to absorb, and I may 
need to reach out to the D community for advice and clarification 
as I continue digging deeper.

### Next Week’s Plan:

- Continue focusing on error handling in DMD, trying to 
understand the full process from where errors are generated to 
how they are reported.
- Begin outlining how I’ll integrate SARIF support into DMD and 
start with a basic proof-of-concept, with the help of my mentor.
- Keep learning by exploring more of the DMD codebase and 
connecting with the D community for feedback and suggestions.

---

This week was all about getting familiar with the codebase, 
setting up my tools, and building the necessary knowledge. I’m 
excited to move forward and begin the actual work on improving D 
error messages in the coming weeks.



More information about the Digitalmars-d mailing list