lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Moonshine(http://code.google.com/p/mshine) is an XPI plug-in for firefox, so you can use Lua into Firefox and play with DOM.
I interested in that project also.

Blessings!

On Tue, Oct 20, 2009 at 8:14 PM, Phil Deets <pjdeets2@gmail.com> wrote:
Hello, I have been thinking about writing a Lua to _javascript_ translator. The main use case would simply be to provide an alternative language for the web. You would just have to run the translator before you use the script.

This would be different than the lua2js which already exists on LuaForge since I would want to make it work in all cases with the only restrictions being on what modules can be used. I think lua2js only does a superficial translation. For example, I don't think it handles using functions as an index into a table.

I do not have a goal of making the output readable. In fact I might purposely obfuscate the output to hinder reverse-engineering efforts of the translated code.

The approach that seems the easiest to me is to run the Lua source through luac.exe and use the output of luac as the input of the translator. This way I don't have to worry about lexing or parsing. I also could have a smaller range of inputs to worry about; there would only be the 38 types of instructions to translate. The down-side to this approach is that the format of the luac output could change significantly between versions.

Now for my questions:
Is this already being work on?
Can you think of any major problems that would prevent the approach described in the previous paragraph from working?
Can you think of a better approach?

Thanks,
Phil

P.S. I couldn't find a search feature for the mailing list archive; so sorry if this has already been discussed.



--
Fernando P. García, http://www.develcuy.com
Developer - Analista de Sistemas
+51 1 9 8991 7871, Calle Santa Catalina Ancha #377, Cusco -Perú

** Antes de imprimir este mensaje piensa en tu compromiso con el medio ambiente, protegerlo depende de tí.