lua-users home
lua-l archive

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

Hash: SHA1

(I asked about this a while ago, and there wasn't one, but given the new
interest in Lua metaprogramming I thought it was worth asking again.)

I've got this build tool of which you have heard me speak before, Prime
Mover. It ships a small but reasonably verbose Lua program as part of
its binary. As it makes no sense to ship comments in a binary, I'd
rather like to make this smaller.

With C, I can drastically reduce the size of the source code by using a
cruncher utility: this reads in the C source and emits an equivalent but
smaller source file by removing whitespace, comments, renaming locals to
smaller versions, etc.

Is there a Lua version of such a tool?

It's actually a reasonably simple problem; you just read the source file
into an AST, perform some simple manipulations (renaming locals), and
then you write it out again. If anyone has a Lua reader/writer utility,
it ought to be trivial to adapt it to do this. Does anyone?

- --
┌─── ───── ─────
│ "Wizards get cranky, / Dark days dawn, / Riders smell manky, / The
│ road goes on. / Omens are lowering, / Elves go West; / The Shire needs
│ scouring, / You may as well quest." - John M. Ford
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla -