PLDB
Languages Features Calendar About Lists Add Language
GitHub icon

D

D

D is a programming language created in 2001 by Walter Bright and Andrei Alexandrescu.

The D programming language is an object-oriented, imperative, multi-paradigm system programming language created by Walter Bright of Digital Mars and released in 2001. Bright was joined in the design and development effort in 2007 by Andrei Alexandrescu. Though it originated as a re-engineering of C++, D is a distinct language, having redesigned some core C++ features while also taking inspiration from other languages, notably Java, Python, Ruby, C#, and Eiffel. Read more on Wikipedia...

Try now: Riju ยท TIO

#54on PLDB 21Years Old 6.3kUsers

Example code from Riju:

import std.stdio; void main() { writeln("Hello, world!"); }

Example code from hello-world:

#include <stdio.h> int main() { printf("Hello World"); return 0; }

Example code from the Hello World Collection:

// Hello World in D import std.stdio; void main() { writefln("Hello World!"); }

Example code from Linguist:

unittest { }

Example code from Wikipedia:

1 import std.stdio, std.algorithm, std.range, std.string; 2 3 void main() 4 { 5 dstring[][dstring] signs2words; 6 7 foreach(dchar[] w; lines(File("words.txt"))) 8 { 9 w = w.chomp().toLower(); 10 immutable key = w.dup.sort().release().idup; 11 signs2words[key] ~= w.idup; 12 } 13 14 foreach(words; signs2words) 15 if(words.length > 1) 16 writefln(words.join(" ")); 17 }

Language features

Feature Supported Example Token
Binary Literals โœ“
// 0[Bb][01_]+
Integers โœ“
// (0|[1-9][0-9_]*)([LUu]|Lu|LU|uL|UL)?
Floats โœ“
// 0[xX]([0-9a-fA-F_]*\.[0-9a-fA-F_]+|[0-9a-fA-F_]+)[pP][+\-]?[0-9_]+[fFL]?[i]?
Hexadecimals โœ“
// 0[xX][0-9a-fA-F_]+
Octals โœ“
// 0[0-7_]+
Strings โœ“
"Hello world"
"
MultiLine Comments โœ“
/+ A comment
+/
/+ +/
Print() Debugging โœ“ printf
Line Comments โœ“
// A comment
//
Templates โœ“
template TCopy(T)
{
    void copy(out T to, T from)
    {
        to = from;
    }
}
int i;
TCopy!(int).copy(i, 3);
Operator Overloading โœ“
Comments โœ“
Pointers โœ“
Semantic Indentation ฯด

Article source

PLDB - Build the next great programming language. v5.0.0 - Acknowledgements ยท Email ยท GitHub