led is a library for adding scripting functionality to a program written in D.
The scripting language resembles bash, lua or ruby with end
as the block terminator.
age = 21;
message = (if (age > 18) "Adult" else "Minor" end);
# message => "Adult"
This library is still in pre-pre-pre alpha state.
- simple expression : some operations are not implemented, function calls are done, but no method calls.
- conditionals :
if .. else .. end
is done with returning value. - loops :
while .. end
is done. - functions : native functions and scripting funtions are done without control structures.
- classes and objects : native classes can be added by just implementing the
Type
interface, and no led classes yet - imports : not yet...
import ledengine;
import ledtypes;
import std.stdio;
void main() {
Scope ns = new Scope();
writeln(ns.Eval("2+3"));
}
Compiling and running the above D program should print 5
.
In your dub project add the dependency like this :
"dependencies": {
"libled": "~master"
}
The version can be the one of the many found in the dlang package indexing website.