1

I am trying to build an Android app which read a txt file written in Java syntax and compile it via other language.

Skip java->script, I want to know how I can embed a script interpreter or something that would compile the script code.

So the basic functionality is: read the script code, compile it, give the result. e.g. show a Hello World screen.

I know there is "official" sl4a app, but I just want the compiling piece from it and embedded in my own app. Is it possible?

Btw is there any parser that translate the java code to a Python code or other script language? If so how should i read in the java code, as a string from txt or html or?

Thanks a lot.


Thanks to everyone helps! Sorry I don't know how I should edit my own post so just do it like this.

I explained in details why I am trying to do this in my response to Femi below so you can check that out.

Briefly I just want my app to read in java code and compile it. Since there is no java interpreter or compiler under Android i have to use other language. Don't know how.

Thank you!

4

2 回答 2

0

好吧,这是一个奇怪的任务选择,但是您始终可以将诸如 MVEL (http://mvel.codehaus.org/) 之类的表达式语言嵌入到您的应用程序中。我会很好奇它的性能如何,以及你想用它做什么。您是在寻找模板,还是在尝试做 Titanium 的事情,您可以使用脚本解释器来操作应用程序中的所有内容?

于 2011-05-02T21:27:08.370 回答
0

有一个名为SnapScript的解释器可以在 Android 上开箱即用地运行。您不需要编译代码,它有一个并行编译器,可以快速编译脚本,并且在 Android 上运行时开销最小。

于 2017-03-19T19:48:34.617 回答