www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Development of the foundation of a programming language

reply leikang <1013626230 qq.com> writes:
I want to contribute to the development of the dlang language, 
but I feel that I am insufficient, so I want to ask the big guys, 
can I participate in the development of the Dlang language after 
learning the principles of compilation?
Sep 12 2021
next sibling parent reply max haughton <maxhaton gmail.com> writes:
On Monday, 13 September 2021 at 00:53:06 UTC, leikang wrote:
 I want to contribute to the development of the dlang language, 
 but I feel that I am insufficient, so I want to ask the big 
 guys, can I participate in the development of the Dlang 
 language after learning the principles of compilation?
Yes. If you make a PR it should be and will be judged based on the code and only the code, not where or who it came from.
Sep 12 2021
parent reply leikang <1013626230 qq.com> writes:
On Monday, 13 September 2021 at 03:00:07 UTC, max haughton wrote:
 On Monday, 13 September 2021 at 00:53:06 UTC, leikang wrote:
 I want to contribute to the development of the dlang language, 
 but I feel that I am insufficient, so I want to ask the big 
 guys, can I participate in the development of the Dlang 
 language after learning the principles of compilation?
Yes. If you make a PR it should be and will be judged based on the code and only the code, not where or who it came from.
Are there any recommended books or videos to learn about the principles of compilation? What else should I learn besides the principles of compilation?
Sep 12 2021
next sibling parent reply rikki cattermole <rikki cattermole.co.nz> writes:
On 13/09/2021 3:21 PM, leikang wrote:
 Are there any recommended books or videos to learn about the principles 
 of compilation? What else should I learn besides the principles of 
 compilation?
The classic book on compilers that Walter recommends is the dragon book. https://smile.amazon.com/Compilers-Principles-Techniques-Tools-2nd-dp-0321486811/dp/0321486811 (D Language Foundation is a charity Amazon Smile recognizes).
Sep 12 2021
parent reply max haughton <maxhaton gmail.com> writes:
On Monday, 13 September 2021 at 04:08:53 UTC, rikki cattermole 
wrote:
 On 13/09/2021 3:21 PM, leikang wrote:
 Are there any recommended books or videos to learn about the 
 principles of compilation? What else should I learn besides 
 the principles of compilation?
The classic book on compilers that Walter recommends is the dragon book. https://smile.amazon.com/Compilers-Principles-Techniques-Tools-2nd-dp-0321486811/dp/0321486811 (D Language Foundation is a charity Amazon Smile recognizes).
The dragon book is really really showing it's age these days so I would highly recommend getting a copy but not reading it fully. "Engineering a compiler" is much better pedagogically. The dragon book barely mentions SSA for example, although the sections they did properly bother to update towards the end are quite interesting. "Crafting interpreters" is quite good, I recommend it for learning how to actually write a parser without getting bogged down in totally useless theory. Stephen Muchnick's "Advanced Compiler Design and Implementation" is *the* bible for optimizations, but uses a very weird unimplemented language so be careful for bugs. "Optimizing Compilers for Modern Architectures: A Dependence-based Approach" is the only book I'm aware of that actually covers even the beginnings of modern loop optimizations thoroughly. Even this however is still somewhat set back by it being written 20 years ago, the principles are the same but the instinct is not i.e. memory latency is worse, ILP is much better. What all of these books have in common, by the way, is that they were all written at a time when it was assumed that x86 would go the way of the dodo. So there is a somewhat significant deviation from "theory" and practice in some parts as (say) x86 SIMD is quite different from how the authors of the aforementioned book expected the world to go.
Sep 13 2021
parent reply Elronnd <elronnd elronnd.net> writes:
On Monday, 13 September 2021 at 11:40:10 UTC, max haughton wrote:
 The dragon book barely mentions SSA for example
In fairness, dmd doesn't use SSA either
Sep 13 2021
parent reply max haughton <maxhaton gmail.com> writes:
On Tuesday, 14 September 2021 at 03:19:46 UTC, Elronnd wrote:
 On Monday, 13 September 2021 at 11:40:10 UTC, max haughton 
 wrote:
 The dragon book barely mentions SSA for example
In fairness, dmd doesn't use SSA either
That's not a good thing.
Sep 13 2021
parent reply Elronnd <elronnd elronnd.net> writes:
On Tuesday, 14 September 2021 at 03:24:45 UTC, max haughton wrote:
 On Tuesday, 14 September 2021 at 03:19:46 UTC, Elronnd wrote:
 On Monday, 13 September 2021 at 11:40:10 UTC, max haughton 
 wrote:
 The dragon book barely mentions SSA for example
