Official DMD compiler written in D

Timon Gehr timon.gehr at gmx.ch
Wed Jan 9 03:05:55 PST 2013


On 01/08/2013 10:06 PM, Philippe Sigaud wrote:
> ...
>
> Isn't SDC also in D? (Bernard Helyer and friends)
> https://github.com/bhelyer/SDC
>
>
> Also, Timon Gehr spoke of his own front-end (assumed to be in D) in the
> past, but did not provide any link to it.
>

Yes, it is in D. Nothing is released yet. It needs to be polished a 
little so that there are no known embarrassing shortcomings anymore.
(eg. the parser cannot parse extern(...) declarations in alias 
declarations yet, and I need to finish making a minor tweak to how 
template instances are analyzed in order to get circular dependency 
detection to work reliably. Furthermore, examples like the following are 
currently rejected, while I want it to work:

enum x = "enum xx = q{int y = 0;};";

struct S{
     mixin(xx);
     mixin(x);
}

<mixin at mxin.d:5>:1:6: error: declaration of 'xx' smells suspiciously fishy
enum xx = q{int y = 0;};
      ^~
mxin.d:4:11: note: this lookup should have succeeded if it was valid
     mixin(xx);
           ^~


It shouldn't be a too large change, as eg. this already works:

struct S{
     enum z = y;
     enum x = "enum xx = q{immutable y = 123;};";
     mixin(xx);
     mixin(x);
     static assert(z == 123);
}

(DMD chokes on both.)

Furthermore, I need to implement exceptions, modules, and some parts of 
compile time reflection + tons of really small features. (Where all 
ambiguities and contradictions are detected according to well-defined 
rules instead of resolved or choked on randomly as DMD likes to do.)

Also, it obviously needs a repl. :-)

CTFE is basically done (as a portable byte code interpreter, but other 
strategies, such as JIT, could be easily plugged). This is a snippet of 
my regression test suite:

auto dynRangePrimes(){
     DynRange!int impl(int start)=>
 
dynRange(cons(start,delay(()=>filter!(a=>a%start)(impl(start+1)))));
     return impl(2);
}

static assert(array(take(dynRangePrimes(), 20)) == 
[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71]);

)

I also need to decide on a licence. I assume that the alpha will be out 
in late spring. (I am busy until early spring.)

>
> But, to answer the OP question: no, there are no plan to switch to D for
> the reference compiler in the near future, as far as I can tell.
>
>



More information about the Digitalmars-d mailing list