lua-users home
lua-l archive

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


Hi!

Maybe this is not exactly what you want, but there is a CLUE:
http://cluecc.sourceforge.net/

It can compile C to Lua, Python, Perl, Java and _javascript_.

The project seems abandoned, but it can help to understand how the translation could be made.


On Wed, Mar 13, 2013 at 3:31 PM, Rena <hyperhacker@gmail.com> wrote:
Just had an interesting thought: could you write a compiler in Lua,
that compiles C into Lua bytecode or source code?

I think you'd need a C module (compiled to native code) that provides
Lua the ability to do some of the things C can do, such as call
syscalls and allocate raw memory blocks (char*s), but once you have
that framework in place, it could be possible to compile C programs
into Lua code, that would then only rely on Lua and that "framework"
module.

Or have I finally gone off the deep end?

--
Sent from my Game Boy.




--

С уважением,
Технический директор компании my-apps.com
Запольнов Николай

http://www.my-apps.com/
mail: zapolnov@gmail.com
skype: nzapps
http://www.facebook.com/nzapps
http://vk.com/nikolayz