In fairness, dmd doesn't use SSA either
That's not a good thing.
No, but if the OP's goal is to contribute to dmd, learning SSA wouldn't be very helpful beyond a general acclimation to compiler arcana. (Unless they wish to add SSA to dmd--a worthy goal, but perhaps not the best thing to start out with.)
Sep 13 2021
parent max haughton <maxhaton gmail.com> writes:
On Tuesday, 14 September 2021 at 05:06:01 UTC, Elronnd wrote:
 On Tuesday, 14 September 2021 at 03:24:45 UTC, max haughton 
 wrote:
 On Tuesday, 14 September 2021 at 03:19:46 UTC, Elronnd wrote:
 On Monday, 13 September 2021 at 11:40:10 UTC, max haughton 
 wrote:
 The dragon book barely mentions SSA for example
In fairness, dmd doesn't use SSA either
That's not a good thing.
No, but if the OP's goal is to contribute to dmd, learning SSA wouldn't be very helpful beyond a general acclimation to compiler arcana. (Unless they wish to add SSA to dmd--a worthy goal, but perhaps not the best thing to start out with.)
The backend is not where our efforts should be going. There is way too much work that needs doing above it to motivate working on the backend. The backend's design for the most part is extremely simple just buried under 40 years of code. Besides, there's more to life than dmd, everything else is SSA at least some point in compilation (i.e. GCC isn't SSA all the way down but GIMPLE is).
Sep 13 2021
prev sibling parent reply Dennis <dkorpel gmail.com> writes:
On Monday, 13 September 2021 at 03:21:37 UTC, leikang wrote:
 Are there any recommended books or videos to learn about the 
 principles of compilation? What else should I learn besides the 
 principles of compilation?
Check out this video: [DConf 2016 Day 2 Keynote: Spelunking D Compiler Internals -- Walter Bright](https://www.youtube.com/watch?v=bNJhtKPugSQ) Just browsing [dmd's source code](https://github.com/dlang/dmd/tree/master/src/dmd#readme) and watching [dmd's Pull Request queue](https://github.com/dlang/dmd/pulls) is a good way to get familiar with the code and see what a bug fix looks like. Try to start with something small, like error message improvements or [refactorings listed in the contributing guide](https://github.com/dlang/dmd/blob/master/CONTRIBUTING.md# md-best-practices). If you have any questions along the way, just ask them.
Sep 13 2021
parent leikang <1013626230 qq.com> writes:
On Monday, 13 September 2021 at 10:23:14 UTC, Dennis wrote:
 On Monday, 13 September 2021 at 03:21:37 UTC, leikang wrote:
 Are there any recommended books or videos to learn about the 
 principles of compilation? What else should I learn besides 
 the principles of compilation?
Check out this video: [DConf 2016 Day 2 Keynote: Spelunking D Compiler Internals -- Walter Bright](https://www.youtube.com/watch?v=bNJhtKPugSQ) Just browsing [dmd's source code](https://github.com/dlang/dmd/tree/master/src/dmd#readme) and watching [dmd's Pull Request queue](https://github.com/dlang/dmd/pulls) is a good way to get familiar with the code and see what a bug fix looks like. Try to start with something small, like error message improvements or [refactorings listed in the contributing guide](https://github.com/dlang/dmd/blob/master/CONTRIBUTING.md# md-best-practices). If you have any questions along the way, just ask them.
Thanks!
Sep 13 2021
prev sibling parent Paul Backus <snarwin gmail.com> writes:
On Monday, 13 September 2021 at 00:53:06 UTC, leikang wrote:
 I want to contribute to the development of the dlang language, 
 but I feel that I am insufficient, so I want to ask the big 
 guys, can I participate in the development of the Dlang 
 language after learning the principles of compilation?
In addition to what others have said: there are many ways you can contribute to D without needing to know anything about compiler internals. For example, you could fix one of the many [known bugs in the standard library][1], or improve the documentation. In general, there are more things that need to be done in D than there are people with the time to do them, so any contribution is valuable. [1]: https://issues.dlang.org/buglist.cgi?bug_status=NEW&bug_status=REOPENED&component=phobos&list_id=237469&resolution=---&version=D2
Sep 13 2021