Original Post
I have a tool written in Perl, about 2600 lines of code.
The tool is used to parse XML files and genrate C++ source based on certain rules.
I'm going to rewrite the tool in Java because I'm expecting the tool will become quite complicated in the future and Perl code maybe hard to maintain (no need to debate on this please).
The reason I used Perl is then I can use simple Perl script as configuration and scripting.
The tool needs a lot of configuration and also that it needs to allow the user to handle certain events in script.
My question is, I want to hear your advice on how to do scripting, or which script language to use in Java?
My requrements:
I googled and found several candidates, but I'm not sure which one is best.
I think a lot of folks here had extended Java with scripting in your tools, so I would like to hear from you.
Thanks
Just to help you understand, below is a Perl script as the config. The user just passes its file name then the tool will load it and run it as Perl code.
The tool is used to parse XML files and genrate C++ source based on certain rules.
I'm going to rewrite the tool in Java because I'm expecting the tool will become quite complicated in the future and Perl code maybe hard to maintain (no need to debate on this please).
The reason I used Perl is then I can use simple Perl script as configuration and scripting.
The tool needs a lot of configuration and also that it needs to allow the user to handle certain events in script.
My question is, I want to hear your advice on how to do scripting, or which script language to use in Java?
My requrements:
- Lua, Perl, and Javascript are most prefered. Python is OK. Any other simple scripts that only require 10 minutes to learn are also OK but not prefered. The tool only needs one scripting language, not all the scripts mentioned above.
- Java only. No need native executable. This is negotiatable but I highly prefer this point.
- The script can handle and modify Java objects.
- Easy to integrate to my tool. I don't want to spend one day on compiling the script binding library.
- Native regular expression support in the script. Not a must but a hope.
I googled and found several candidates, but I'm not sure which one is best.
I think a lot of folks here had extended Java with scripting in your tools, so I would like to hear from you.
Thanks
Just to help you understand, below is a Perl script as the config. The user just passes its file name then the tool will load it and run it as Perl code.
$config = {
title => 'blah blah',
autoRegister => 1,
outputCallback => \&processCallback,
};
sub processCallback
{
# Perl code here to handle the callback
}