views:

397

answers:

3

Hello, do anyone know some C or C++ interpreter for cell phones? I have Nokia 5310 and found some Basic interpreter (CellBasic) and want to develop in C or C++ on the go. Or, does anybody knows Scheme J2ME intepreter?

A: 

j2me is notoriously slow. I can only shiver when thinking how slow it would get if it had to interpret another language. ;^)

Toad
J2ME isn't slow. Some of the devices it runs on are slow.
Ben S
I know, but I don't mind. Several years ago I have founded application called Mobile C, it is J2ME C interpreter, but it has only a few functions (conditions, cycles, printf, getint, getchar, putchar and that's all), it is not really usable. If there is Basic interpreter (and good), why not C/C++ (or Scheme)?
Garret Raziel
bens: no, in fact it is the implementation on these devices which is full of bugs, and don't use any form of jit. The devices have been quite fast since 4-5 years. You can see that if you run native apps (symbian for instance)
Toad
Just look at those CellularBasic. It can do almost everything. Either simple matematical programs, fractals, functions on CCS, sms or TCP/IP comunication programs. It is very powerfull.
Garret Raziel
Hecl is capable of running real applications, and was even on slower, older phones.
David N. Welton
+3  A: 

You don't want to do a C interpreter in J2ME unless you first compile it to bytecode elsewhere: you'd waste a lot of space with the parser.

If you're interested, I have my own interpreter that's used by various people and companies called Hecl, at http://www.hecl.org

It's fairly simple, but has commands to access a variety of things, and is under active development, with a nice user community.

David N. Welton
very nice tool, could You give an example app that uses it?
Maciek Sawicki
Viigo uses it for their Blackberry app.
David N. Welton
+1  A: 

A lot of Symbian uses JIT. Most of Sony Ericsson devices uses AOT. Lots of Nokia S40 devices uses Jazelle. JIT, AOT and Jazzele have some advantages and disadvantages but I'm sure that they're much faster than plain interpreter (like Nokia 3120's JVM).

However, there is one performance issue. There are several ways to run code in Java, e.g.:

  1. interpreter (it can use AST)
  2. generating bytecode + special ClassLoader
  3. generating bytecode and creating special jarfile
  4. using JNI

Way no 1 is possible but slow.

Way no 3 can be fast but it can be really uncomfortable and difficult to implement without library like BCEL or ASM. (I can imaginate comfortable implementation running on Sony Ericsson Java Plarform 8.5+ devices that offers to install generated app and then launches the app. Note that JP 8.5 currently support two phones: Yari and Aino.)

Ways no 2 and 4 are not feasible with J2ME CLDC.

v6ak