|
On 11/05/2011 12.37, steve donovan wrote:
On Wed, May 11, 2011 at 12:28 PM, Lorenzo Donati <lorenzodonatibz@interfree.it> wrote:On a related note, I'm really curious whether in LuaJIT is hidden a full C compilerThat would be fairly pointless, since LuaJIT makes Lua run just as fast ;)
I have heard rumors of this legendary beast, half-Lua and half-assembler, capable of extraordinary deeds! :-)
Jokes apart, I was more concerned about _easily_ generating executable code (even with no heavy optimization). For example, a Lua script generating small standalone exe files that depends only on msvcrt.dll (or the bare minimum set of system DLLs - I'm assuming Windows here) for doing various tasks.
For such things now I rely on tools like AutoIt or AutoHotKey, but they generate rather bloated exe files (and they are rather clunky BASIC-like languages - really painful programming), but at least I feel on safer ground there, because I don't have to struggle too much with API pitfalls (I'm no system programmer and that tools have rather sturdy safety nets built-in).
Of course, if Lua could do system API calls directly and there were a Lua _compiler_ that allowed to translate Lua code directly to exe files with no mandatory extra dependency, that would be sweet! :-)
As I understand, there's a really cunning little C header parser in LuaJIT, sans preprocessor. All the bits are available (I've used Alien, so that seems like a place to start) so it's a matter of putting them together. It will just be rather slow in comparison, which is probably good enough for most bindings.
Intriguing exercise! :-)
steve d.
Cheers! -- Lorenzo