By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,490 Members | 1,489 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,490 IT Pros & Developers. It's quick & easy.

J2ME and Parser and bytecode

P: n/a
Hi,

Does anyone know of a good place to look for a starting point -- I'm
building an application on J2ME and I want to have a scripting
language to both access my UI and the database RMS. Most phones have
very limited resources so the interpreter should be small and fast.
Does anyone know of a simple scripting language source to handle if (
) { } else {} and while ( ) { } and expressions and function calls
back into Java. I'm using javacc at the moment and it's good but it
generates a lot of code.

Plus, I'd like the script to be compiled into a bytestream and then
executed on the phone. The compilation will happen before loading on
the phone. It's a little like javac compiling .java to .class and then
the KVM executing the bytecode. The problem is that ClassLoader
support is not in J2ME ( or I would compile the scripts as .class
[renaming them, of course] and load via ClassLoader) and the size of
the class is limited by the phone's preverifier, but the resource
limits are much higher. Therefore, we can put the scripts and
database stuff in a resource and allow our app do more than the limits
of phone's preverifier allows.
Basically, the question is:

Is there a small language/ compiler/ executor example out there?
Or is it better to simply obfuscate the source script (making it
smaller) and run that?

Thanks,
Ralph
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Ralph Yozzo wrote:
Hi,

Does anyone know of a good place to look for a starting point -- I'm
building an application on J2ME and I want to have a scripting
language to both access my UI and the database RMS. Most phones have
very limited resources so the interpreter should be small and fast.
Does anyone know of a simple scripting language source to handle if (
) { } else {} and while ( ) { } and expressions and function calls
back into Java. I'm using javacc at the moment and it's good but it
generates a lot of code.

Plus, I'd like the script to be compiled into a bytestream and then
executed on the phone. The compilation will happen before loading on
the phone. It's a little like javac compiling .java to .class and then
the KVM executing the bytecode. The problem is that ClassLoader
support is not in J2ME ( or I would compile the scripts as .class
[renaming them, of course] and load via ClassLoader) and the size of
the class is limited by the phone's preverifier, but the resource
limits are much higher. Therefore, we can put the scripts and
database stuff in a resource and allow our app do more than the limits
of phone's preverifier allows.
Basically, the question is:

Is there a small language/ compiler/ executor example out there?
Or is it better to simply obfuscate the source script (making it
smaller) and run that?

Thanks,
Ralph


You might want to take a look at LuaJava - http://www.ideais.com.br/luajava/

Disclaimer: haven't got around to playing with it myself yet.

--
Chris Gray ch***@kiffer.eunet.be
/k/ Embedded Java Solutions

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.