lua-users home
lua-l archive

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


Is 'LuaMacro' the macroprocessor documented at http://lua-users.org/wiki/LuaMacros?
It seems that this tool had the capabilities to evaluate Lua expression at compile time.
But once again, it seem that it is supported only for Lua 5.1 (+ tokenf patch).

Dominique T.

-----Original Message-----
From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On Behalf Of Dominique Torette
Sent: vendredi 11 avril 2014 17:29
To: Lua mailing list
Subject: RE: Static metaprogramming with Lua 5.2.

I would like, during lexical analysis, to evaluate a Lua expression and then substitute it with the result before continuing the compilation.
As a very basic example, I would like that the following code
	print('''os.date("%x")''')
print the 'compilation date', instead of the 'runtime date'.

-----Original Message-----
From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On Behalf Of steve donovan
Sent: vendredi 11 avril 2014 13:42
To: Lua mailing list
Subject: Re: Static metaprogramming with Lua 5.2.

On Fri, Apr 11, 2014 at 12:00 PM, Fabien <fleutot+lua@gmail.com> wrote:
> Notice that depending on how complex your metaprogramming needs are, 
> you might be better-off with a dumb text-based preprocessor.

It would be useful (and interesting) if you could give us examples of the transformations you need to apply to source.

If they're simple, then a lexical macro preprocessor like LuaMacro could do the job (macros may execute arbitrary Lua code and can temporarily take over stream processing - "reader macros").

Deep syntactical macros remain MetaLua's claim to fame....


 ------------------------------------------------------------------------------

E-MAIL DISCLAIMER

The present message may contain confidential and/or legally privileged information. If you are not the intended addressee and in case of a transmission error, please notify the sender immediately and destroy this E-mail. Disclosure, reproduction or distribution of this document and its possible attachments is strictly forbidden.

SPACEBEL denies all liability for incomplete, improper, inaccurate, intercepted, (partly) destroyed, lost and/or belated transmission of the current information given that unencrypted electronic transmission cannot currently be guaranteed to be secure or error free.
Upon request or in conformity with formal, contractual agreements, an originally signed hard copy will be sent to you to confirm the information contained in this E-mail.

SPACEBEL denies all liability where E-mail is used for private use.

SPACEBEL cannot be held responsible for possible viruses that might corrupt this message and/or your computer system.
 -------------------------------------------------------------------------------

 ------------------------------------------------------------------------------

E-MAIL DISCLAIMER

The present message may contain confidential and/or legally privileged information. If you are not the intended addressee and in case of a transmission error, please notify the sender immediately and destroy this E-mail. Disclosure, reproduction or distribution of this document and its possible attachments is strictly forbidden.

SPACEBEL denies all liability for incomplete, improper, inaccurate, intercepted, (partly) destroyed, lost and/or belated transmission of the current information given that unencrypted electronic transmission cannot currently be guaranteed to be secure or error free.
Upon request or in conformity with formal, contractual agreements, an originally signed hard copy will be sent to you to confirm the information contained in this E-mail.

SPACEBEL denies all liability where E-mail is used for private use.

SPACEBEL cannot be held responsible for possible viruses that might corrupt this message and/or your computer system.
 -------------------------------------------------------------------------------