On 2013-08-21 11:10, Flamaros wrote:

For the moment we can't use D as script language for our project, just
because there is no API to parse and execute a d file as script.

You can do something like this:

import dquick.dsl;
import std.stdio;

void executeSciprt ()
{
    mixin(import("foo.d"));
}

void main ()
{
    initialize();
    executeSciprt();
    writeln(DQuickDsl.serialize());
}

When you want to "execute" the D script you use the above as a template and only need to replace the file name, in this case "foo.d", and create a file. Compile that file run the resulting executable, this is easily done using rdmd. Retrieve the serialized data, deserialized it and do want you need with the data structures.

--
/Jacob Carlborg

Reply via email to