GSoC 2016 "GDC Project - The GNU D Compiler" project

ZombineDev via Digitalmars-d digitalmars-d at puremagic.com
Wed Mar 2 01:24:09 PST 2016


On Wednesday, 2 March 2016 at 06:44:24 UTC, Abhishek Kumar wrote:
> On Tuesday, 1 March 2016 at 11:50:02 UTC, Abhishek Kumar wrote:
>> Hello
>> I am Abhishek Kumar,computer science student from India.I am 
>> interested in working on D language during GSoC 2016.I found 
>> "GDC Project - The GNU D Compiler" interesting.
>> I have interest in programming languages and compilers.I have 
>> been working on a Python to C++ code converter,also I am 
>> writing a Javascript parser for code minification in 
>> Scala(Using scala fastparse). I have prior open source 
>> experience in Scala and good knowledge of C/C++.
>>   Can someone help me with how to start and get familiar with 
>> D?
>> I'll be glad to have your help and suggestions.
>>
>> Thanks
>> Abhishek Kumar
>
> Hello
> Thanks for your help.I am reading D and hope I'll get familiar 
> shortly.Can you give me some
> beginner friendly task to get acquainted with the D compiler?
>
> Thanks
> Abhishek Kumar

Hi

First I would suggest getting familiar with the langauge. Ali's 
book is a great starting point: 
http://ddili.org/ders/d.en/index.html

Next would suggest git cloning and building the source code the 
get some familiarity with the development process and then 
reading the open or closed (merged) pull requests to get an idea 
what is currently worked on.

The source code is here:
https://github.com/D-Programming-GDC/GDC

Also if your not familiar with git and github, these articles 
maybe helpful: 
http://readwrite.com/2013/09/30/understanding-github-a-journey-for-beginners-part-1

https://guides.github.com/introduction/flow/


=================
Some background information

A D implementation generally consists of 3 to 5 parts:
1) compiler - reads source files and generates object files.

2) Linker - D is compatible with the platform liknker (ld.bfd, 
ld.gold, lld, MSVC) however on Windows we also distribute the 
OptLink linker (which part of an older compiler project named 
DMC) for linking 32-bit OMF object files.

3) DRuntime - library that implements the language featutes that 
require run-time support and overall provides platform 
abstraction. This what you need to port when you want to expand 
the D support to another platform. (e.g. ARM/iOS, ARM/Android, 
PPC, etc.) See here for more info: 
https://github.com/D-Programming-Language/druntime

4) Phobos - the D standard library. Builds on top DRuntime to 
provide high-level features for the users of the language. See 
http://dlang.org/phobos/ and 
https://github.com/D-Programming-Language/phobos/ for more info.

5) Dub - the D package manager and build system. Initially 
developed independently, but recently gained enough popularity to 
be regarded as part of the D ecosystem. See 
http://code.dlang.org/getting_started and 
https://github.com/D-Programming-Language/dub.

3), 4) and 5) are written completely in D. 1) was initially C++ 
only, but now DMD's frontend is translated in D.

For 2) we rely on the developer's platform, but we still 
distribute OptLink on Windows for legacy reasons.

1), 3) and 4) are currently bundled together, and in the future 
the installation package will also include 5).

There are 3 major D compilers currently - DMD, GDC and LDC. They 
all share the same frontend, which is responsible for lexing 
(converting source files into a stream of tokens), parsing 
(creating AST from the token stream) and semantic analysis 
(verfying the correctness of AST, template instantiation, 
overload resolution, compile-time function evaluation (CTFE), ... 
all the language  rules are here).
GDC uses the GCC backend and LDC uses the LLVM backend.
Initially there was only DMD, which was developed by the creator 
of the language (Walter Bright) and so it is currently the 
reference implementation. DMD is based Walter Bright's older DMC 
C/C++ compiler and currently DMC and DMD share the same backend. 
It provides fast compilation times and ok code generation.
GDC and LDC on the other hand have slighly slower compilation 
time, however they produce much faster machine code than DMD.

As DMD is the reference implementation, it uses the newest 
version of the frontend and GDC and LDC are lagging behind.
I think that the most important thing that you can help with is 
giving Iain Buclaw (the main maintainer of GDC) a hand in porting 
GDC to the newest frontend version. Currently GDC is at version 
2.067 while DMD uses 2.070. This is very important because it 
would allow users of GDC to uses newer features of language or 
the standard library that are currently only available on DMD. 
And it would also make possible the use of newer D libraries on 
other platforms that DMD doesn't support.





More information about the Digitalmars-d mailing list