lua-users home
lua-l archive

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

On Fri, 2005-02-04 at 23:31, David Olofson wrote:

> Macro mayhem... *hehe*

> You're going to have to take it a bit further for this, though. The 
> macro preprocessor is actually quite powerful, so it's definitely 
> doable.

LOL. The C macro processor is just about as lame as you can get.
M4 is much more powerful but even more horrible.

I use a *real* preprocessor myself. All my code
is generated by Python scripts. And I do mean every
line of it. Including the whole Lua package.

How can you compare the C preprocessor with a full
scale language?

I quite dislike the Lua code because, being
written for C89 it is littered with stupid
macros for efficiency -- in C99 and C++
you'd use inline functions instead.

Another solution would be to build a lame
bootstrap version of Lua, and then use it
to build your real version -- using Lua
as the macro processor.

Surprisingly, you can do this in a couple
of lines of Lua code and get *extreme* power.

Interscript basically says:

read a line
if it starts with a @ character, execute it
otherwise write it to the current output

and that gives you the most powerful macro processor
in the world -- a full scale programming language
of your choice.

John Skaller,
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language