We already found a few interpreters: Java (Beanshell), Scheme (SISC),
SQL (HSQLDB), Pascal (a new project on google code) we are still
looking for C or C++ interpreter that can meet our requirements.
Maybe somebody has already started or done a project in this direction
or has written a C/C++ grammar for a compiler compiler that produces
Java code.
http://root.cern.ch/drupal/content/cint
To access from your Java applet you'd need JNI and a signed applet.
Alternatively, if you need to stay within safe/managed code, there are one or
two open source projects - who's names escape me unfortunately - that allow
you to compile your native app (usually using a cross compiler) and then load
and interpret the machine object code. Not fast, especially since your native
library is another interpreter, but it might be good enough and a fun hack to
boot!
Grammars for many languages including an approximation of C++ have
been available for the Java Compiler Compiler (JavaCC, not to be
confused with javac) for many years.
Steven Shaw sent:
|------------------------------------------------------------|
|"You could use Cint - the only C and C++ interpreter I know.|
| |
| http://root.cern.ch/drupal/content/cint |
| |
|[..]" |
|------------------------------------------------------------|
I advise against this. Do you actually use Cint? I use a codebase
by someone who uses ROOT (which officially Cint is not a part of,
though aside from early versions they are packaged together). ROOT is
very buggy.
Yours sincerely,
Colin Paul Gloster
There is also UnderC, (not in Java):
http://home.mweb.co.za/sd/sdonovan/faq.htm
Translating it from C++ to Java is left as an exercise for the reader.
--
Roberto Waltman