D parser in tango or phobos

bearophile bearophileHUGS at lycos.com
Wed Sep 10 15:02:03 PDT 2008


Benji Smith:
> Depending on the architecture, of course, it might be much easier to 
> load the compiler as a library. Then you could do all sorts of neat 
> things like compiling and loading code on the fly.

This is very nice.


> A good example of its usage is in the Regex implementation, in the .NET 
> standard library. It builds a custom function, with raw GOTO opcodes and 
> everything, based on the regex string passed into the constructor at 
> runtime. Consequently, the .NET regex engine is very very efficient.

I don't know how mono Regex are done, but they are quite slow compared to most of the other ones:
http://shootout.alioth.debian.org/gp4/benchmark.php?test=regexdna&lang=all


> (NOTE: I'm not actually *advocating* any of this. Just musing. There are 
> plenty of reasons *not* to write the compiler in D, such as already 
> having done ten years of work (more on the backend) to refine the 
> existing compiler.)

I think your ideas don't touch the backend, so it can be the normal LLVM. A D compiler with a D front-end and a LLVM back-end sounds like a nice idea to me.

And the authors of the hopefully-to-be-compiler 'dil' probably think those ideas aren't that bad :-)

Bye,
bearophile



More information about the Digitalmars-d mailing list