Open sirinath opened 10 years ago
Probably the support can be added (I don't know any reason, why this shouldn't be possible). You could write and submit the code. :)
I might be a user of of this in calling using some ML code from Java but for implementing a scripting engine I am not the best person.
On Tue, 3 Dec 2013, Suminda Dharmasena wrote:
I might be a user of of this in calling using some ML code from Java but for implementing a scripting engine I am not the best person.
You can use the compiler from Java quite easily without scripting engine.
Only a thin wrapper class written in Yeti is needed, that calls evaluateYetiCode, and then you can use the wrapper from Java. Simple example would be:
module evalwrapper;
load yeti.lang.compiler.eval;
class EvalYetiCode ctx = evaluateYetiCode [],
Object eval(String code)
result = ctx [] code;
case result.result of
Result res: res;
Exception ex: throw ex;
_: failWith result.str;
esac
end
It could be used for example with following Java code:
public class TestEval { public static void main(String[] _) { new EvalYetiCode().eval("println 'Hello world'"); } }
The code could be compiled and run with following commands:
java -jar yeti.jar -d . evalwrapper.yeti javac TestEval.java java -cp yeti.jar:. TestEval
The evaluateYetiCode documentation:
http://dot.planet.ee/yeti/docs/latest/yeti.lang.compiler.eval.html#evaluateYetiCode
Thanks. This is good enough for now.
In case anybody want to take the next step with this feature request this might help: https://today.java.net/pub/a/today/2006/09/21/making-scripting-languages-jsr-223-aware.html
Can this be used as a Java Script Engine? If not can this be added?