0

I have started a large project, and require some sort of scripting language that can be stored as plain text, and ran within the JVM very fast during execution. I require a language that is simple, customizable, has various Java API's/Libraries to interpret, and can be stored within a large XML file either in an attribute or the inside of a XML node.

This is required so my program can dynamically write code that it will use later, in a neural network.

10
  • you can load classes dynamically in Java. Why not write java code, run the compiler, then load your class dynamically? Commented Mar 23, 2015 at 1:57
  • This is not what I want to accomplish. What I am trying to do is dynamically run a script from a string defined in a separate XML file, with performance being critical. Commented Mar 23, 2015 at 2:01
  • So you really think writing your own language is going to be more efficient than the pros? Commented Mar 23, 2015 at 2:04
  • I do not think you understand what it is that I am trying to do. I am not writing the code, the program is, dynamically. What I want to do is find what language it will write it in, and then use that, storing it in an xml doc. Commented Mar 23, 2015 at 2:06
  • 1
    @Tarik - What, for instance, does it mean to run a language "within Java"? Commented Mar 23, 2015 at 2:16

1 Answer 1

1

LUA is the perfect fit for an interpreted language that you want embed in Java:

http://lua-users.org/wiki/LuaImplementations

A more mainstream possibility is to call Jython from Java:

http://www.jython.org/jythonbook/en/1.0/JythonAndJavaIntegration.html

Another possibility is to use Java only and invoke the compiler at run time:

http://stackoverflow.com/questions/2946338/how-do-i-programmatically-compile-and-instantiate-a-java-class

Using an interpreted language will start the exection of the script faster but the execution itself will be slower. Using the Java compiler will cost more upfront but the execution will be faster and you will be sticking to a single language.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. I will look into this deeply. I appreciate your understanding of my question, as it was a little too broad. This will be perfect.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.