D scripting in D

Laeeth Isharc via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jun 2 09:13:03 PDT 2017


On Friday, 2 June 2017 at 02:06:27 UTC, Mike B Johnson wrote:
> I wonder if it is possible to somehow turn D in to a scripting 
> language that can be run inside D?
>
> The point? To have the same uniform syntax for quickly 
> developing scripts that can then be easily transferred, if 
> desired, in to a complete binary.
>
> e.g., suppose I am working in some type of analysis software. 
> Use a Dscript like feature to develop and test different 
> analysis algorithms quickly(rather than using the compile and 
> execute model)... then once everything is working, move the 
> code to a D file and compile it directly.
>
> Since the syntax would be identical(or nearly so) it would be 
> quite easy to copy and paste... unlike, say, using lua or some 
> other non-D like scripting language.

Stefan Koch has written a good part of an interpreter for D AST, 
no? And I guess the lexing and parsing stage doesn't take so 
long, whereas not having to link saves much time.

So is there any way to repurpose his work on ctfe to have an 
interpreter that you can call at run time, set context for and 
get return values back?




More information about the Digitalmars-d-learn mailing list