2

I wanne develop an application, in which i want to give my enduser the possibility to script / code in something like a little script editor / textarea while the application is running.

  1. The enduser should start the GUI can load a script during runtime, change it and execute it. In the script some mathematical formula will be handled. So something like an interpreter will be needed, too. Are there any editor or interpreters for different GUIs (Web or Client) known which are very good and well developed?

  2. Are there any interpretars known which can process mathematical formula?

  3. Also some templates for Reporting (A4 size with tags) should be included in this app (which the user should change during runtime like the scripts)... are here any all in one solutions for the kind of GUIs?

Greetz

1 Answers1

1

The easiest solution is to use Java built-in support for JavaScript, see: Creating meta language with Java:

ScriptEngine jsEngine = new ScriptEngineManager().getEngineByName("JavaScript");
jsEngine.put("value1", 3);
jsEngine.put("value2", 7);
String script = "value2 - value1 * 2";
final Object result = jsEngine.eval(script);
System.out.println(result);  //yields 1

However you are limited to C-style mathematical operators and Math class.

Community
  • 1
  • 1
Tomasz Nurkiewicz
  • 334,321
  • 69
  • 703
  • 674
  • Other - not the easyiest solution - i wanted to avoid Javascript? What because of the other questions 2 & 3? – sonne.mond.sterne Feb 03 '12 at 10:19
  • @sonne.mond.sterne: In Java you can easily embed Groovy or JRuby - which are also scripting and dynamic languages. Im a not aware of math-oriented scripting languages, can you clarify in your question what are your requirements on the language? Support for statistical analysis? Matrices? Wrt to reporting there are many reporting libraries in Java world, most of them use some sort of templates that can be changed at runtime. – Tomasz Nurkiewicz Feb 03 '12 at 10:29
  • Which are good reporting libaries? – sonne.mond.sterne Feb 03 '12 at 11:46
  • @sonne.mond.sterne: I don't have an experience with any of them, but [this](http://java-source.net/open-source/charting-and-reporting) list seems exhaustive. – Tomasz Nurkiewicz Feb 03 '12 at 12:19