Hello there, I'm thinking about adding some scripting ability for my end users.
What it should like to be:
- an ability to write a script on a webpage
- to transfer it to a device,
- so device could run it,
- using hardware resources from script,
- maybe in a loop,
- to achieve greatest flexibility!
Now I'm using JSON configuration, and it already gives me a nice flexibility, with a rather small JSON parser. But I want more.
I was thinking to make my own scripting language for my needs, and I already did a little one, like you can make JSON array with JSON objects "commands", then execute it, parsing commands that you've implemented inside your app.
Example will be [{"cmd":"setValue", "var":"output1", "value":1},{"cmd":"wait", "seconds":3},{"cmd":"setValue", "var":"output1", "value":0}]
(this example obviously enables output1 then waits 3 s, then disables it)
Then I think that's not very cool in the long run, as you might want to make a "for" loop or comparison, or make some calculations, etc. So, I need a real scripting language that my app could parse.
Seems like coolest ones are:
- Groovy - fast, very javalike syntax, trendy
- Jython - fast, python is cool and trendy
- BeanShell - parses ordinary java code, that's cool
- Rhino - fast, javascript is very widespread and has javalike syntax
- Lua parsers - Lua is trendy in embedded apps
But you can't find J2ME parsers for most of that. So, filtering only those has J2ME/CLDC implementations, we have:
- Rhino - implementations are scary at first sight
- MiniJOE - seems nice
- minijoe - not Rhino implementation, but also a subset of javascript parser, well documented, updated in 2010
- Lua - seems nice, but which one to use? And also, it seems I need to run compiler on lua texts before feeding them to interpreter. Not so cool, but why not?
- Kahlua - seems nice, documented, updated in 2011
- Mochalua - not so documented, updated in 2008
- Luaj - greatest documentation, lots of features, compiler invoked seamlessly, updated 2013
- Jill - not so well documented, not so up-to-date 2009
- Hecl - a scripting language designed specially for J2ME, and seems it must be small, because of its reduced syntax. Though it mainly focused on UI stuff, and maybe couldn't run under CLDC, and I don't see how to bind it to your java functions.
- FScriptME - a clipped port of FScript, initially a powerful yet simple language, ME one is really small, like a few classes and ~30 kB. Although a little old (2008) and unmaintained, seem it's easy to integrate it.
Hell, that's not so easy to choose an option from this list. To be objective, one needs also a precise memory footprint and maybe some performance tests. But oh maybe not this time.
So, my dear community, what do you think on scripting under javacint?
Do you have any experience in it?
What option would you take and why?
Did I miss any option?