lua-users home
lua-l archive

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


On Wed, Feb 06, 2002 at 01:10:19AM -0500, John Passaniti wrote:
> And when I use the word embedded, I'm talking about embedded
> systems-- not just embedding Lua into a larger application.  And
> that's a world that I think a lot of people don't really appreciate.
> These kids today with their gigabytes of system memory, 64-bit
> processors, and massive operating systems.  Most of the time the
> targets I work on are 8-bit and 16-bit microcontrollers with less
> than 64k of RAM and ROM, no operating system, and tiny stacks.
> Those platforms aren't really appropriate for Lua as it currently
> is, but if you're looking for a unique direction to take Lua, that's
> certainly one place I'd like to see future effort.  I keep telling
> myself that when I get some free time, I'm going to work on
> "microLua" a version of Lua that implements the Lua VM for tiny
> targets.  At my current rate, I should have some free time in 2015.

I hate to nay-say Lua on the mailing list, but when you have tiny
systems like this, dosn't it make sense to avoid memory expensive
stuff like lua string-based hash tables and the overhead of
interpreting bytecodes?

> But back to my stupid ideas.
> 
> I'd like to see the Lua compiler implemented in... Lua.  

I'm sorry, but I have to laugh at that one. Lua is cool and all, but
not that cool. :) Although to each his own.

> In my experience so far embedding Lua into an embedded system, I
> found that the compiler was seldom used.  In my case, I precompiled
> Lua code outside the embedded system and burned it into flash.
> Having the Lua compiler in Lua would let me do interactive
> development on the embedded target by downloading the compiler and
> then unloading it when I no longer needed it.  

You can already do interactive development on the target. The lua
library has the parser and bytecode compiler built right in. just
dostring() away.

> I suspect that with careful coding, the Lua compiler would be
> smaller (both in Lua source and object) than the equivalent C code.

I doubt it.

> I guess this gets into a bootstrap issue of how would you build the
> Lua compiler without an existing Lua compiler.  My brain hurts.

If we imagine for a second that someone might be crazy enough to do
this, Lua does not generate machine code, so the bytecode interpreter
would still be written in C. It would just be the code which parses
the lua syntax and generates bytecodes which would be written in Lua.

Good luck. :)

-- 
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + jeske@chat.net