D interpreter

Jarrett Billingsley kb3ctd2 at yahoo.com
Wed Oct 24 13:42:44 PDT 2007


"Bruce Adams" <tortoise_74 at yeah.who.co.uk> wrote in message 
news:ffo90d$sgo$1 at digitalmars.com...
> Hi,
>   Seeing the link:
>
> http://www.d-programming-language.org/
>
> posted in another thread reminded me that DMD sports a nifty D 
> interpreter. Something I always wanted for C++ incidentally. With all the 
> talk on virtual machines recently I was wondering how the D interpreter 
> works.
>
> Does it compile and run?  or use the embedded interpreter used for compile 
> time evaluation? are these one and the same?
>
> What happens with imports? Are they interpreted or compiled on the fly or 
> required to exist already?
>
> I know I should really try the experiment and find some of this out for 
> myself.
>
> How hard would it be to duplicate this behaviour in the gdc front end?
>

It's not so much an interpreter as it is const-folding on steroids.

The "interpreter" only works with a subset of language features.  Mostly, 
non-member functions which don't use dynamic memory.  This is only used to 
do CTFE.  In fact, go to the "functions" section of the spec, and at the 
end, it explains all about CTFE and what's allowed/disallowed.

Nothing has to be done with GDC because DMD and GDC have exactly the same 
frontend, they only differ in the backend (optimization and machine code 
generation).  GDC has CTFE too. 





More information about the Digitalmars-d mailing list